netpyne.analysis.spikes

Module for anaysis and plotting of spiking-related results

Functions:

calculateRate([include, peakBin, timeRange])

Function for/to <short description of netpyne.analysis.spikes.calculateRate>

calculatefI()

plotRaster([include, timeRange, maxSpikes, …])

Function for/to <short description of netpyne.analysis.spikes.plotRaster>

plotRatePSD([include, timeRange, binSize, …])

Function for/to <short description of netpyne.analysis.spikes.plotRatePSD>

plotRateSpectrogram([include, timeRange, …])

Function for/to <short description of netpyne.analysis.spikes.plotRateSpectrogram>

plotRates([include, peakBin, timeRanges, …])

Function for/to <short description of netpyne.analysis.spikes.plotRates>

plotSpikeHist([include, timeRange, binSize, …])

Function for/to <short description of netpyne.analysis.spikes.plotSpikeHist>

plotSpikeStats([include, statDataIn, …])

Function for/to <short description of netpyne.analysis.spikes.plotSpikeStats>

plotSyncs([include, timeRanges, …])

Function for/to <short description of netpyne.analysis.spikes.plotSyncs>

plotfI(amps, times, dur[, target, …])

Function to plot frequency-current (fI) relationship

popAvgRates([tranges, show])

Function for/to <short description of netpyne.analysis.spikes.popAvgRates>

netpyne.analysis.spikes.calculateRate(include=['allCells', 'eachPop'], peakBin=5, timeRange=None)[source]

Function for/to <short description of netpyne.analysis.spikes.calculateRate>

Parameters
  • include (list) – <Short description of include> Default: ['allCells', 'eachPop'] Options: <option> <description of option>

  • peakBin (int) – <Short description of peakBin> Default: 5 Options: <option> <description of option>

  • timeRange (<None?>) – <Short description of timeRange> Default: None Options: <option> <description of option>

netpyne.analysis.spikes.calculatefI()[source]
netpyne.analysis.spikes.plotRaster(include=['allCells'], timeRange=None, maxSpikes=100000000.0, orderBy='gid', orderInverse=False, labels='legend', popRates=False, spikeHist=None, spikeHistBin=5, syncLines=False, lw=2, marker='|', markerSize=5, popColors=None, figSize=(10, 8), fontSize=12, dpi=100, saveData=None, saveFig=None, showFig=True)[source]

Function for/to <short description of netpyne.analysis.spikes.plotRaster>

Parameters
  • include (list) – Cells to include in the plot. Default: ['allCells'] plots all cells Options: ['all'] plots all cells and stimulations, ['allNetStims'] plots just stimulations, ['popName1'] plots a single population, ['popName1', 'popName2'] plots multiple populations, [120] plots a single cell, [120, 130] plots multiple cells, [('popName1', 56)] plots a cell from a specific population, [('popName1', [0, 1]), ('popName2', [4, 5, 6])], plots cells from multiple populations

  • timeRange (list [start, stop]) – Time range to plot. Default: None plots entire time range Options: <option> <description of option>

  • maxSpikes (int) – Maximum number of spikes to be plotted. Default: 1e8 Options: <option> <description of option>

  • orderBy (str) – Unique numeric cell property by which to order the y-axis. Default: 'gid' orders by cell ID Options: 'y' orders by cell y-location, 'ynorm' orders by cell normalized y-location

  • orderInverse (bool) – Inverts the y-axis order if True. Default: False Options: <option> <description of option>

  • labels (str) – Show population labels in a legend or as an overlay on one side of raster. Default: 'legend' Options: 'overlay'

  • popRates (bool) – Include population firing rates on plot if True. Default: False Options: <option> <description of option>

  • spikeHist (str) – Include spike histogram (spikes/bin) on plot. Default: None Options: 'overlay' overlays the histogram directly on the raster plot 'subplot' shows the histogram as a subplot to the raster plot

  • spikeHistBin (int) – Size of bin in ms to use for spike histogram. Default: 5 Options: <option> <description of option>

  • syncLines (bool) – Calculate synchrony measure and plot vertical lines for each spike to evidence synchrony if True. Default: False Options: <option> <description of option>

  • lw (int) – Line width for each spike. Default: 2 Options: <option> <description of option>

  • marker (str) – Marker for each spike. Default: '|' Options: <option> <description of option>

  • markerSize (int) – Size of marker for each spike. Default: 5 Options: <option> <description of option>

  • popColors (dict) – Dictionary with custom color (value) used for each population (key). Default: None uses standard colors Options: <option> <description of option>

  • figSize (list [width, height]) – Size of figure in inches. Default: (10, 8) Options: <option> <description of option>

  • fontSize (int) – Font size on figure. Default: 12 Options: <option> <description of option>

  • dpi (int) – Resolution of figure in dots per inch. Default: 100 Options: <option> <description of option>

  • saveData (bool or str) – Whether and where to save the data used to generate the plot. Default: False Options: True autosaves the data, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.pkl' and '.json'

  • saveFig (bool or str) – Whether and where to save the figure. Default: False Options: True autosaves the figure, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.png', '.jpg', '.eps', and '.tiff'

  • showFig (bool) – Shows the figure if True. Default: True Options: <option> <description of option>

