nest.lib package¶
Submodules¶
nest.lib.hl_api_connections module¶
Functions for connection handling
-
nest.lib.hl_api_connections.
CGConnect
(pre, post, cg, parameter_map=None, model='static_synapse')[source]¶ Connect neurons using the Connection Generator Interface.
Potential pre-synaptic neurons are taken from pre, potential post-synaptic neurons are taken from post. The connection generator cg specifies the exact connectivity to be set up. The parameter_map can either be None or a dictionary that maps the keys “weight” and “delay” to their integer indices in the value set of the connection generator.
This function is only available if NEST was compiled with support for libneurosim.
For further information, see * The NEST documentation on using the CG Interface at
- The GitHub repository and documentation for libneurosim at https://github.com/INCF/libneurosim/
- The publication about the Connection Generator Interface at https://doi.org/10.3389/fninf.2014.00043
- pre : list or numpy.array
- must contain a list of GIDs
- post : list or numpy.array
- must contain a list of GIDs
- cg : connection generator
- libneurosim connection generator to use
- parameter_map : dict, optional
- Maps names of values such as weight and delay to value set positions
- model : str, optional
- Synapse model to use
kernel.NESTError
-
nest.lib.hl_api_connections.
CGParse
(xml_filename)[source]¶ Parse an XML file and return the corresponding connection generator cg.
The library to provide the parsing can be selected by CGSelectImplementation().
- xml_filename : str
- Filename of the xml file to parse.
kernel.NESTError
-
nest.lib.hl_api_connections.
CGSelectImplementation
(tag, library)[source]¶ Select a library to provide a parser for XML files and associate an XML tag with the library.
XML files can be read by CGParse().
- tag : str
- XML tag to associate with the library
- library : str
- Library to use to parse XML files
kernel.NESTError
-
nest.lib.hl_api_connections.
Connect
(pre, post, conn_spec=None, syn_spec=None, model=None)[source]¶ Connect pre nodes to post nodes.
Nodes in pre and post are connected using the specified connectivity (all-to-all by default) and synapse type (static_synapse by default). Details depend on the connectivity rule.
- pre : list
- Presynaptic nodes, as list of GIDs
- post : list
- Postsynaptic nodes, as list of GIDs
- conn_spec : str or dict, optional
- Specifies connectivity rule, see below
- syn_spec : str or dict, optional
- Specifies synapse model, see below
- model : str or dict, optional
- alias for syn_spec for backward compatibility
kernel.NESTError
Connect does not iterate over subnets, it only connects explicitly specified nodes.
Connectivity is specified either as a string containing the name of a connectivity rule (default: ‘all_to_all’) or as a dictionary specifying the rule and any mandatory rule-specific parameters (e.g. ‘indegree’).
In addition, switches setting permission for establishing self-connections (‘autapses’, default: True) and multiple connections between a pair of nodes (‘multapses’, default: True) can be contained in the dictionary. Another switch enables the creation of symmetric connections (‘symmetric’, default: False) by also creating connections in the opposite direction.
- ‘all_to_all’ (default)
- ‘one_to_one’
- ‘fixed_indegree’, ‘indegree’
- ‘fixed_outdegree’, ‘outdegree’
- ‘fixed_total_number’, ‘N’
- ‘pairwise_bernoulli’, ‘p’
- ‘one_to_one’
- {‘rule’: ‘fixed_indegree’, ‘indegree’: 2500, ‘autapses’: False}
- {‘rule’: ‘pairwise_bernoulli’, ‘p’: 0.1}
The synapse model and its properties can be given either as a string identifying a specific synapse model (default: ‘static_synapse’) or as a dictionary specifying the synapse model and its parameters.
Available keys in the synapse specification dictionary are: - ‘model’ - ‘weight’ - ‘delay’ - ‘receptor_type’ - any parameters specific to the selected synapse model.
All parameters are optional and if not specified, the default values of the synapse model will be used. The key ‘model’ identifies the synapse model, this can be one of NEST’s built-in synapse models or a user-defined model created via CopyModel().
If ‘model’ is not specified the default model ‘static_synapse’ will be used.
All other parameters can be scalars, arrays or distributions. In the case of scalar parameters, all keys must be doubles except for ‘receptor_type’ which must be initialised with an integer.
Parameter arrays are available for the rules ‘one_to_one’, ‘all_to_all’, ‘fixed_indegree’ and ‘fixed_outdegree’: - For ‘one_to_one’ the array has to be a one-dimensional
NumPy array with length len(pre).- For ‘all_to_all’ the array has to be a two-dimensional NumPy array with shape (len(post), len(pre)), therefore the rows describe the target and the columns the source neurons.
- For ‘fixed_indegree’ the array has to be a two-dimensional NumPy array with shape (len(post), indegree), where indegree is the number of incoming connections per target neuron, therefore the rows describe the target and the columns the connections converging to the target neuron, regardless of the identity of the source neurons.
- For ‘fixed_outdegree’ the array has to be a two-dimensional NumPy array with shape (len(pre), outdegree), where outdegree is the number of outgoing connections per source neuron, therefore the rows describe the source and the columns the connections starting from the source neuron regardless of the identity of the target neuron.
Any distributed parameter must be initialised with a further dictionary specifying the distribution type (‘distribution’, e.g. ‘normal’) and any distribution-specific parameters (e.g. ‘mu’ and ‘sigma’).
To see all available distributions, run: nest.slirun(‘rdevdict info’)
To get information on a particular distribution, e.g. ‘binomial’, run: nest.help(‘rdevdict::binomial’)
- ‘normal’ with ‘mu’, ‘sigma’
- ‘normal_clipped’ with ‘mu’, ‘sigma’, ‘low’, ‘high’
- ‘lognormal’ with ‘mu’, ‘sigma’
- ‘lognormal_clipped’ with ‘mu’, ‘sigma’, ‘low’, ‘high’
- ‘uniform’ with ‘low’, ‘high’
- ‘uniform_int’ with ‘low’, ‘high’
‘stdp_synapse’
{‘weight’: 2.4, ‘receptor_type’: 1}
- {‘model’: ‘stdp_synapse’,
‘weight’: 2.5, ‘delay’: {‘distribution’: ‘uniform’, ‘low’: 0.8, ‘high’: 2.5}, ‘alpha’: {
‘distribution’: ‘normal_clipped’, ‘low’: 0.5, ‘mu’: 5.0, ‘sigma’: 1.0}
}
-
nest.lib.hl_api_connections.
DataConnect
(pre, params=None, model='static_synapse')[source]¶ Connect neurons from lists of connection data.
- pre : list
- Presynaptic nodes, given as lists of GIDs or lists of synapse status dictionaries. See below.
- params : list, optional
- See below
- model : str, optional
- Synapse model to use, see below
TypeError
Connect each neuron in pre to the targets given in params, using synapse type model.
- pre: [gid_1, … gid_n]
- params: [ {param_1}, …, {param_n} ]
- model= ‘synapse_model’
The dictionaries param_1 to param_n must contain at least the following keys: - ‘target’ - ‘weight’ - ‘delay’ Each key must resolve to a list or numpy.ndarray of values.
Depending on the synapse model, other parameters can be given in the same format. All arrays in params must have the same length as ‘target’.
Connect neurons according to a list of synapse status dictionaries, as obtained from GetStatus.
pre = [ {synapse_state1}, …, {synapse_state_n}] params=None model=None
During connection, status dictionary misses will not raise errors, even if the kernel property ‘dict_miss_is_error’ is True.
-
nest.lib.hl_api_connections.
Disconnect
(pre, post, conn_spec, syn_spec)[source]¶ Disconnect pre neurons from post neurons.
Neurons in pre and post are disconnected using the specified disconnection rule (one-to-one by default) and synapse type (static_synapse by default). Details depend on the disconnection rule.
- pre : list
- Presynaptic nodes, given as list of GIDs
- post : list
- Postsynaptic nodes, given as list of GIDs
- conn_spec : str or dict
- Disconnection rule, see below
- syn_spec : str or dict
- Synapse specifications, see below
Apply the same rules as for connectivity specs in the Connect method
Possible choices of the conn_spec are - ‘one_to_one’ - ‘all_to_all’
The synapse model and its properties can be inserted either as a string describing one synapse model (synapse models are listed in the synapsedict) or as a dictionary as described below.
If no synapse model is specified the default model ‘static_synapse’ will be used.
Available keys in the synapse dictionary are: - ‘model’ - ‘weight’ - ‘delay’, - ‘receptor_type’ - parameters specific to the synapse model chosen
All parameters are optional and if not specified will use the default values determined by the current synapse model.
‘model’ determines the synapse type, taken from pre-defined synapse types in NEST or manually specified synapses created via CopyModel().
All other parameters are not currently implemented. Note: model is alias for syn_spec for backward compatibility.
Disconnect does not iterate over subnets, it only connects explicitly specified nodes.
-
nest.lib.hl_api_connections.
DisconnectOneToOne
(source, target, syn_spec)[source]¶ Disconnect a currently existing synapse.
- source : int
- GID of presynaptic node
- target : int
- GID of postsynaptic node
- syn_spec : str or dict
- See Connect() for definition
-
nest.lib.hl_api_connections.
GetConnections
(source=None, target=None, synapse_model=None, synapse_label=None)[source]¶ Return an array of connection identifiers.
Any combination of source, target, synapse_model and synapse_label parameters is permitted.
- source : list, optional
- Source GIDs, only connections from these pre-synaptic neurons are returned
- target : list, optional
- Target GIDs, only connections to these post-synaptic neurons are returned
- synapse_model : str, optional
- Only connections with this synapse type are returned
- synapse_label : int, optional
- (non-negative) only connections with this synapse label are returned
- array:
- Connections as 5-tuples with entries (source-gid, target-gid, target-thread, synapse-id, port)
Only connections with targets on the MPI process executing the command are returned.
TypeError
-
nest.lib.hl_api_connections.
pcd
()¶
-
nest.lib.hl_api_connections.
spp
()¶
-
nest.lib.hl_api_connections.
sps
()¶
nest.lib.hl_api_helper module¶
These are helper functions to ease the definition of the high-level API of the PyNEST wrapper.
-
class
nest.lib.hl_api_helper.
SuppressedDeprecationWarning
(no_dep_funcs)[source]¶ Bases:
object
Context manager turning off deprecation warnings for given methods.
Think thoroughly before use. This context should only be used as a way to make sure examples do not display deprecation warnings, that is, used in functions called from examples, and not as a way to make tedious deprecation warnings dissapear.
-
nest.lib.hl_api_helper.
broadcast
(item, length, allowed_types, name='item')[source]¶ Broadcast item to given length.
- item : object
- Object to broadcast
- length : int
- Length to broadcast to
- allowed_types : list
- List of allowed types
- name : str, optional
- Name of item
- object:
- The original item broadcasted to sequence form of length
TypeError
-
nest.lib.hl_api_helper.
check_stack
(thing)[source]¶ Convenience wrapper for applying the stack_checker decorator to all class methods of the given class, or to a given function.
If the object cannot be decorated, it is returned unchanged.
- thing : function or class
- Description
- function or class
- Decorated function or class
ValueError
-
nest.lib.hl_api_helper.
deprecated
(alt_func_name, text=None)[source]¶ Decorator for deprecated functions.
Shows a warning and calls the original function.
- alt_func_name : str, optional
- Name of the function to use instead
- text : str, optional
- Text to display instead of standard text
- function:
- Decorator function
-
nest.lib.hl_api_helper.
get_debug
()[source]¶ Return the current value of the debug flag of the high-level API.
- bool:
- current value of the debug flag
-
nest.lib.hl_api_helper.
get_help_filepath
(hlpobj)[source]¶ Get file path of help object
Prints message if no help is available for hlpobj.
- hlpobj : string
- Object to display help for
- string:
- Filepath of the help object or None if no help available
-
nest.lib.hl_api_helper.
get_unistring_type
()[source]¶ Returns string type dependent on python version.
- str or basestring:
- Depending on Python version
-
nest.lib.hl_api_helper.
get_verbosity
()[source]¶ Return verbosity level of NEST’s messages.
- int:
- The current verbosity level
-
nest.lib.hl_api_helper.
get_wrapped_text
(text, width=80)[source]¶ Formats a given multiline string to wrap at a given width, while preserving newlines (and removing excessive whitespace).
- text : str
- String to format
- str:
- Wrapped string
-
nest.lib.hl_api_helper.
is_coercible_to_sli_array
(seq)[source]¶ Checks whether a given object is coercible to a SLI array
- seq : object
- Object to check
- bool:
- True if object is coercible to a SLI array
-
nest.lib.hl_api_helper.
is_iterable
(seq)[source]¶ Return True if the given object is an iterable, False otherwise.
- seq : object
- Object to check
- bool:
- True if object is an iterable
-
nest.lib.hl_api_helper.
is_literal
(obj)[source]¶ Check whether obj is a “literal”: a unicode string or SLI literal
- obj : object
- Object to check
- bool:
- True if obj is a “literal”
-
nest.lib.hl_api_helper.
is_sequence_of_connections
(seq)[source]¶ Checks whether low-level API accepts seq as a sequence of connections.
- seq : object
- Object to check
- bool:
- True if object is an iterable of dictionaries or subscriptables of CONN_LEN
-
nest.lib.hl_api_helper.
is_sequence_of_gids
(seq)[source]¶ Checks whether the argument is a potentially valid sequence of GIDs (non-negative integers).
- seq : object
- Object to check
- bool:
- True if object is a potentially valid sequence of GIDs
-
nest.lib.hl_api_helper.
is_string
(obj)[source]¶ Check whether obj is a unicode string
- obj : object
- Object to check
- bool:
- True if obj is a unicode string
-
nest.lib.hl_api_helper.
load_help
(hlpobj)[source]¶ Returns documentation of the object
- hlpobj : object
- Object to display help for
- string:
- The documentation of the object or None if no help available
-
nest.lib.hl_api_helper.
model_deprecation_warning
(model)[source]¶ Checks whether the model is to be removed in a future verstion of NEST. If so, a deprecation warning is issued.
- model: str
- Name of model
-
nest.lib.hl_api_helper.
pcd
()¶
-
nest.lib.hl_api_helper.
set_debug
(dbg=True)[source]¶ Set the debug flag of the high-level API.
- dbg : bool, optional
- Value to set the debug flag to
-
nest.lib.hl_api_helper.
set_verbosity
(level)[source]¶ Change verbosity level for NEST’s messages.
- level : str
- Can be one of ‘M_FATAL’, ‘M_ERROR’, ‘M_WARNING’, ‘M_DEPRECATED’, ‘M_INFO’ or ‘M_ALL’.
-
nest.lib.hl_api_helper.
show_deprecation_warning
(func_name, alt_func_name=None, text=None)[source]¶ Shows a deprecation warning for a function.
- func_name : str
- Name of the deprecated function
- alt_func_name : str, optional
- Name of the function to use instead
- text : str, optional
- Text to display instead of standard text
-
nest.lib.hl_api_helper.
show_help_with_pager
(hlpobj, pager=None)[source]¶ Output of doc in python with pager or print
- hlpobj : object
- Object to display
- pager: str, optional
- pager to use, False if you want to display help using print().
-
nest.lib.hl_api_helper.
spp
()¶
-
nest.lib.hl_api_helper.
sps
()¶
-
nest.lib.hl_api_helper.
stack_checker
(f)[source]¶ Decorator to add stack checks to functions using PyNEST’s low-level API.
This decorator works only on functions. See check_stack() for the generic version for functions and classes.
- f : function
- Function to decorate
- function:
- Decorated function
kernel.NESTError
nest.lib.hl_api_info module¶
Functions to get information on NEST.
-
nest.lib.hl_api_info.
GetStatus
(nodes, keys=None)[source]¶ Return the parameter dictionaries of nodes or connections.
If keys is given, a list of values is returned instead. keys may also be a list, in which case the returned list contains lists of values.
- nodes : list or tuple
- Either a list of global ids of nodes, or a tuple of connection handles as returned by GetConnections()
- keys : str or list, optional
- String or a list of strings naming model properties. GetDefaults then returns a single value or a list of values belonging to the keys given.
- dict:
- All parameters
- type:
- If keys is a string, the corrsponding default parameter is returned
- list:
- If keys is a list of strings, a list of corrsponding default parameters is returned
- TypeError
- Description
-
nest.lib.hl_api_info.
SetStatus
(nodes, params, val=None)[source]¶ Set the parameters of nodes or connections to params.
If val is given, params has to be the name of an attribute, which is set to val on the nodes/connections. val can be a single value or a list of the same size as nodes.
- nodes : list or tuple
- Either a list of global ids of nodes, or a tuple of connection handles as returned by GetConnections()
- params : str or dict or list
- Dictionary of parameters or list of dictionaries of parameters of same length as nodes. If val is given, this has to be the name of a model property as a str.
- val : str, optional
- If given, params has to be the name of a model property.
- TypeError
- Description
Print the authors of NEST.
-
nest.lib.hl_api_info.
get_argv
()[source]¶ Return argv as seen by NEST.
This is similar to Python sys.argv but might have changed after MPI initialization.
- tuple:
- Argv, as seen by NEST.
-
nest.lib.hl_api_info.
help
(obj=None, pager=None, return_text=False)[source]¶ Show the help page for the given object using the given pager.
The default pager is more.
- obj : object, optional
- Object to display help for
- pager : str, optional
- Pager to use
- return_text : bool, optional
- Option for returning the help text
-
nest.lib.hl_api_info.
helpdesk
()[source]¶ Open the NEST helpdesk in browser.
Use the system default browser.
-
nest.lib.hl_api_info.
message
(level, sender, text)[source]¶ Print a message using NEST’s message system.
- level :
- Level
- sender :
- Message sender
- text : str
- Text to be sent in the message
-
nest.lib.hl_api_info.
pcd
()¶
-
nest.lib.hl_api_info.
spp
()¶
-
nest.lib.hl_api_info.
sps
()¶
nest.lib.hl_api_models module¶
Functions for model handling
-
nest.lib.hl_api_models.
ConnectionRules
()[source]¶ Return a typle of all available connection rules, sorted by name.
- tuple:
- Available connection rules
-
nest.lib.hl_api_models.
CopyModel
(existing, new, params=None)[source]¶ Create a new model by copying an existing one.
- existing : str
- Name of existing model
- new : str
- Name of the copy of the existing model
- params : dict, optional
- Default parameters assigned to the copy. Not provided parameters are taken from the existing model.
-
nest.lib.hl_api_models.
GetDefaults
(model, keys=None)[source]¶ Return a dictionary with the default parameters of the given model, specified by a string.
- model : str
- Name of the model
- keys : str or list, optional
- String or a list of strings naming model properties. GetDefaults then returns a single value or a list of values belonging to the keys given.
- dict:
- All default parameters
- type:
- If keys is a string, the corrsponding default parameter is returned
- list:
- If keys is a list of strings, a list of corrsponding default parameters is returned
TypeError
GetDefaults(‘iaf_psc_alpha’,’V_m’) -> -70.0 GetDefaults(‘iaf_psc_alpha’,[‘V_m’, ‘model’]) -> [-70.0, ‘iaf_psc_alpha’]
-
nest.lib.hl_api_models.
Models
(mtype='all', sel=None)[source]¶ Return a tuple of all available model (neurons, devices and synapses) names, sorted by name.
- mtype : str, optional
- Use mtype=’nodes’ to only see neuron and device models, or mtype=’synapses’ to only see synapse models.
- sel : str, optional
- String used to filter the result list and only return models containing it.
- tuple:
- Available model names
- Synapse model names ending with ‘_hpc’ provide minimal memory requirements by using thread-local target neuron IDs and fixing the rport to 0.
- Synapse model names ending with ‘_lbl’ allow to assign an individual integer label (synapse_label) to created synapses at the cost of increased memory requirements.
- ValueError
- Description
-
nest.lib.hl_api_models.
SetDefaults
(model, params, val=None)[source]¶ Set the default parameters of the given model to the values specified in the params dictionary.
New default values are used for all subsequently created instances of the model.
- model : str
- Name of the model
- params : str or dict
- Dictionary of new default values. If val is given, this has to be the name of a model property as a str.
- val : str, optional
- If given, params has to be the name of a model property.
-
nest.lib.hl_api_models.
pcd
()¶
-
nest.lib.hl_api_models.
spp
()¶
-
nest.lib.hl_api_models.
sps
()¶
nest.lib.hl_api_nodes module¶
Functions for node handling
-
nest.lib.hl_api_nodes.
Create
(model, n=1, params=None)[source]¶ Create n instances of type model.
- model : str
- Name of the model to create
- n : int, optional
- Number of instances to create
- params : TYPE, optional
- Parameters for the new nodes. A single dictionary or a list of dictionaries with size n. If omitted, the model’s defaults are used.
- list:
- Global IDs of created nodes
-
nest.lib.hl_api_nodes.
GetLID
(gid)[source]¶ Return the local id of a node with the global ID gid.
- gid : int
- Global id of node
- int:
- Local id of node
NESTError
-
nest.lib.hl_api_nodes.
pcd
()¶
-
nest.lib.hl_api_nodes.
spp
()¶
-
nest.lib.hl_api_nodes.
sps
()¶
nest.lib.hl_api_parallel_computing module¶
Functions for parallel computing
-
nest.lib.hl_api_parallel_computing.
NumProcesses
()[source]¶ Return the overall number of MPI processes.
- int:
- Number of overall MPI processes
-
nest.lib.hl_api_parallel_computing.
Rank
()[source]¶ Return the MPI rank of the local process.
- int:
- MPI rank of the local process
DO NOT USE Rank() TO EXECUTE ANY FUNCTION IMPORTED FROM THE nest MODULE ON A SUBSET OF RANKS IN AN MPI-PARALLEL SIMULATION.
This will lead to unpredictable behavior. Symptoms may be an error message about non-synchronous global random number generators or deadlocks during simulation. In the worst case, the simulation may complete but generate nonsensical results.
-
nest.lib.hl_api_parallel_computing.
SetAcceptableLatency
(port_name, latency)[source]¶ Set the acceptable latency (in ms) for a MUSIC port.
- port_name : str
- MUSIC port to set latency for
- latency : float
- Latency in ms
-
nest.lib.hl_api_parallel_computing.
SetMaxBuffered
(port_name, size)[source]¶ Set the maximum buffer size for a MUSIC port.
- port_name : str
- MUSIC port to set buffer size for
- size : int
- Buffer size
-
nest.lib.hl_api_parallel_computing.
pcd
()¶
-
nest.lib.hl_api_parallel_computing.
spp
()¶
-
nest.lib.hl_api_parallel_computing.
sps
()¶
nest.lib.hl_api_simulation module¶
Functions for simulation control
-
nest.lib.hl_api_simulation.
Cleanup
()[source]¶ Cleans up resources after a Run call. Not needed for Simulate.
See Run(t), Prepare(). 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().
-
nest.lib.hl_api_simulation.
DisableStructuralPlasticity
()[source]¶ Disable structural plasticity for the network simulation
-
nest.lib.hl_api_simulation.
EnableStructuralPlasticity
()[source]¶ Enable structural plasticity for the network simulation
-
nest.lib.hl_api_simulation.
GetKernelStatus
(keys=None)[source]¶ Obtain parameters of the simulation kernel.
- keys : str or list, optional
- Single parameter name or list of parameter names
- 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
-
nest.lib.hl_api_simulation.
GetStructuralPlasticityStatus
(keys=None)[source]¶ Get the current structural plasticity parameters for the network simulation.
- keys : str or list, optional
- Keys indicating the values of interest to be retrieved by the get call
-
nest.lib.hl_api_simulation.
Install
(module_name)[source]¶ Load a dynamically linked NEST module.
- module_name : str
- Name of the dynamically linked module
NEST module identifier, required for unloading.
nest.Install(“mymodule”)
Dynamically linked modules are searched in the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH under OSX).
-
nest.lib.hl_api_simulation.
Prepare
()[source]¶ Prepares network before a Run call. Not needed for Simulate.
See Run(t), Cleanup(). Call before any sequence of Runs(). Do all set_status calls before Prepare().
-
nest.lib.hl_api_simulation.
ResetKernel
()[source]¶ 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.
-
nest.lib.hl_api_simulation.
ResetNetwork
()[source]¶ Reset all nodes and connections to their original state.
-
nest.lib.hl_api_simulation.
Run
(t)[source]¶ Simulate the network for t milliseconds.
- t : float
- Time to simulate in ms
Call between Prepare and Cleanup calls, or within an with RunManager: clause Simulate(t): t’ = t/m; Prepare(); for _ in range(m): Run(t’); Cleanup() Prepare() must be called before to calibrate, etc; Cleanup() afterward to close files, cleanup handles and so on. After Cleanup(), Prepare() can and must be called before more Run() calls. Any calls to set_status between Prepare() and Cleanup() have undefined behavior.
-
nest.lib.hl_api_simulation.
RunManager
()[source]¶ ContextManager for Run.
Calls Prepare() before a series of Run() calls, and adds a Cleanup() at end.
So: with RunManager():
- for i in range(10):
- Run()
-
nest.lib.hl_api_simulation.
SetKernelStatus
(params)[source]¶ Set parameters for the simulation kernel.
- params : dict
- Dictionary of parameters to set.
GetKernelStatus
-
nest.lib.hl_api_simulation.
SetStructuralPlasticityStatus
(params)[source]¶ Set structural plasticity parameters for the network simulation.
- params : dict
- Dictionary of structural plasticity parameters to set
-
nest.lib.hl_api_simulation.
Simulate
(t)[source]¶ Simulate the network for t milliseconds.
- t : float
- Time to simulate in ms
-
nest.lib.hl_api_simulation.
pcd
()¶
-
nest.lib.hl_api_simulation.
spp
()¶
-
nest.lib.hl_api_simulation.
sps
()¶
nest.lib.hl_api_subnets module¶
Functions for hierarchical networks
-
nest.lib.hl_api_subnets.
BeginSubnet
(label=None, params=None)[source]¶ Create a new subnet and change into it.
- label : str, optional
- Name of the new subnet
- params : dict, optional
- The customdict of the new subnet
-
nest.lib.hl_api_subnets.
ChangeSubnet
(subnet)[source]¶ Make given subnet the current.
- subnet : int
- GID of the subnet
NESTError
-
nest.lib.hl_api_subnets.
CurrentSubnet
()[source]¶ Returns the global id of the current subnet.
- int:
- GID of current subnet
-
nest.lib.hl_api_subnets.
EndSubnet
()[source]¶ Change to the parent subnet and return the gid of the current.
- NESTError
- Description
-
nest.lib.hl_api_subnets.
GetChildren
(subnets, properties=None, local_only=False)[source]¶ Return the global ids of the immediate children of the given subnets.
- subnets : list
- GIDs of subnets
- properties : dict, optional
- Only global ids of nodes matching the properties given in the dictionary exactly will be returned. Matching properties with float values (e.g. the membrane potential) may fail due to tiny numerical discrepancies and should be avoided.
- local_only : bool, optional
- If True, only GIDs of nodes simulated on the local MPI process will be returned. By default, global ids of nodes in the entire simulation will be returned. This requires MPI communication and may slow down the script.
- list:
- GIDs of leaf nodes
GetLeaves GetNodes
-
nest.lib.hl_api_subnets.
GetLeaves
(subnets, properties=None, local_only=False)[source]¶ Return the GIDs of the leaf nodes of the given subnets.
Leaf nodes are all nodes that are not subnets.
- subnets : list
- GIDs of subnets
- properties : dict, optional
- Only global ids of nodes matching the properties given in the dictionary exactly will be returned. Matching properties with float values (e.g. the membrane potential) may fail due to tiny numerical discrepancies and should be avoided.
- local_only : bool, optional
- If True, only GIDs of nodes simulated on the local MPI process will be returned. By default, global ids of nodes in the entire simulation will be returned. This requires MPI communication and may slow down the script.
- list:
- GIDs of leaf nodes
GetNodes GetChildren
-
nest.lib.hl_api_subnets.
GetNetwork
(gid, depth)[source]¶ Return a nested list with the children of subnet id at level depth.
- gid : int
- GID of subnet
- depth : int
- Depth of list to return. If depth==0, the immediate children of the subnet are returned. The returned list is depth+1 dimensional.
- list:
- nested lists of GIDs of child nodes
NESTError
-
nest.lib.hl_api_subnets.
GetNodes
(subnets, properties=None, local_only=False)[source]¶ Return the global ids of the all nodes of the given subnets.
- subnets : list
- GIDs of subnets
- properties : dict, optional
- Only global ids of nodes matching the properties given in the dictionary exactly will be returned. Matching properties with float values (e.g. the membrane potential) may fail due to tiny numerical discrepancies and should be avoided.
- local_only : bool, optional
- If True, only GIDs of nodes simulated on the local MPI process will be returned. By default, global ids of nodes in the entire simulation will be returned. This requires MPI communication and may slow down the script.
- list:
- GIDs of leaf nodes
GetLeaves GetChildren
-
nest.lib.hl_api_subnets.
LayoutNetwork
(model, dim, label=None, params=None)[source]¶ Create a subnetwork of dimension dim with nodes of type model and return a list of ids.
params is a dictionary, which will be set as customdict of the newly created subnet.
- model : str
- Neuron model to use
- dim : int
- Dimension of subnetwork
- label : str, optional
- Name of the new subnet
- params : dict, optional
- The customdict of the new subnet. Not the parameters for the neurons in the subnetwork.
- ValueError
- Description
-
nest.lib.hl_api_subnets.
PrintNetwork
(depth=1, subnet=None)[source]¶ Print the network tree up to depth, starting at subnet.
If subnet is omitted, the current subnet is used instead.
- depth : int, optional
- Depth to print to
- subnet : TYPE, optional
- Subnet to start at
NESTError
-
nest.lib.hl_api_subnets.
pcd
()¶
-
nest.lib.hl_api_subnets.
spp
()¶
-
nest.lib.hl_api_subnets.
sps
()¶