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 to run() it is possible to retrieve data and modify neuron/synapse parameters. Some backends allow modification of the network structure. run(x + y) is equivalent to run(x) followed by run(y). If you wish to reset the simulation state to the initial conditions (time t = 0), use the reset() 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() and run() may be combined freely. See the documentation of the run() function for further information.

reset(annotations={})

Reset the time to zero, neuron membrane potentials and synaptic weights to their initial values, and delete any recorded data. The network structure is not changed, nor is the specification of which neurons to record from.

end(compatible_output=True)[source]

Do any necessary cleaning up before exiting.

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:
  1. single values
  2. RandomDistribution objects
  3. 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:
  1. single numeric values (all neurons set to the same value)
  2. RandomDistribution objects
  3. lists/arrays of numbers of the same size as the population
  4. 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.