netpyne.analysis.spikes.plotRatePSD(include=['eachPop', 'allCells'], timeRange=None, binSize=5, minFreq=1, maxFreq=100, transformMethod='morlet', stepFreq=1, NFFT=256, noverlap=128, smooth=0, norm=False, overlay=True, popColors=None, ylim=None, figSize=(10, 8), fontSize=12, lineWidth=1.5, saveData=None, saveFig=None, showFig=True)[source]

Function for/to <short description of netpyne.analysis.spikes.plotRatePSD>

Parameters
  • include (list) – Populations and cells to include in the plot. Default: ['eachPop', 'allCells'] plots histogram for each population and overall average Options: ['all'] plots all cells and stimulations, ['allNetStims'] plots just stimulations, ['popName1'] plots a single population, ['popName1', 'popName2'] plots multiple populations, [120] plots a single cell, [120, 130] plots multiple cells, [('popName1', 56)] plots a cell from a specific population, [('popName1', [0, 1]), ('popName2', [4, 5, 6])], plots cells from multiple populations

  • timeRange (list [start, stop]) – Time range to plot. Default: None plots entire time range Options: <option> <description of option>

  • binSize (int) – Size in ms of spike bins. Default: 5 Options: <option> <description of option>

  • minFreq (float) – Minimum frequency to show in plot. Default: 1 Options: <option> <description of option>

  • maxFreq (float) – Maximum frequency to show in plot. Default: 100 Options: <option> <description of option>

  • transformMethod (str) – Sets the transform method. Default: 'morlet' Options: 'fft'

  • stepFreq (float) – Step frequency for Morlet transform. Default: 1 Options: <option> <description of option>

  • NFFT (int) – The number of data points used in each block for the FFT (power of 2) Default: 256 Options: <option> <description of option>

  • noverlap (int) – Sets noverlap in FFT transform. Default: 128 Options: <option> <description of option>

  • smooth (int) – Window size for smoothing; no smoothing if 0. Default: 0 Options: <option> <description of option>

  • norm (bool) – Normalize power. Default: False Options: <option> <description of option>

  • overlay (bool) – Whether to overlay plots or use subplots. Default: True overlays plots. Options: <option> <description of option>

  • popColors (dict) – Dictionary with custom color (value) used for each population (key). Default: None uses standard colors Options: <option> <description of option>

  • ylim (list [min, max]) – Sets the y limits of the plot. Default: None Options: <option> <description of option>

  • figSize (list [width, height]) – Size of figure in inches. Default: (10, 8) Options: <option> <description of option>

  • fontSize (int) – Font size on figure. Default: 12 Options: <option> <description of option>

  • lineWidth (float) – Line width in the plot. Default: 1.5 Options: <option> <description of option>

  • saveData (bool or str) – Whether and where to save the data used to generate the plot. Default: False Options: True autosaves the data, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.pkl' and '.json'

  • saveFig (bool or str) – Whether and where to save the figure. Default: False Options: True autosaves the figure, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.png', '.jpg', '.eps', and '.tiff'

  • showFig (bool) – Shows the figure if True. Default: True Options: <option> <description of option>

