Simulation module

Module to interact easily with the NEST simulator. It allows to :

  • build a NEST network from Network or SpatialNetwork objects,
  • monitor the activity of the network (taking neural groups into account)
  • plot the activity while separating the behaviours of predefined neural groups

Content

Functions
make_nest_network Create a network in NEST from a Graph object
get_nest_network Create a Graph object from a NEST network
nngt.simulation.make_nest_network(network, use_weights=True)[source]

Create a new subnetwork which will be filled with neurons and connector objects to reproduce the topology from the initial network.

Parameters:
  • network (nngt.Network or nngt.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:

  • subnet (tuple (node in NEST)) – GID of the new NEST subnetwork
  • gids (tuple (nodes in NEST)) – GIDs of the neurons in subnet

nngt.simulation.get_nest_network(nest_subnet, id_converter=None)[source]

Get the adjacency matrix describing a NEST subnetwork.

Parameters:
  • nest_subnet (tuple) – Subnetwork node in NEST.
  • 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.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
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.
nngt.simulation.monitor_nodes(gids, nest_recorder=['spike_detector'], record=[['spikes']], accumulator=True, interval=1.0, to_file='', 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 (list of strings, optional (default: [“spike_detector”])) – List of devices to monitor the network.
  • record (list of lists of strings, optional (default: ([“spikes”],))) – List of the variables to record; one list per recording device.
  • accumulator (bool, optional (default: True)) – Whether multi/volt/conductancemeters should sum the records of all the nodes they are conencted to.
  • interval (float, optional (default: 1.)) – Interval of time at which multimeter-like devices sample data.
  • to_file (string, optional (default: “”)) – File where the recorded data should be stored; if “”, the data will not be saved in a file.
Returns:

recorders (tuple) – Tuple of the recorders’ gids

nngt.simulation.plot_activity(gid_recorder, record, network=None, gids=None, show=True)[source]

Plot the monitored activity.

Parameters:
  • gid_recorder (tuple or list) – The gids of the recording devices.
  • record (tuple or list) – List of the monitored variables for each device.
  • 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().