Skip to content

Commit 66f1676

Browse files
authored
Merge pull request #69 from MetaCell/changePlotMethod
use only one function for plotting
2 parents 5309c24 + adaa46f commit 66f1676

2 files changed

Lines changed: 14 additions & 141 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 13 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -211,151 +211,24 @@ def getDirList(self, dir=None, onlyDirs = False):
211211
elif not onlyDirs:
212212
dir_list.append({'title': f, 'path': ff})
213213
return dir_list
214-
215-
def getNetPyNE2DNetPlot(self):
216-
args = self.getPlotSettings('plot2Dnet')
217-
fig = analysis.plot2Dnet(showFig=False, **args)
218-
if fig==-1:
219-
return fig
220-
svgs=[]
221-
svgs.append(ui.getSVG(fig))
222-
return svgs.__str__()
223-
224-
def getNetPyNEShapePlot(self):
225-
args = self.getPlotSettings('plotShape')
226-
fig = analysis.plotShape(showFig=False, **args)
227-
if fig==-1:
228-
return fig
229-
svgs = []
230-
svgs.append(ui.getSVG(fig))
231-
return svgs.__str__()
232-
233-
def getNetPyNEConnectionsPlot(self):
234-
args = self.getPlotSettings('plotConn')
235-
fig = analysis.plotConn(showFig=False, **args)
236-
if fig==-1:
237-
return fig
238-
svgs=[]
239-
svgs.append(ui.getSVG(fig))
240-
return svgs.__str__()
241-
242-
def getNetPyNERasterPlot(self):
243-
args = self.getPlotSettings('plotRaster')
244-
fig = analysis.plotRaster(showFig=False, **args)
245-
if fig==-1:
246-
return fig
247-
svgs=[]
248-
svgs.append(ui.getSVG(fig))
249-
return svgs.__str__()
250-
251-
def getNetPyNETracesPlot(self):
252-
args = self.getPlotSettings('plotTraces')
253-
figs = analysis.plotTraces(showFig=False, **args)
254-
if figs==-1:
255-
return figs
256-
svgs = []
257-
for key, value in figs.iteritems():
258-
logging.debug("Found plot for "+ key)
259-
svgs.append(ui.getSVG(value))
260-
return svgs.__str__()
261214

262-
def getNetPyNESpikeHistPlot(self):
263-
args = self.getPlotSettings('plotSpikeHist')
264-
fig = analysis.plotSpikeHist(showFig=False, **args)
265-
if fig==-1:
266-
return fig
267-
else:
268-
svgs=[]
269-
svgs.append(ui.getSVG(fig[0]))
270-
return svgs.__str__()
271-
272-
def getNetPyNESpikeStatsPlot(self):
273-
args = self.getPlotSettings('plotSpikeStats')
274-
fig = analysis.plotSpikeStats(showFig=False, **args)
275-
if fig==-1:
276-
return fig
277-
else:
278-
svgs=[]
279-
svgs.append(ui.getSVG(fig[0]))
280-
return svgs.__str__()
281-
282-
def getNetPyNEGrangerPlot(self):
283-
args = self.getPlotSettings('granger')
284-
fig = analysis.granger(plotFig=True, showFig=False, **args)
285-
if fig==-1:
286-
return fig
287-
else:
288-
fig=fig[-1]
289-
svgs=[]
290-
svgs.append(ui.getSVG(fig))
291-
return svgs.__str__()
292-
293-
def getNetPyNERatePSDPlot(self):
294-
args = self.getPlotSettings('plotRatePSD')
295-
fig = analysis.plotRatePSD(showFig=False, **args)
215+
def getPlot(self, plotName, LFPflavour):
216+
args = self.getPlotSettings(plotName)
217+
if LFPflavour:
218+
args['plots'] = [LFPflavour]
219+
fig = getattr(analysis, plotName)(showFig=False, **args)[0]
296220
if fig==-1:
297221
return fig
298-
else:
299-
fig=fig[0]
300-
svgs = []
301-
svgs.append(ui.getSVG(fig))
302-
return svgs.__str__()
303-
304-
def getNetPyNELFPTimeSeriesPlot(self):
305-
args = self.getPlotSettings('plotLFP')
306-
args['plots'] = ['timeSeries']
307-
fig = analysis.plotLFP(showFig=False, **args)
308-
if fig==-1:
309-
return fig
310-
else:
311-
svgs = []
312-
svgs.append(ui.getSVG(fig[0][0]))
313-
return svgs.__str__()
314-
315-
def getNetPyNELFPPSDPlot(self):
316-
args = self.getPlotSettings('plotLFP')
317-
args['plots'] = ['PSD']
318-
fig = analysis.plotLFP(showFig=False, **args)
319-
if fig==-1:
320-
return fig
321-
else:
322-
svgs = []
323-
svgs.append(ui.getSVG(fig[0][0]))
324-
325-
return svgs.__str__()
326-
327-
def getNetPyNELFPSpectrogramPlot(self):
328-
args = self.getPlotSettings('plotLFP')
329-
args['plots'] = ['spectrogram']
330-
fig = analysis.plotLFP(showFig=False, **args)
331-
if fig==-1:
332-
return fig
333-
else:
222+
elif isinstance(fig, list):
223+
return [ui.getSVG(fig[0])].__str__()
224+
elif isinstance(fig, dict):
334225
svgs = []
335-
svgs.append(ui.getSVG(fig[0][0]))
336-
337-
return svgs.__str__()
338-
339-
def getNetPyNELFPLocationsPlot(self):
340-
args = self.getPlotSettings('plotLFP')
341-
args['plots'] = ['locations']
342-
fig = analysis.plotLFP(showFig=False, **args)
343-
if fig==-1:
344-
return fig
226+
for key, value in fig.iteritems():
227+
logging.debug("Found plot for "+ key)
228+
svgs.append(ui.getSVG(value))
229+
return svgs.__str__()
345230
else:
346-
svgs = []
347-
svgs.append(ui.getSVG(fig[0][0]))
348-
349-
return svgs.__str__()
350-
351-
def getNetPyNERxDConcentrationPlot(self):
352-
args = self.getPlotSettings('plotRxDConcentration')
353-
fig = analysis.plotRxDConcentration(showFig=False, **args)
354-
if fig==-1:
355-
return fig
356-
svgs=[]
357-
svgs.append(ui.getSVG(fig))
358-
return svgs.__str__()
231+
return [ui.getSVG(fig)].__str__()
359232

360233
def getAvailablePops(self):
361234
return netParams.popParams.keys()

utilities/install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def main(argv):
4646
clone('https://github.com/openworm/pygeppetto.git','pygeppetto','v0.4.1-M1')
4747
subprocess.call(['pip', 'install', '-e', '.'], cwd='./pygeppetto/')
4848

49-
clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','0.7.9')
49+
clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','v0.7.9')
5050
subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/')
5151

5252
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','v0.4.1-M2','', True )

0 commit comments

Comments
 (0)