netpyne.analysis.spikes.plotRateSpectrogram(include=['allCells', 'eachPop'], timeRange=None, binSize=5, minFreq=1, maxFreq=100, stepFreq=1, NFFT=256, noverlap=128, smooth=0, overlay=True, ylim=None, transformMethod='morlet', norm=False, popColors={}, lineWidth=1.5, fontSize=12, figSize=(10, 8), saveData=None, saveFig=None, showFig=True)[source]

Function for/to <short description of netpyne.analysis.spikes.plotRateSpectrogram>

Parameters
  • include (list) – <Short description of include> Default: ['allCells', 'eachPop'] Options: <option> <description of option>

  • timeRange (<None?>) – <Short description of timeRange> Default: None Options: <option> <description of option>

  • binSize (int) – <Short description of binSize> Default: 5 Options: <option> <description of option>

  • minFreq (int) – <Short description of minFreq> Default: 1 Options: <option> <description of option>

  • maxFreq (int) – <Short description of maxFreq> Default: 100 Options: <option> <description of option>

  • stepFreq (int) – <Short description of stepFreq> Default: 1 Options: <option> <description of option>

  • NFFT (int) – <Short description of NFFT> Default: 256 Options: <option> <description of option>

  • noverlap (int) – <Short description of noverlap> Default: 128 Options: <option> <description of option>

  • smooth (int) – <Short description of smooth> Default: 0 Options: <option> <description of option>

  • overlay (bool) – <Short description of overlay> Default: True Options: <option> <description of option>

  • ylim (<None?>) – <Short description of ylim> Default: None Options: <option> <description of option>

  • transformMethod (str) – <Short description of transformMethod> Default: 'morlet' Options: <option> <description of option>

  • norm (bool) – <Short description of norm> Default: False Options: <option> <description of option>

  • popColors (dict) – <Short description of popColors> Default: {} Options: <option> <description of option>

  • lineWidth (float) – <Short description of lineWidth> Default: 1.5 Options: <option> <description of option>

  • fontSize (int) – <Short description of fontSize> Default: 12 Options: <option> <description of option>

  • figSize (tuple) – <Short description of figSize> Default: (10, 8) Options: <option> <description of option>

  • saveData (<None?>) – <Short description of saveData> Default: None Options: <option> <description of option>

  • saveFig (<None?>) – <Short description of saveFig> Default: None Options: <option> <description of option>

  • showFig (bool) – <Short description of showFig> Default: True Options: <option> <description of option>

netpyne.analysis.spikes.plotRates(include=['allCells', 'eachPop'], peakBin=5, timeRanges=None, timeRangeLabels=None, colors=None, figSize=(5, 5), saveData=None, ylim=None, saveFig=None, showFig=True)[source]

Function for/to <short description of netpyne.analysis.spikes.plotRates>

Parameters
  • include (list) – <Short description of include> Default: ['allCells', 'eachPop'] Options: <option> <description of option>

  • peakBin (int) – <Short description of peakBin> Default: 5 Options: <option> <description of option>

  • timeRanges (<None?>) – <Short description of timeRanges> Default: None Options: <option> <description of option>

  • timeRangeLabels (<None?>) – <Short description of timeRangeLabels> Default: None Options: <option> <description of option>

  • colors (<None?>) – <Short description of colors> Default: None Options: <option> <description of option>

  • figSize (tuple) – <Short description of figSize> Default: (5, 5) Options: <option> <description of option>

  • saveData (<None?>) – <Short description of saveData> Default: None Options: <option> <description of option>

  • ylim (<None?>) – <Short description of ylim> Default: None Options: <option> <description of option>

  • saveFig (<None?>) – <Short description of saveFig> Default: None Options: <option> <description of option>

  • showFig (bool) – <Short description of showFig> Default: True Options: <option> <description of option>

netpyne.analysis.spikes.plotSpikeHist(include=['eachPop', 'allCells'], timeRange=None, binSize=5, overlay=True, graphType='line', measure='rate', norm=False, smooth=None, filtFreq=None, filtOrder=3, axis=True, popColors=None, figSize=(10, 8), dpi=100, saveData=None, saveFig=None, showFig=True, **kwargs)[source]

Function for/to <short description of netpyne.analysis.spikes.plotSpikeHist>

