netpyne.analysis.info

Module for analyzing and plotting information theory results

Functions:

nTE([cells1, cells2, spks1, spks2, ...])

Function that calculates the Normalized Transfer Entropy (nTE) between two spike train signals.

plotGranger([cells1, cells2, spks1, spks2, ...])

Function that calculates Granger Causality between two spike train signals.

granger([cells1, cells2, spks1, spks2, ...])

Function that calculates Granger Causality between two spike train signals.

netpyne.analysis.info.nTE(cells1=[], cells2=[], spks1=None, spks2=None, timeRange=None, binSize=20, numShuffle=30)[source]

Function that calculates the Normalized Transfer Entropy (nTE) between two spike train signals.

Transfer entropy is a model-free statistic that is able to measure the time-directed transfer of information between stochastic variables and therefore provides an asymmetric method to measure information transfer. In simple words, the nTE represents the fraction of information in X explained by its own past which is not explained by the past of Y.

Kale, P. et al (2018, July). Normalized Transfer Entropy as a Tool to Identify Multisource Functional Epileptic Networks IEEE Engineering in Medicine and Biology Society (EMBC) https://doi.org/10.1109/embc.2018.8512532

Parameters:
  • cells1 (list) – Subset of cells from which to obtain spike train 1. Default: [] 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

  • cells2 (list) – Subset of cells from which to obtain spike train 2. Default: [] Options: same as for cells1

  • spks1 (list) – Spike train 1; list of spike times; if omitted then obtains spikes from cells1. Default: None Options: <option> <description of option>

  • spks2 (list) – Spike train 2; list of spike times; if omitted then obtains spikes from cells2. Default: None Options: <option> <description of option>

  • timeRange (list [min, max]) – Range of time to calculate nTE in ms. Default: None uses the entire simulation time range Options: <option> <description of option>

  • binSize (int) – Bin size used to convert spike times into histogram. Default: 20 Options: <option> <description of option>

  • numShuffle (int) – Number of times to shuffle spike train 1 to calculate TEshuffled; note: nTE = (TE - TEShuffled)/H(X2F|X2P). Default: 30 Options: <option> <description of option>

netpyne.analysis.info.plotGranger(cells1=None, cells2=None, spks1=None, spks2=None, label1=None, label2=None, timeRange=None, binSize=5, testGranger=False, plotFig=True, saveData=None, saveFig=None, showFig=True)[source]

Function that calculates Granger Causality between two spike train signals.

The Granger causality test is a statistical hypothesis test for determining whether one time series is useful in forecasting another. G-causality is based on the simple idea that causes both precede and help predict their effects.

Seth, A. K., Barrett, A. B., & Barnett, L. (2015). Granger Causality Analysis in Neuroscience and Neuroimaging. Journal of Neuroscience, 35(8), 3293–3297. https://doi.org/10.1523/jneurosci.4399-14.2015

Parameters:
  • cells1 (list) – Subset of cells from which to obtain spike train 1. Default: None 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

  • cells2 (list) – Subset of cells from which to obtain spike train 2. Default: None Options: same as for cells1

  • spks1 (list) – Spike train 1; list of spike times; if omitted then obtains spikes from cells1. Default: None

  • spks2 (list) – Spike train 2; list of spike times; if omitted then obtains spikes from cells2. Default: None

  • label1 (str) – Label for spike train 1 to use in plot. Default: None

  • label2 (str) – Label for spike train 2 to use in plot. Default: None

  • timeRange (list [min, max]) – Range of time to calculate nTE in ms. Default: None uses the entire simulation time range

  • binSize (int) – Bin size used to convert spike times into histogram. Default: 5

  • testGranger (bool) – Whether to test the Granger calculation. Default: False

  • plotFig (bool) – Whether to plot a figure showing Granger Causality Fx2y and Fy2x Default: True

  • 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

netpyne.analysis.info.granger(cells1=None, cells2=None, spks1=None, spks2=None, label1=None, label2=None, timeRange=None, binSize=5, testGranger=False, plotFig=True, saveData=None, saveFig=None, showFig=True)

Function that calculates Granger Causality between two spike train signals.

The Granger causality test is a statistical hypothesis test for determining whether one time series is useful in forecasting another. G-causality is based on the simple idea that causes both precede and help predict their effects.

Seth, A. K., Barrett, A. B., & Barnett, L. (2015). Granger Causality Analysis in Neuroscience and Neuroimaging. Journal of Neuroscience, 35(8), 3293–3297. https://doi.org/10.1523/jneurosci.4399-14.2015

Parameters:
  • cells1 (list) – Subset of cells from which to obtain spike train 1. Default: None 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

  • cells2 (list) – Subset of cells from which to obtain spike train 2. Default: None Options: same as for cells1

  • spks1 (list) – Spike train 1; list of spike times; if omitted then obtains spikes from cells1. Default: None

  • spks2 (list) – Spike train 2; list of spike times; if omitted then obtains spikes from cells2. Default: None

  • label1 (str) – Label for spike train 1 to use in plot. Default: None

  • label2 (str) – Label for spike train 2 to use in plot. Default: None

  • timeRange (list [min, max]) – Range of time to calculate nTE in ms. Default: None uses the entire simulation time range

  • binSize (int) – Bin size used to convert spike times into histogram. Default: 5

  • testGranger (bool) – Whether to test the Granger calculation. Default: False

  • plotFig (bool) – Whether to plot a figure showing Granger Causality Fx2y and Fy2x Default: True

  • 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