bluepysnap.spike_report¶
Spike report access.
Classes
|
Access to filtered SpikeReport data. |
|
Access to PopulationSpikeReport data. |
|
Access to SpikeReport data. |
- class bluepysnap.spike_report.FilteredSpikeReport(spike_report, group=None, t_start=None, t_stop=None)¶
Access to filtered SpikeReport data.
Initialize a FilteredSpikeReport.
A FilteredSpikeReport is a lazy and cached object which contains the filtered data from all the populations of a report.
- Parameters:
spike_report (SpikeReport) – The SpikeReport to filter.
group (None/int/list/np.array/dict) – Get spikes filtered by group. See NodePopulation.
t_start (float) – Include only frames occurring at or after this time.
t_stop (float) – Include only frames occurring at or before this time.
- Returns:
A FilteredSpikeReport object.
- Return type:
- firing_animation(x_axis='x', y_axis='y', dt=20, ax=None)¶
Simple animation of simulation spikes.
Each frame of the animation represents the spiking nodes during a period of dt ms seconds in a coordinate system corresponding to the x, y or z axis of the circuit.
- Parameters:
x_axis (str) – Node enum that will determine the animation x_axis
y_axis (str) – Node enum that will determine the animation y_axis
dt (int) – the time bin size of each frame in the video in ms
ax (matplotlib.Axis) – matplotlib Axis to draw on (if not specified, pyplot.gca() and plt.figure() are used).
- Returns:
the matplotlib animation object and the corresponding axis.
- Return type:
(matplotlib.animation.FuncAnimation, matplotlib.Axis)
Examples
From scripts:
>>> import matplotlib.pyplot as plt >>> from bluepysnap import Simulation >>> report = Simulation("config.json").spikes["my_population"] >>> anim, ax = report.firing_animation() >>> plt.show() >>> # to save the animation : do not plt.show() and just anim.save('my_movie.mp4')
From notebooks:
>>> from IPython.display import HTML >>> from bluepysnap import Simulation >>> report = Simulation("config.json").spikes["my_population"] >>> anim, ax = report.firing_animation() >>> HTML(anim.to_html5_video())
- firing_rate_histogram(time_binsize=None, ax=None)¶
Spike firing rate histogram.
This plot shows the number of nodes firing during a range of time.
- Parameters:
time_binsize (None/int/float) – bin size (milliseconds). If None, a binning heuristic is used to create an histogram with ~100 spikes per bin in average.
ax (matplotlib.Axis) – matplotlib Axis to draw on (if not specified, pyplot.gca() is used).
- Returns:
Axis containing firing rate histogram.
- Return type:
matplotlib.Axis
Notes
If no axis is provided through the ax=ax keyword argument, then a default layout is set using pyplot.gca().
- isi(use_frequency=False, binsize=None, ax=None)¶
Interspike interval histogram.
This plots show the binned time/frequency interval between to spikes for neurons.
- Parameters:
use_frequency (bool) – use inverse interspike interval times (Hz)
binsize (None/int/float) – bin size in milliseconds or Hz. If None is used the binning is delegated to matplolib and is done automatically.
ax (matplotlib.Axis) – matplotlib Axis to draw on (if not specified, pyplot.gca() is used).
- Returns:
axis containing the interspike interval histogram.
- Return type:
matplotlib.Axis
Notes
If no axis is provided through the ax=ax keyword argument, then a default layout is set using pyplot.gca().
- raster(y_axis=None, ax=None)¶
Spike raster plot.
Shows a global overview of the circuit’s firing nodes. The y axis can project either the node_ids or any properties present in the different node populations.
- Parameters:
y_axis (None/str) – The property to display on the y axis. None is node_ids.
ax (matplotlib.Axis) – matplotlib Axis to draw on (if not specified, pyplot.gca() is used).
- Returns:
Axis containing Spikes raster plot.
- Return type:
matplotlib.Axis
Notes
If no axis is provided through the ax=ax keyword argument, then a default layout is set using pyplot.gca().
- report¶
Access to the report data.
- Returns:
A DataFrame containing the data from the report. Row’s indices are the different timestamps and the columns are ids and population names.
- Return type:
pandas.DataFrame
- class bluepysnap.spike_report.PopulationSpikeReport(spike_report, population_name)¶
Access to PopulationSpikeReport data.
Initializes a PopulationSpikeReport object from a SpikeReport.
- Parameters:
spike_report (SpikeReport) – SpikeReport containing this spike report population.
population_name (str) – the population name corresponding to this report.
- Returns:
A PopulationSpikeReport object.
- Return type:
- get(group=None, t_start=None, t_stop=None)¶
Fetch spikes from the report.
- Parameters:
group (None/int/list/np.array/dict) – Get spikes filtered by group. See NodePopulation.
t_start (float) – Include only spikes occurring at or after this time.
t_stop (float) – Include only spikes occurring at or before this time.
- Returns:
return spiking node_ids indexed by sorted spike time.
- Return type:
pandas.Series
- property name¶
Return the name of the population.
- node_ids¶
Returns the node ids present in the report.
- Returns:
Numpy array containing the node_ids included in the report
- Return type:
np.Array
- nodes¶
Return the NodePopulation corresponding to this spike report.
- resolve_nodes(group, raise_missing_property=True)¶
Transform a node group into a node_id array.
- class bluepysnap.spike_report.SpikeReport(simulation)¶
Access to SpikeReport data.
Initializes a SpikeReport object from a simulation object.
- Parameters:
simulation (Simulation) – Simulation containing this spike report.
- Returns:
A SpikeReport object.
- Return type:
- property config¶
Access to the spike ‘output’ config part.
- property dt¶
Returns the frequency of reporting in milliseconds.
- filter(group=None, t_start=None, t_stop=None)¶
Returns a FilteredSpikeReport.
A FilteredSpikeReport is a lazy and cached object which contains the filtered data from all the populations of a report.
- Parameters:
group (None/int/list/np.array/dict) – Get spikes filtered by group. See NodePopulation.
t_start (float) – Include only frames occurring at or after this time.
t_stop (float) – Include only frames occurring at or before this time.
- Returns:
A FilteredSpikeReport object.
- Return type:
- log()¶
Context manager for the spike log file.
- population_names¶
Returns the population names included in this report.
- property simulation¶
Return the Simulation object related to this spike report.
- property time_start¶
Returns the starting time of the simulation. Default is zero.
- property time_stop¶
Returns the stopping time of the simulation.
- property time_units¶
Returns the time unit of reporting.