Parameters
  • include (list) – Populations and cells to include in the plot. Default: ['eachPop', 'allCells'] plots histogram for each population and overall average Options: ['all'] plots all cells and stimulations, ['allNetStims'] plots just stimulations, ['popName1'] plots a single population, ['popName1', 'popName2'] plots multiple populations, [120] plots a single cell, [120, 130] plots multiple cells, [('popName1', 56)] plots a cell from a specific population, [('popName1', [0, 1]), ('popName2', [4, 5, 6])], plots cells from multiple populations

  • timeRange (list [start, stop]) – Time range to plot. Default: None plots entire time range Options: <option> <description of option>

  • binSize (int) – Size of bin in ms to use for spike histogram. Default: 5 Options: <option> <description of option>

  • overlay (bool) – Plots each group on a separate axis if False. Default: True plots each group on one axis Options: <option> <description of option>

  • graphType (str) – Show histograms as line graphs or bar plots. Default: 'line' Options: 'bar'

  • measure (str) – Whether to plot spike freguency (rate) or spike count. Default: 'rate' Options: 'count'

  • norm (bool) – Whether to normalize the data or not. Default: False does not normalize the data Options: <option> <description of option>

  • smooth (int) – Window width for smoothing. Default: None does not smooth the data Options: <option> <description of option>

  • filtFreq (int or list) – Frequency for low-pass filter (int) or frequencies for bandpass filter in a list: [low, high] Default: None does not filter the data Options: <option> <description of option>

  • filtOrder (int) – Order of the filter defined by filtFreq. Default: 3 Options: <option> <description of option>

  • axis (bool) – Whether to include a labeled axis on the figure. Default: True includes a labeled axis Options: False includes a scale bar

  • popColors (dict) – Dictionary with custom color (value) used for each population (key). Default: None uses standard colors Options: <option> <description of option>

  • figSize (list [width, height]) – Size of figure in inches. Default: (10, 8) Options: <option> <description of option>

  • dpi (int) – Resolution of figure in dots per inch. Default: 100 Options: <option> <description of option>

  • saveData (bool or str) – Whether and where to save the data used to generate the plot. Default: False Options: True autosaves the data, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.pkl' and '.json'

  • saveFig (bool or str) – Whether and where to save the figure. Default: False Options: True autosaves the figure, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.png', '.jpg', '.eps', and '.tiff'

  • showFig (bool) – Shows the figure if True. Default: True Options: <option> <description of option>

  • kwargs (<type>) – <Short description of kwargs> Default: required

netpyne.analysis.spikes.plotSpikeStats(include=['eachPop', 'allCells'], statDataIn={}, timeRange=None, graphType='boxplot', stats=['rate', 'isicv'], bins=50, histlogy=False, histlogx=False, histmin=0.0, density=False, includeRate0=False, legendLabels=None, normfit=False, histShading=True, xlim=None, popColors={}, figSize=(6, 8), fontSize=12, dpi=100, saveData=None, saveFig=None, showFig=True, **kwargs)[source]

Function for/to <short description of netpyne.analysis.spikes.plotSpikeStats>

