def analyze_batch(batchLabel, batchdatadir=batchdatadir): params, data = batch_utils.load_batch(batchLabel, batchdatadir=batchdatadir) batch = (batchLabel, params, data) batch_analysis.plot_batch_raster(batch, timeRange=[100, 1000], markerSize=0.5, orderInverse=False) batch_analysis.plot_vtraces(batch, timerange=[100, 1000])
def plot_batch_ind_conn(batchLabel, batchdatadir=batchdatadir, includePre=['all'], includePost=['all'], feature='strength', orderBy='gid', figSize=(10, 10), groupBy='pop', groupByIntervalPre=None, groupByIntervalPost=None, graphType='matrix', synOrConn='syn', synMech=None, connsFile=None, tagsFile=None, clim=None, fontSize=12, saveData=None, showFig=False, save=True, outputdir='batch_figs'): """Plots individual connectivity plots for each parameter combination.""" from netpyne import specs if type(batchLabel) == str: params, data = batch_utils.load_batch(batchLabel, batchdatadir=batchdatadir) elif type(batchLabel) == tuple: batchLabel, params, data = batchLabel else: raise Exception() simLabels = data.keys() for simLabel in simLabels: print('Plotting sim: ' + simLabel) datum = data[simLabel] cfg = specs.SimConfig(datum['simConfig']) cfg.createNEURONObj = False sim.initialize() # create network object and set cfg and net params sim.loadAll('', data=datum, instantiate=False) sim.setSimCfg(cfg) try: print('Cells created: ' + str(len(sim.net.allCells))) except: print('Alternate sim loading...') sim.net.createPops() sim.net.createCells() sim.setupRecording() sim.gatherData() sim.allSimData = datum['simData'] features = [ 'weight', 'delay', 'numConns', 'probability', 'strength', 'convergence', 'divergence' ] for feature in features: if save: saveFig = batchdatadir + '/' + batchLabel + '/' + 'connFig_' + feature + simLabel + '.png' else: saveFig = None sim.analysis.plotConn(includePre=includePre, includePost=includePost, feature=feature, orderBy=orderBy, figSize=figSize, groupBy=groupBy, groupByIntervalPre=groupByIntervalPre, groupByIntervalPost=groupByIntervalPost, graphType=graphType, synOrConn=synOrConn, synMech=synMech, connsFile=connsFile, tagsFile=tagsFile, clim=clim, fontSize=fontSize, saveData=saveData, saveFig=saveFig, showFig=showFig)
def plot_batch_ind_stats(batchLabel, batchdatadir=batchdatadir, include=['allCells', 'eachPop'], statDataIn={}, timeRange=None, graphType='boxplot', stats=['rate', 'isicv'], bins=50, popColors=[], histlogy=False, histlogx=False, histmin=0.0, density=False, includeRate0=False, legendLabels=None, normfit=False, histShading=True, xlim=None, dpi=100, figSize=(6, 8), fontSize=12, saveData=None, showFig=True, save=True, outputdir='batch_figs'): """Plots individual connectivity plots for each parameter combination.""" from netpyne import specs if type(batchLabel) == str: params, data = batch_utils.load_batch(batchLabel, batchdatadir=batchdatadir) elif type(batchLabel) == tuple: batchLabel, params, data = batchLabel else: raise Exception() simLabels = data.keys() for simLabel in simLabels: print('Plotting sim: ' + simLabel) datum = data[simLabel] cfg = specs.SimConfig(datum['simConfig']) cfg.createNEURONObj = False sim.initialize() # create network object and set cfg and net params sim.loadAll('', data=datum, instantiate=False) sim.setSimCfg(cfg) try: print('Cells created: ' + str(len(sim.net.allCells))) except: print('Alternate sim loading...') sim.net.createPops() sim.net.createCells() sim.setupRecording() sim.gatherData() sim.allSimData = datum['simData'] if save: saveFig = batchdatadir + '/' + batchLabel + '/' + 'statFig_' + simLabel else: saveFig = None sim.analysis.plotSpikeStats(include=include, statDataIn=statDataIn, timeRange=timeRange, graphType=graphType, stats=stats, bins=bins, popColors=popColors, histlogy=histlogy, histlogx=histlogx, histmin=histmin, density=density, includeRate0=includeRate0, legendLabels=legendLabels, normfit=normfit, histShading=histShading, xlim=xlim, dpi=dpi, figSize=figSize, fontSize=fontSize, saveData=saveData, saveFig=saveFig, showFig=showFig)
def plot_batch_ind_raster(batchLabel, batchdatadir=batchdatadir, include=['allCells'], timeRange=None, maxSpikes=1e8, orderBy='gid', orderInverse=False, labels='legend', popRates=False, spikeHist=None, spikeHistBin=5, syncLines=False, figSize=(10, 8), saveData=None, showFig=False, save=True, outputdir='batch_figs'): """Plots individual raster plots for each parameter combination.""" from netpyne import specs if type(batchLabel) == str: params, data = batch_utils.load_batch(batchLabel, batchdatadir=batchdatadir) elif type(batchLabel) == tuple: batchLabel, params, data = batchLabel else: raise Exception() simLabels = data.keys() for simLabel in simLabels: print('Plotting sim: ' + simLabel) datum = data[simLabel] cfg = specs.SimConfig(datum['simConfig']) cfg.createNEURONObj = False sim.initialize() # create network object and set cfg and net params sim.loadAll('', data=datum, instantiate=False) sim.setSimCfg(cfg) try: print('Cells created: ' + str(len(sim.net.allCells))) except: print('Alternate sim loading...') sim.net.createPops() sim.net.createCells() sim.setupRecording() sim.gatherData() sim.allSimData = datum['simData'] if save: saveFig = batchdatadir + '/' + batchLabel + '/' + 'rasterFig' + simLabel + '.png' else: saveFig = None sim.analysis.plotRaster(include=include, timeRange=timeRange, maxSpikes=maxSpikes, orderBy=orderBy, orderInverse=orderInverse, labels=labels, popRates=popRates, spikeHist=spikeHist, spikeHistBin=spikeHistBin, syncLines=syncLines, figSize=figSize, saveData=saveData, saveFig=saveFig, showFig=showFig)
# n = int(T * fs) # total number of samples # t = np.linspace(0, T, n, endpoint=False) # # "Noisy" data. We want to recover the 1.2 Hz signal from this. # data = np.sin(1.2*2*np.pi*t) + 1.5*np.cos(9*2*np.pi*t) + 0.5*np.sin(12.0*2*np.pi*t) # Using our own experimental data exptrace = 2 # Trace number to filter (0 to 9) expdata = batch_utils.import_excel( "/u/graham/projects/eee/data/srdjan_20171017/B_73_004.xlsx") t = np.array(expdata.index.tolist()) data = np.array(expdata.iloc[:, trace].tolist()) # Using our own sim data simtrace = 6 # Trace number to filter (0 to 9) batchname = 'glutAmp' params, data = batch_utils.load_batch(batchname) simdata = batch_analysis.get_vtraces(params, data, cellID=0, section="soma", stable=50) data = simdata['yarray'][simtrace, :] t = simdata['xvector'] # Filter the data, and plot both the original and filtered signals. y = butter_lowpass_filter(data, cutoff, fs, order) plt.subplot(2, 1, 2) plt.plot(t, data, 'b-', label='data') plt.plot(t, y, 'g-', linewidth=2, label='filtered data') plt.xlabel('Time [sec]')