Content¶
-
nngt.simulation.
activity_types
(spike_detector, limits, network=None, phase_coeff=(0.5, 10.0), mbis=0.5, mfb=0.2, mflb=0.05, skip_bursts=0, simplify=False, fignums=[], show=False)[source]¶ Analyze the spiking pattern of a neural network.
- @todo:
- think about inserting t=0. and t=simtime at the beginning and at the
end of
times
.
Parameters: - spike_detector (NEST node(s), (tuple or list of tuples)) – The recording device that monitored the network’s spikes
- limits (tuple of floats) – Time limits of the simulation regrion which should be studied (in ms).
- network (
Network
, optional (default: None)) – Neural network that was analyzed - phase_coeff (tuple of floats, optional (default: (0.2, 5.))) – A phase is considered bursting’ when the interspike between all spikes
that compose it is smaller than ``phase_coeff[0] / avg_rate` (where
avg_rate
is the average firing rate), quiescent’ when it is greater that ``phase_coeff[1] / avg_rate`, `mixed’ otherwise. - mbis (float, optional (default: 0.5)) – Maximum interspike interval allowed for two spikes to be considered in the same burst (in ms).
- mfb (float, optional (default: 0.2)) – Minimal fraction of the neurons that should participate for a burst to be validated (i.e. if the interspike is smaller that the limit BUT the number of participating neurons is too small, the phase will be considered as localized).
- mflb (float, optional (default: 0.05)) – Minimal fraction of the neurons that should participate for a local burst to be validated (i.e. if the interspike is smaller that the limit BUT the number of participating neurons is too small, the phase will be considered as mixed).
- skip_bursts (int, optional (default: 0)) – Skip the skip_bursts first bursts to consider only the permanent regime.
- simplify (bool, optional (default: False)) – If
True
, mixed phases that are contiguous to a burst are incorporated to it. - return_steps (bool, optional (default: False)) – If
True
, a second dictionary, phases_steps will also be returned. @todo: not implemented yet - fignums (list, optional (default: [])) – Indices of figures on which the periods can be drawn.
- show (bool, optional (default: False)) – Whether the figures should be displayed.
Note
Effects of skip_bursts and limits[0] are cumulative: the limits[0] first milliseconds are ignored, then the skip_bursts first bursts of the remaining activity are ignored.
Returns: phases (dict) – Dictionary containing the time intervals (in ms) for all four phases (bursting’, `quiescent’, `mixed’, and `localized) as lists. E.g: phases["bursting"]
could give[[123.5,334.2], [857.1,1000.6]]
.
-
nngt.simulation.
get_nest_network
(id_converter=None)[source]¶ Get the adjacency matrix describing a NEST network.
Parameters: id_converter (dict, optional (default: None)) – A dictionary which maps NEST gids to the desired neurons ids. Returns: mat_adj ( lil_matrix
) – Adjacency matrix of the network.
-
nngt.simulation.
make_nest_network
(network, use_weights=True)[source]¶ Create a new network which will be filled with neurons and connector objects to reproduce the topology from the initial network.
Parameters: - network (
nngt.Network
ornngt.SpatialNetwork
) – the network we want to reproduce in NEST. - use_weights (bool, optional (default: True)) – Whether to use the network weights or default ones (value: 10.).
Returns: gids (tuple (nodes in NEST)) – GIDs of the neurons in the network.
- network (
-
nngt.simulation.
monitor_groups
(group_names, network, nest_recorder=None, params=None)[source]¶ Monitoring the activity of nodes in the network.
Parameters: - group_name (list of strings) – Names of the groups that should be recorded.
- network (
Network
or subclass) – Network which population will be used to differentiate groups. - nest_recorder (strings or list, optional (default: “spike_detector”0)) – Device(s) to monitor the network.
- params (dict or list of, optional (default: {})) – Dictionarie(s) containing the parameters for each recorder (see NEST documentation for details).
Returns: - recorders (tuple) – Tuple of the recorders’ gids
- recordables (tuple) – Typle of the recordables’ names.
-
nngt.simulation.
monitor_nodes
(gids, nest_recorder=None, params=None, network=None)[source]¶ Monitoring the activity of nodes in the network.
Parameters: - gids (tuple of ints or list of tuples) – GIDs of the neurons in the NEST subnetwork; either one list per recorder if they should monitor different neurons or a unique list which will be monitored by all devices.
- nest_recorder (strings or list, optional (default: “spike_detector”)) – Device(s) to monitor the network.
- params (dict or list of, optional (default: {})) – Dictionarie(s) containing the parameters for each recorder (see NEST documentation for details).
- network (
Network
or subclass, optional (default: None)) – Network which population will be used to differentiate groups.
Returns: - recorders (tuple) – Tuple of the recorders’ gids
- recordables (tuple) – Typle of the recordables’ names.
-
nngt.simulation.
set_noise
(gids, mean, std)[source]¶ Submit neurons to a current white noise. @todo: check how NEST handles the \(\sqrt{t}\) in the standard dev.
Parameters: - gids (tuple) – NEST gids of the target neurons.
- mean (float) – Mean current value.
- std (float) – Standard deviation of the current
Returns: noise (tuple) – The NEST gid of the noise_generator.
-
nngt.simulation.
set_poisson_input
(gids, rate)[source]¶ Submit neurons to a Poissonian rate of spikes.
Parameters: - gids (tuple) – NEST gids of the target neurons.
- rate (float) – Rate of the spike train.
Returns: poisson_input (tuple) – The NEST gid of the poisson_generator.
-
nngt.simulation.
set_step_currents
(gids, times, currents)[source]¶ Set step-current excitations
Parameters: - gids (tuple) – NEST gids of the target neurons.
- times (list or
numpy.ndarray
) – List of the times where the current will change (by default the current generator is initiated at I=0. for t=0.) - currents (list or
numpy.ndarray
) – List of the new current value after the associated time value in times.
Returns: noise (tuple) – The NEST gid of the noise_generator.
-
nngt.simulation.
plot_activity
(gid_recorder=None, record=None, network=None, gids=None, show=True, limits=None, hist=True, title=None, fignum=None, label=None, sort=None, normalize=1.0, decimate=None)[source]¶ Plot the monitored activity.
Parameters: - gid_recorder (tuple or list, optional (default: None)) – The gids of the recording devices. If None, then all existing “spike_detector”s are used.
- record (tuple or list, optional (default: None)) – List of the monitored variables for each device. If gid_recorder is None, record can also be None and only spikes are considered.
- network (
Network
or subclass, optional (default: None)) – Network which activity will be monitored. - gids (tuple, optional (default: None)) – NEST gids of the neurons which should be monitored.
- show (bool, optional (default: True)) – Whether to show the plot right away or to wait for the next plt.show().
- hist (bool, optional (default: True)) – Whether to display the histogram when plotting spikes rasters.
- limits (tuple, optional (default: None)) – Time limits of the plot (if not specified, times of first and last spike for raster plots).
- title (str, optional (default: None)) – Title of the plot.
- fignum (int, optional (default: None)) – Plot the activity on an existing figure (from
figure.number
). - label (str, optional (default: None)) – Add a label to the plot.
- sort (str or list, optional (default: None)) – Sort neurons using a topological property (“in-degree”, “out-degree”, “total-degree” or “betweenness”), an activity-related property (“firing_rate”) or a user-defined list of sorted neuron ids. Sorting is performed by increasing value of the sort property from bottom to top inside each group.
- normalize (float, optional (default: None)) – Normalize the recorded results by a given float.
- decimate (int or list of ints, optional (default: None)) – Represent only a fraction of the spiking neurons; only one neuron in decimate will be represented (e.g. setting decimate to 5 will lead to only 20% of the neurons being represented). If a list is provided, it must have one entry per NeuralGroup in the population.
Warning
Sorting with “firing_rate” only works if NEST gids form a continuous integer range.
Returns: fignums (list) – List of the figure numbers.
-
nngt.simulation.
raster_plot
(times, senders, limits=None, title='Spike raster', hist=False, num_bins=1000, color='b', decimate=None, fignum=None, label=None, show=True, sort=None, sort_attribute=None)[source]¶ Plotting routine that constructs a raster plot along with an optional histogram.
Parameters: - times (list or
numpy.ndarray
) – Spike times. - senders (list or
numpy.ndarray
) – Index for the spiking neuron for each time in times. - limits (tuple, optional (default: None)) – Time limits of the plot (if not specified, times of first and last spike).
- title (string, optional (default: ‘Spike raster’)) – Title of the raster plot.
- hist (bool, optional (default: True)) – Whether to plot the raster’s histogram.
- num_bins (int, optional (default: 1000)) – Number of bins for the histogram.
- color (string or float, optional (default: ‘b’)) – Color of the plot lines and markers.
- decimate (int, optional (default: None)) – Represent only a fraction of the spiking neurons; only one neuron in decimate will be represented (e.g. setting decimate to 10 will lead to only 10% of the neurons being represented).
- fignum (int, optional (default: None)) – Id of another raster plot to which the new data should be added.
- label (str, optional (default: None)) – Label the current data.
- show (bool, optional (default: True)) – Whether to show the plot right away or to wait for the next plt.show().
Returns: fig.number (int) – Id of the
matplotlib.Figure
on which the raster is plotted.- times (list or