Parameters
  • include (list) – Populations and cells to include in the plot. Default: ['eachPop', 'allCells'] plots histogram for each population and overall average Options: ['all'] plots all cells and stimulations, ['allNetStims'] plots just stimulations, ['popName1'] plots a single population, ['popName1', 'popName2'] plots multiple populations, [120] plots a single cell, [120, 130] plots multiple cells, [('popName1', 56)] plots a cell from a specific population, [('popName1', [0, 1]), ('popName2', [4, 5, 6])], plots cells from multiple populations

  • statDataIn (dict) – A pre-computed dictionary of stats data to import. Default: {} Options: <option> <description of option>

  • timeRange (list [start, stop]) – Time range to plot. Default: None plots entire time range Options: <option> <description of option>

  • graphType (str) – Whether to plot stats using boxplots or histograms. Default: 'boxplot' Options: 'histogram'

  • stats (list) – Statistics to plot. Default: ['rate', 'isicv'] Options: ['rate', 'isicv', 'sync', 'pairsync']

  • bins (int or list) – Number of bins (if int) or edges (if list) for histogram Default: 50 Options: <option> <description of option>

  • histlogy (bool) – <Short description of histlogy> Default: False Options: <option> <description of option>

  • histlogx (bool) – Whether to make the x axis logarithmic Default: False Options: <option> <description of option>

  • histmin (float) – The minimumum value to include in analyses. Default: 0.0 Options: <option> <description of option>

  • density (bool) – If True, weights values by density Default: False Options: <option> <description of option>

  • includeRate0 (bool) – Needs documentation. Default: False Options: <option> <description of option>

  • legendLabels (list?) – Needs documentation. Default: None Options: <option> <description of option>

  • normfit (bool) – Needs documentation. Default: False Options: <option> <description of option>

  • histShading (bool) – Needs documentation. Default: True Options: <option> <description of option>

  • xlim (list [min, max]) – Sets the x limits of the plot. Default: None Options: <option> <description of option>

  • popColors (dict) – Dictionary with custom color (value) used for each population (key). Default: {} uses standard colors Options: <option> <description of option>

  • figSize (list [width, height]) – Size of figure in inches. Default: (10, 8) Options: <option> <description of option>

  • fontSize (int) – Font size on figure. Default: 12 Options: <option> <description of option>

  • dpi (int) – Resolution of figure in dots per inch. Default: 100 Options: <option> <description of option>

  • saveData (bool or str) – Whether and where to save the data used to generate the plot. Default: False Options: True autosaves the data, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.pkl' and '.json'

  • saveFig (bool or str) – Whether and where to save the figure. Default: False Options: True autosaves the figure, '/path/filename.ext' saves to a custom path and filename, valid file extensions are '.png', '.jpg', '.eps', and '.tiff'

  • showFig (bool) – Shows the figure if True. Default: True Options: <option> <description of option>

  • kwargs (<type>) – <Short description of kwargs> Default: required

netpyne.analysis.spikes.plotSyncs(include=['allCells', 'eachPop'], timeRanges=None, timeRangeLabels=None, colors=None, figSize=(5, 5), saveData=None, saveFig=None, showFig=True)[source]

Function for/to <short description of netpyne.analysis.spikes.plotSyncs>

Parameters
  • include (list) – <Short description of include> Default: ['allCells', 'eachPop'] Options: <option> <description of option>

  • timeRanges (<None?>) – <Short description of timeRanges> Default: None Options: <option> <description of option>

  • timeRangeLabels (<None?>) – <Short description of timeRangeLabels> Default: None Options: <option> <description of option>

  • colors (<None?>) – <Short description of colors> Default: None Options: <option> <description of option>

  • figSize (tuple) – <Short description of figSize> Default: (5, 5) Options: <option> <description of option>

  • saveData (<None?>) – <Short description of saveData> Default: None Options: <option> <description of option>

  • saveFig (<None?>) – <Short description of saveFig> Default: None Options: <option> <description of option>

  • showFig (bool) – <Short description of showFig> Default: True Options: <option> <description of option>

netpyne.analysis.spikes.plotfI(amps, times, dur, target={}, calculateOnset=False, targetRatesOnset=[], durSteady=None, targetRatesSteady=[], calculateFeatures=[], saveFig=None, showFig=True)[source]

Function to plot frequency-current (fI) relationship

Parameters
  • amps (<type>) – <Short description of amps> Default: required

  • times (<type>) – <Short description of times> Default: required

  • dur (<type>) – <Short description of dur> Default: required

  • targetRates (list) – <Short description of targetRates> Default: [] Options: <option> <description of option>

  • calculateOnset (bool) – <Short description of calculateOnset> Default: False Options: <option> <description of option>

  • targetRatesOnset (list) – <Short description of targetRatesOnset> Default: [] Options: <option> <description of option>

  • durSteady (<None?>) – <Short description of durSteady> Default: None Options: <option> <description of option>

  • targetRatesSteady (list) – <Short description of targetRatesSteady> Default: [] Options: <option> <description of option>

  • saveFig (<None?>) – <Short description of saveFig> Default: None Options: <option> <description of option>

  • showFig (bool) – <Short description of showFig> Default: True Options: <option> <description of option>

Returns

A tuple consisting of the Matplotlib figure handle and a dictionary containing the plot data

Return type

(fig, dict)

See also

calculatefI

netpyne.analysis.spikes.popAvgRates(tranges=None, show=True)[source]

Function for/to <short description of netpyne.analysis.spikes.popAvgRates>

Parameters
  • tranges (<None?>) – <Short description of tranges> Default: None Options: <option> <description of option>

  • show (bool) – <Short description of show> Default: True Options: <option> <description of option>