Node module

Functions for node handling

nest.lib.hl_api_nodes.Create(model, n=1, params=None, positions=None)

Create one or more nodes.

Generates n new network objects of the supplied model type. If n is not given, a single node is created. Note that if setting parameters of the nodes fail, the nodes will still have been created.


During network construction, create all nodes representing model neurons first, then all nodes representing devices (generators, recorders, or detectors), or all devices first and then all neurons. Otherwise, network connection can be slow, especially in parallel simulations of networks with many devices.

  • model (str) – Name of the model to create

  • n (int, optional) – Number of nodes to create

  • params (dict or list, optional) –

    Parameters for the new nodes. Can be any of the following:

    • A dictionary with either single values or lists of size n. The single values will be applied to all nodes, while the lists will be distributed across the nodes. Both single values and lists can be given at the same time.

    • A list with n dictionaries, one dictionary for each node.

    Values may be Parameter objects. If omitted, the model’s defaults are used.

  • positions (grid or free object, optional) – Object describing spatial positions of the nodes. If omitted, the nodes have no spatial attachment.


Object representing the IDs of created nodes, see NodeCollection for more.

Return type:


  • NESTError – If setting node parameters fail. However, the nodes will still have been created.

  • TypeError – If the positions object is of wrong type.


Get local nodes of a NodeCollection as a new NodeCollection.

This function returns the local nodes of a NodeCollection. If there are no local elements, an empty NodeCollection is returned.


nc (NodeCollection) – NodeCollection for which to get local nodes


Object representing the local nodes of the given NodeCollection

Return type:


nest.lib.hl_api_nodes.GetNodes(properties={}, local_only=False)

Return all nodes with the given properties as NodeCollection.

  • properties (dict, optional) – Only node 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. Note that when a params dict is present, thread parallelization is not possible, the function will be run thread serial.

  • local_only (bool, optional) – If True, only node IDs of nodes simulated on the local MPI process will be returned. By default, node IDs of nodes in the entire simulation will be returned. This requires MPI communication and may slow down the script.


NodeCollection of nodes

Return type:



Print the node ID ranges and model names of all the nodes in the network.