netpyne.analysis.tools

Module for utilities to help analyze and plot results

Functions:

exception(function)

Wrapper function to catch exceptions in functions

getInclude([include, sim])

Function to return the cells indicated by the include list

getSpktSpkid([cellGids, timeRange, sim])

Function to efficiently get a subset of spikes based on a timeRange and cellGids list

plotData([sim])

Wrapper to run plotting functions specified in simConfig

saveData(data[, fileName, fileDesc, ...])

Function to save data to a file

loadData(fileName[, fileDir, sim])

Function to load data from a file (JSON or Python Pickle)

checkAvailablePlots([requireCfg])

Function to check which plots are available for the GUI

netpyne.analysis.tools.exception(function)[source]

Wrapper function to catch exceptions in functions

Parameters:

function (function) – A Python function Required

netpyne.analysis.tools.getInclude(include='allCells', sim=None)[source]

Function to return the cells indicated by the include list

Parameters:
  • include (str, int, list) – Cells and/or NetStims to return information for Default: ‘allCells’ includes all cells Options: (1) ‘all’ includes all cells and all NetStims, (2) ‘allNetStims’ includes all NetStims but no cells, (3) a string which matches a pop name includes all cells in that pop, (4) a string which matches a NetStim name includes that NetStim, (5) an int includes the cell with that global identifier (GID), (6) a list of ints includes the cells with those GIDS, (7) a list with two items, the first of which is a string matching a pop name and the second of which is an int or a list of ints, includes the relative cell(s) from that population (e.g. (‘popName’, [0, 1]) includes the first two cells in popName, which are not likely to be the cells with GID 0 and 1)

  • sim (NetPyNE sim object) – Default: None uses the current NetPyNE sim object

Returns:

cells, cellGids, netStimLabelscells is a list of dicts containing cell information, cellGids is a list of ints of the global identifier (GID) for each cell, netStimLabels is a list of strings of the included stimulations

Return type:

tuple

netpyne.analysis.tools.getSpktSpkid(cellGids=[], timeRange=None, sim=None)[source]

Function to efficiently get a subset of spikes based on a timeRange and cellGids list

Parameters:
  • cellGids (list) – A list of cells to include by global identifier (GID) Default: []

  • timeRange ([start, stop]) – A list of two floats specifying the time range of spikes to include Default: None includes the entire simulation time range

  • sim (NetPyNE sim object) – Default: None uses the current NetPyNE sim object

Returns:

A tuple consisting of the subset in a Pandas dataframe, a list of spike times, and a list of spike GIDs

Return type:

(selection, spkt, spkid)

netpyne.analysis.tools.plotData(sim=None)[source]

Wrapper to run plotting functions specified in simConfig

Parameters:

sim (NetPyNE sim object) – Default: None uses the current NetPyNE sim object

netpyne.analysis.tools.saveData(data, fileName=None, fileDesc=None, fileType=None, fileDir=None, sim=None, **kwargs)[source]

Function to save data to a file

Parameters:
  • data (data object) – Required

  • fileName (str) – Default: None uses sim.cfg.fileName

  • fileDesc (str) – Default: None If fileDesc is a string, it will be added to the file name after an underscore

  • fileType (str) – Default: None saves the data as a Python Pickle file Options: 'json' saves the data in a .json file

  • fileDir (str) – Default: None saves to the current directory

  • sim (NetPyNE sim object) – Default: None uses the current NetPyNE sim object

Returns:

fileName – The complete name, with extension and path, of the file saved

Return type:

str

netpyne.analysis.tools.loadData(fileName, fileDir=None, sim=None)[source]

Function to load data from a file (JSON or Python Pickle)

Parameters:
  • fileName (str) – Required

  • fileDir (str) – The directory to load the data file from Default: None loads from the current directory

  • sim (NetPyNE sim object) – Default: None uses the current NetPyNE sim object

Returns:

data – The data from the file

Return type:

dict

netpyne.analysis.tools.checkAvailablePlots(requireCfg=False)[source]

Function to check which plots are available for the GUI

Parameters:

requireCfg (bool) – Whether a plot configuration in sim.cfg.analysis is required to return True for each plot Default: False

Returns:

output – Keys indicate the name of the analysis function and values whether they are available or not (Boolean)

Return type:

dict