Functions for simulation control
Cleans up resources after a Run calls.
Cleanup is automatically called by Simulate and RunManager.
Closes state for a series of runs, such as flushing and closing files. A Prepare is needed after a Cleanup before any more calls to Run.
Disable structural plasticity for the network simulation
Enable structural plasticity for the network simulation
Obtain parameters of the simulation kernel.
dict – Parameter dictionary, if called without argument
type – Single parameter value, if called with single parameter name
list – List of parameter values, if called with list of parameter names
TypeError – If keys are of the wrong type.
See SetKernelStatus for documentation on each parameter key.
Load a dynamically linked NEST module.
module_name (str) – Name of the dynamically linked module
NEST module identifier, required for unloading
- Return type:
Dynamically linked modules are searched in the NEST library directory (
<prefix>/lib/nest) and in
LD_LIBRARY_PATH(on Linux) or
Calibrate the system before a Run call.
Prepare is automatically called by Simulate and RunManager.
Call before the first Run call, or before calling Run after changing the system, calling SetStatus or Cleanup.
Reset the simulation kernel.
This will destroy the network as well as all custom models created with
CopyModel(). Calling this function is equivalent to restarting NEST.
all network nodes
all user-defined neuron and synapse models
are deleted, and
are reset. The only exception is that dynamically loaded modules are not unloaded. This may change in a future version of NEST.
Simulate the network for t milliseconds.
t (float) – Time to simulate in ms
Call between Prepare and Cleanup calls, or within a
with RunManagerclause. Run(t) is called once by each call to Simulate(t).
Prepare must be called before Run to calibrate the system, and Cleanup must be called after Run to close files, cleanup handles, and so on. After Cleanup, Prepare can and must be called before more Run calls.
Be careful about modifying the network or neurons between Prepare and Cleanup calls. In particular, do not call Create, Connect, or SetKernelStatus. Calling SetStatus to change membrane potential V_m of neurons or synaptic weights (but not delays!) will in most cases work as expected, while changing membrane or synaptic times constants will not work correctly. If in doubt, assume that changes may cause undefined behavior and check these thoroughly.
Also note that local_spike_counter is reset each time you call Run.
ContextManager for Run
Calls Prepare before a series of Run calls, and calls Cleanup at end.
with RunManager(): for _ in range(10): Run(100) # extract results
Be careful about modifying the network or neurons inside the RunManager context. In particular, do not call Create, Connect, or SetKernelStatus. Calling SetStatus to change membrane potential V_m of neurons or synaptic weights (but not delays!) will in most cases work as expected, while changing membrane or synaptic times constants will not work correctly. If in doubt, assume that changes may cause undefined behavior and check these thoroughly.
Set parameters for the simulation kernel.
See the documentation of sec:kernel_attributes for a valid list of params.
params (dict) – Dictionary of parameters to set.