Connection module

Functions for connection handling

nest.lib.hl_api_connections.Connect(pre, post, conn_spec=None, syn_spec=None, return_synapsecollection=False)

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.

Lists of synapse models and connection rules are available as nest.synapse_models and nest.connection_rules, respectively.

Parameters:
  • pre (NodeCollection (or array-like object)) – Presynaptic nodes, as object representing the IDs of the nodes

  • post (NodeCollection (or array-like object)) – Postsynaptic nodes, as object representing the IDs of the nodes

  • conn_spec (str or dict, optional) – Specifies connectivity rule, see below

  • syn_spec (str or dict, optional) – Specifies synapse model, see below

  • return_synapsecollection (bool) – Specifies whether or not we should return a SynapseCollection of pre and post connections

Raises:

kernel.NESTError

Notes

It is possible to connect NumPy arrays of node IDs one-to-one by passing the arrays as pre and post, specifying ‘one_to_one’ for conn_spec. In that case, the arrays may contain non-unique IDs. You may also specify weight, delay, and receptor type for each connection as NumPy arrays in the syn_spec dictionary. This feature is currently not available when MPI is used; trying to connect arrays with more than one MPI process will raise an error.

If pre and post have spatial positions, a mask can be specified as a dictionary. The mask define which nodes are considered as potential targets for each source node. Connections with spatial nodes can also use nest.spatial_distributions as parameters, for instance for the probability p.

Connectivity specification (conn_spec)

Available rules and associated parameters:

- 'all_to_all' (default)
- 'one_to_one'
- 'fixed_indegree', 'indegree'
- 'fixed_outdegree', 'outdegree'
- 'fixed_total_number', 'N'
- 'pairwise_bernoulli', 'p'
- 'symmetric_pairwise_bernoulli', 'p'

See Connection Rules for more details, including example usage.

Synapse specification (syn_spec)

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:

- 'synapse_model'
- 'weight'
- 'delay'
- 'receptor_type'
- any parameters specific to the selected synapse model.

See Synapse Specification for details, including example usage.

All parameters are optional and if not specified, the default values of the synapse model will be used. The key ‘synapse_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 synapse_model is not specified the default model static_synapse will be used.

Distributed parameters can be defined through NEST’s different parametertypes. NEST has various random parameters, spatial parameters and distributions (only accessible for nodes with spatial positions), logical expressions and mathematical expressions, which can be used to define node and connection parameters.

To see all available parameters, see documentation defined in distributions, logic, math, random and spatial modules.

nest.lib.hl_api_connections.Disconnect(*args, conn_spec=None, syn_spec=None)

Disconnect connections in a SynapseCollection, or pre neurons from post neurons.

When specifying pre and post nodes, they 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.

Parameters:
  • args (SynapseCollection or NodeCollections) – Either a collection of connections to disconnect, or pre- and postsynaptic nodes given as `NodeCollection`s

  • conn_spec (str or dict) – Disconnection rule when specifying pre- and postsynaptic nodes, see below

  • syn_spec (str or dict) – Synapse specifications when specifying pre- and postsynaptic nodes, see below

Notes

conn_spec

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'

syn_spec

The synapse model and its properties can be specified either as a string naming a synapse model (the list of all available synapse models can be gotten via nest.synapse_models) or as a dictionary as described below.

Note that only the synapse type is checked when we disconnect and that if syn_spec is given as a non-empty dictionary, the ‘synapse_model’ parameter must be present.

If no synapse model is specified the default model static_synapse will be used.

Available keys in the synapse dictionary are:

- 'synapse_model'
- 'weight'
- 'delay',
- 'receptor_type'
- parameters specific to the synapse model chosen

‘synapse_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.

Notes

Disconnect only disconnects explicitly specified nodes.

nest.lib.hl_api_connections.GetConnections(source=None, target=None, synapse_model=None, synapse_label=None)

Return a SynapseCollection representing the connection identifiers.

Any combination of source, target, synapse_model and synapse_label parameters is permitted.

Parameters:
  • source (NodeCollection, optional) – Source node IDs, only connections from these pre-synaptic neurons are returned

  • target (NodeCollection, optional) – Target node IDs, only connections to these postsynaptic 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

Returns:

Object representing the source-node_id, target-node_id, target-thread, synapse-id, port of connections, see SynapseCollection for more.

Return type:

SynapseCollection

Raises:

TypeError

Notes

Only connections with targets on the MPI process executing the command are returned.