Simulation control¶
-
setup
(timestep=0.1, min_delay='auto', **extra_params)[source]¶ Should be called at the very beginning of a script.
extra_params contains any keyword arguments that are required by a given simulator but not by others.
NEURON specific extra_params:
- use_cvode - use the NEURON cvode solver. Defaults to False.
Optional cvode Parameters: -> rtol - specify relative error tolerance -> atol - specify absolute error tolerance
native_rng_baseseed - added to MPI.rank to form seed for SpikeSourcePoisson, etc. default_maxstep - TODO
returns: MPI rank
-
run
(simtime, callbacks=None)¶ Advance the simulation by simtime ms.
callbacks is an optional list of callables, each of which should accept the current time as an argument, and return the next time it wishes to be called.
run()
may be called multiple times during a simulation. In between calls torun()
it is possible to retrieve data and modify neuron/synapse parameters. Some backends allow modification of the network structure.run(x + y)
is equivalent torun(x)
followed byrun(y)
. If you wish to reset the simulation state to the initial conditions (timet = 0
), use thereset()
function.
-
run_until
(time_point, callbacks=None)¶ Advance the simulation until time_point (in ms).
callbacks is an optional list of callables, each of which should accept the current time as an argument, and return the next time it wishes to be called.
run_until()
andrun()
may be combined freely. See the documentation of therun()
function for further information.
-
reset
(annotations={})¶ Reset the time to zero, neuron membrane potentials and synaptic weights to their initial values, and begin a new Segment for recorded data. The network structure is not changed, nor are neuron/synapse parameters, nor the specification of which neurons to record from.
-
get_time_step
()¶ Return the integration time step (in milliseconds).
-
get_current_time
()¶ Return the current time in the simulation (in milliseconds).
-
get_min_delay
()¶ Return the minimum allowed synaptic delay (in milliseconds).
-
get_max_delay
()¶ Return the maximum allowed synaptic delay (in milliseconds).
-
num_processes
()¶ Return the number of MPI processes.
-
rank
()¶ Return the MPI rank of the current node.
-
set
(cells, **parameters)[source]¶ Set one or more parameters for every cell in a population, view or assembly.
- Values passed to set() may be:
single values
RandomDistribution objects
mapping functions, where a mapping function accepts a single argument (the cell index) and returns a single value.
Here, a “single value” may be either a single number or a list/array of numbers (e.g. for spike times). Values should be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
-
initialize
(cells, **initial_values)[source]¶ Set initial values of state variables, e.g. the membrane potential.
- Values passed to initialize() may be:
single numeric values (all neurons set to the same value)
RandomDistribution objects
lists/arrays of numbers of the same size as the population
mapping functions, where a mapping function accepts a single argument (the cell index) and returns a single number.
Values should be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
Examples:
initialize(cells, v=-70.0) initialize(cells, v=rand_distr, gsyn_exc=0.0) initialize(cells, v=lambda i: -65 + i/10.0)
-
record
(variables, source, filename, sampling_interval=None, annotations=None)¶ Record variables to a file. source can be an individual cell, a Population, PopulationView or Assembly.