Side classes#

The following side classes are used to structure graphs into groups that can then be used to generate specific connectivity patterns via the connect_groups() function or to assign specific properties to neuronal assemblies to use them in simulations with NEST.

nngt.Group([nodes, properties, name])

Class defining groups of nodes.

nngt.MetaGroup([nodes, properties, name])

Class defining a meta-group of nodes.

nngt.MetaNeuralGroup([nodes, neuron_type, ...])

Class defining a meta-group of neurons.

nngt.NeuralGroup([nodes, neuron_type, ...])

Class defining groups of neurons.

nngt.NeuralPop([size, parent, meta_groups, ...])

The basic class that contains groups of neurons and their properties.

nngt.Structure([size, parent, meta_groups])

The basic class that contains groups of nodes and their properties.

Summary of the classes#

A summary of the methods provided by these classes as well as more detailed descriptions are provided below. Unless specified, child classes can use all methods from the parent class (MetaGroup, NeuralGroup, and MetaNeuralGroup inherit from Group while NeuralPop inherits from Structure).

Group#

nngt.Group([nodes, properties, name])

Class defining groups of nodes.

nngt.Group.add_nodes(nodes)

Add nodes to the group.

nngt.Group.copy()

Return a deep copy of the group.

nngt.Group.ids

Ids of the nodes belonging to the group.

nngt.Group.is_metagroup

Whether the group is a meta-group.

nngt.Group.is_valid

i.e.

nngt.Group.name

The name of the group.

nngt.Group.parent

Return the parent Structure of the group

nngt.Group.properties

Properties associated to the nodes in the group.

nngt.Group.size

The (desired) number of nodes in the group.

NeuralGroup#

nngt.NeuralGroup([nodes, neuron_type, ...])

Class defining groups of neurons.

nngt.NeuralGroup.has_model

Whether this group have been given a model for the simulation.

nngt.NeuralGroup.nest_gids

Global ids associated to the neurons in the NEST simulator.

nngt.NeuralGroup.neuron_model

Model that will be used to simulate the neurons of this group.

nngt.NeuralGroup.neuron_param

Parameters associated to the group's neurons.

nngt.NeuralGroup.neuron_type

Type of the neurons in the group (excitatory or inhibitory).

Structure#

nngt.Structure([size, parent, meta_groups])

The basic class that contains groups of nodes and their properties.

nngt.Structure.add_meta_group(group[, name, ...])

Add an existing meta group to the structure.

nngt.Structure.add_to_group(group_name, ids)

Add nodes to a specific group.

nngt.Structure.copy()

Return a deep copy of the structure.

nngt.Structure.create_group(nodes, name[, ...])

Create a new group in the structure.

nngt.Structure.create_meta_group(nodes, name)

Create a new meta group and add it to the structure.

nngt.Structure.from_groups(groups[, names, ...])

Make a Structure object from a (list of) Group object(s).

nngt.Structure.get_group(nodes[, numbers])

Return the group of the nodes.

nngt.Structure.get_properties([key, groups, ...])

Return the properties of nodes or groups of nodes in the structure.

nngt.Structure.ids

Return all the ids of the nodes inside the structure.

nngt.Structure.is_valid

Whether the structure is consistent with the associated network.

nngt.Structure.meta_groups

nngt.Structure.parent

Parent Network, if it exists, otherwise None.

nngt.Structure.set_properties(props[, ...])

Set the parameters of specific nodes or of a whole group.

nngt.Structure.size

Number of nodes in this structure.

NeuralPop#

nngt.NeuralPop([size, parent, meta_groups, ...])

The basic class that contains groups of neurons and their properties.

nngt.NeuralPop.exc_and_inhib(size[, iratio, ...])

Make a NeuralPop with a given ratio of inhibitory and excitatory neurons.

nngt.NeuralPop.excitatory

Return the ids of all excitatory nodes inside the population.

nngt.NeuralPop.from_network(graph, *args)

Make a NeuralPop object from a network.

nngt.NeuralPop.get_param([groups, neurons, ...])

Return the element (neuron or synapse) parameters for neurons or groups of neurons in the population.

nngt.NeuralPop.has_models

Whether all groups have been assigned a neuronal model.

nngt.NeuralPop.inhibitory

Return the ids of all inhibitory nodes inside the population.

nngt.NeuralPop.nest_gids

Return the NEST gids of the nodes inside the population.

nngt.NeuralPop.set_model(model[, group])

Set the groups' models.

nngt.NeuralPop.set_neuron_param(params[, ...])

Set the parameters of specific neurons or of a whole group.

nngt.NeuralPop.syn_spec

The properties of the synaptic connections between groups.

nngt.NeuralPop.uniform(size[, neuron_type, ...])

Make a NeuralPop of identical neurons belonging to a single "default" group.

Details#

class nngt.Group(nodes=None, properties=None, name=None, **kwargs)[source]#

Class defining groups of nodes.

Its main variables are:

Variables:
  • ~nngt.Group.idslist of int the ids of the nodes in this group.

  • ~nngt.Group.properties – dict, optional (default: {}) properties associated to the nodes

  • ~nngt.Group.is_metagroupbool whether the group is a meta-group or not.

Note

A Group contains a set of nodes that are unique; the size of the group is the number of unique nodes contained in the group. Passing non-unique nodes will automatically convert them to a unique set.

Warning

Equality between Group`s only compares the  size and ``properties` attributes. This means that groups differing only by their ids will register as equal.

Calling the class creates a group of nodes. The default is an empty group but it is not a valid object for most use cases.

Parameters:
  • nodes (int or array-like, optional (default: None)) – Desired size of the group or, a posteriori, NNGT indices of the nodes in an existing graph.

  • properties (dict, optional (default: {})) – Dictionary containing the properties associated to the nodes.

Returns:

A new Group instance.

add_nodes(nodes)[source]#

Add nodes to the group.

Parameters:

nodes (list of ids)

copy()[source]#

Return a deep copy of the group.

property ids#

Ids of the nodes belonging to the group.

property is_metagroup#

Whether the group is a meta-group.

property is_valid#

i.e. if it has either a size or some ids associated to it.

Type:

Whether the group can be used in a structure

property name#

The name of the group.

property parent#

Return the parent Structure of the group

property properties#

Properties associated to the nodes in the group.

property size#

The (desired) number of nodes in the group.

class nngt.MetaGroup(nodes=None, properties=None, name=None, **kwargs)[source]#

Class defining a meta-group of nodes.

Its main variables are:

Variables:

~nngt.MetaGroup.idslist of int the ids of the nodes in this group.

Calling the class creates a group of nodes. The default is an empty group but it is not a valid object for most use cases.

Parameters:
  • nodes (int or array-like, optional (default: None)) – Desired size of the group or, a posteriori, NNGT indices of the nodes in an existing graph.

  • name (str, optional (default: “Group N”)) – Name of the meta-group.

Returns:

A new MetaGroup object.

class nngt.MetaNeuralGroup(nodes=None, neuron_type='undefined', neuron_model=None, neuron_param=None, name=None, **kwargs)[source]#

Class defining a meta-group of neurons.

Its main variables are:

Variables:
  • ~nngt.MetaGroup.idslist of int the ids of the neurons in this group.

  • ~nngt.MetaGroup.is_metagroupbool whether the group is a meta-group or not (neuron_type is None for meta-groups)

Calling the class creates a group of neurons. The default is an empty group but it is not a valid object for most use cases.

Parameters:
  • nodes (int or array-like, optional (default: None)) – Desired size of the group or, a posteriori, NNGT indices of the neurons in an existing graph.

  • name (str, optional (default: “Group N”)) – Name of the meta-group.

Returns:

A new MetaNeuralGroup object.

property excitatory#

Return the ids of all excitatory nodes inside the meta-group.

property inhibitory#

Return the ids of all inhibitory nodes inside the meta-group.

property properties#

Properties associated to the nodes in the group.

class nngt.NeuralGroup(nodes=None, neuron_type='undefined', neuron_model=None, neuron_param=None, name=None, **kwargs)[source]#

Class defining groups of neurons.

Its main variables are:

Variables:
  • ~nngt.NeuralGroup.idslist of int the ids of the neurons in this group.

  • ~nngt.NeuralGroup.neuron_typeint the default is 1 for excitatory neurons; -1 is for inhibitory neurons; meta-groups must have neuron_type set to None

  • ~nngt.NeuralGroup.neuron_model – str, optional (default: None) the name of the model to use when simulating the activity of this group

  • ~nngt.NeuralGroup.neuron_param – dict, optional (default: {}) the parameters to use (if they differ from the model’s defaults)

  • ~nngt.NeuralGroup.is_metagroupbool whether the group is a meta-group or not (neuron_type is None for meta-groups)

Warning

Equality between NeuralGroup`s only compares the  size and neuronal type, ``model` and param attributes. This means that groups differing only by their ids will register as equal.

Calling the class creates a group of neurons. The default is an empty group but it is not a valid object for most use cases.

Parameters:
  • nodes (int or array-like, optional (default: None)) – Desired size of the group or, a posteriori, NNGT indices of the neurons in an existing graph.

  • neuron_type (int, optional (default: 1)) – Type of the neurons (1 for excitatory, -1 for inhibitory) or None if not relevant (only allowed for metag roups).

  • neuron_model (str, optional (default: None)) – NEST model for the neuron.

  • neuron_param (dict, optional (default: model defaults)) – Dictionary containing the parameters associated to the NEST model.

Returns:

A new NeuralGroup instance.

copy()[source]#

Return a deep copy of the group.

property has_model#

Whether this group have been given a model for the simulation.

property ids#

Ids of the nodes belonging to the group.

property nest_gids#

Global ids associated to the neurons in the NEST simulator.

property neuron_model#

Model that will be used to simulate the neurons of this group.

property neuron_param#

Parameters associated to the group’s neurons.

property neuron_type#

Type of the neurons in the group (excitatory or inhibitory).

property properties#

Properties of the neurons in this group, including neuron_type, neuron_model and neuron_params.

class nngt.NeuralPop(size=None, parent=None, meta_groups=None, with_models=True, **kwargs)[source]#

The basic class that contains groups of neurons and their properties.

Variables:
  • has_modelsbool, True if every group has a model attribute.

  • ~nngt.NeuralPop.sizeint, Returns the number of neurons in the population.

  • syn_specdict, Dictionary containing informations about the synapses between the different groups in the population.

  • ~nngt.NeuralPop.is_validbool, Whether this population can be used to create a network in NEST.

Initialize NeuralPop instance.

Parameters:
  • size (int, optional (default: 0)) – Number of neurons that the population will contain.

  • parent (Network, optional (default: None)) – Network associated to this population.

  • meta_groups (dict of str/NeuralGroup items) – Optional set of groups. Contrary to the primary groups which define the population and must be disjoint, meta groups can overlap: a neuron can belong to several different meta groups.

  • with_models (bool) – whether the population’s groups contain models to use in NEST

  • *args (items for OrderedDict parent)

  • **kwargs (dict)

Returns:

pop (NeuralPop object.)

add_to_group(group_name, ids)[source]#

Add neurons to a specific group.

Parameters:
  • group_name (str or int) – Name or index of the group.

  • ids (list or 1D-array) – Neuron ids.

copy()[source]#

Return a deep copy of the population.

create_group(neurons, name, neuron_type=1, neuron_model=None, neuron_param=None, replace=False)[source]#

Create a new group in the population.

Parameters:
  • neurons (int or array-like) – Desired number of neurons or list of the neurons indices.

  • name (str) – Name of the group.

  • neuron_type (int, optional (default: 1)) – Type of the neurons : 1 for excitatory, -1 for inhibitory.

  • neuron_model (str, optional (default: None)) – Name of a neuron model in NEST.

  • neuron_param (dict, optional (default: None)) – Parameters for neuron_model in the NEST simulator. If None, default parameters will be used.

  • replace (bool, optional (default: False)) – Whether to override previous exiting meta group with same name.

create_meta_group(neurons, name, neuron_param=None, replace=False)[source]#

Create a new meta group and add it to the population.

Parameters:
  • neurons (int or array-like) – Desired number of neurons or list of the neurons indices.

  • name (str) – Name of the group.

  • neuron_type (int, optional (default: 1)) – Type of the neurons : 1 for excitatory, -1 for inhibitory.

  • neuron_model (str, optional (default: None)) – Name of a neuron model in NEST.

  • neuron_param (dict, optional (default: None)) – Parameters for neuron_model in the NEST simulator. If None, default parameters will be used.

  • replace (bool, optional (default: False)) – Whether to override previous exiting meta group with same name.

classmethod exc_and_inhib(size, iratio=0.2, en_model='aeif_cond_alpha', en_param=None, in_model='aeif_cond_alpha', in_param=None, syn_spec=None, parent=None, meta_groups=None)[source]#

Make a NeuralPop with a given ratio of inhibitory and excitatory neurons.

Parameters:
  • size (int) – Number of neurons contained by the population.

  • iratio (float, optional (default: 0.2)) – Fraction of the neurons that will be inhibitory.

  • en_model (str, optional (default: default_neuron)) – Name of the NEST model that will be used to describe excitatory neurons.

  • en_param (dict, optional (default: default NEST parameters)) – Parameters of the excitatory neuron model.

  • in_model (str, optional (default: default_neuron)) – Name of the NEST model that will be used to describe inhibitory neurons.

  • in_param (dict, optional (default: default NEST parameters)) – Parameters of the inhibitory neuron model.

  • syn_spec (dict, optional (default: static synapse)) – Dictionary containg a directed edge between groups as key and the associated synaptic parameters for the post-synaptic neurons (i.e. those of the second group) as value. If provided, all connections between groups will be set according to the values contained in syn_spec. Valid keys are:

    • (‘excitatory’, ‘excitatory’)

    • (‘excitatory’, ‘inhibitory’)

    • (‘inhibitory’, ‘excitatory’)

    • (‘inhibitory’, ‘inhibitory’)

  • parent (Network, optional (default: None)) – Network associated to this population.

  • meta_groups (list dict of str/NeuralGroup items) – Additional set of groups which can overlap: a neuron can belong to several different meta groups. Contrary to the primary ‘excitatory’ and ‘inhibitory’ groups, meta groups are therefore no necessarily disjoint. If all meta-groups have a name, they can be passed directly through a list; otherwise a dict is necessary.

See also

nest.Connect(), as

property excitatory#

Return the ids of all excitatory nodes inside the population.

classmethod from_groups(groups, names=None, syn_spec=None, parent=None, meta_groups=None, with_models=True)[source]#

Make a NeuralPop object from a (list of) NeuralGroup object(s).

Parameters:
  • groups (list of NeuralGroup objects) – Groups that will be used to form the population. Note that a given neuron can only belong to a single group, so the groups should form pairwise disjoints complementary sets.

  • names (list of str, optional (default: None)) – Names that can be used as keys to retreive a specific group. If not provided, keys will be the group name (if not empty) or the position of the group in groups, stored as a string. In the latter case, the first group in a population named pop will be retreived by either pop[0] or pop[‘0’].

  • parent (Graph, optional (default: None)) – Parent if the population is created from an exiting graph.

  • syn_spec (dict, optional (default: static synapse)) – Dictionary containg a directed edge between groups as key and the associated synaptic parameters for the post-synaptic neurons (i.e. those of the second group) as value. If a ‘default’ entry is provided, all unspecified connections will be set to its value.

  • meta_groups (list or dict of str/NeuralGroup items) – Additional set of groups which can overlap: a neuron can belong to several different meta groups. Contrary to the primary groups, meta groups do therefore no need to be disjoint. If all meta-groups have a name, they can be passed directly through a list; otherwise a dict is necessary.

  • with_model (bool, optional (default: True)) – Whether the groups require models (set to False to use populations for graph theoretical purposes, without NEST interaction)

Example

For synaptic properties, if provided in syn_spec, all connections between groups will be set according to the values. Keys can be either group names or types (1 for excitatory, -1 for inhibitory). Because of this, several combination can be available for the connections between two groups. Because of this, priority is given to source (presynaptic properties), i.e. NNGT will look for the entry matching the first group name as source before looking for entries matching the second group name as target.

# we created groups `g1`, `g2`, and `g3`
prop = {
    ('g1', 'g2'): {'model': 'tsodyks2_synapse', 'tau_fac': 50.},
    ('g1', g3'): {'weight': 100.},
    ...
}
pop = NeuronalPop.from_groups(
    [g1, g2, g3], names=['g1', 'g2', 'g3'], syn_spec=prop)

Note

If the population is not generated from an existing Graph and the groups do not contain explicit ids, then the ids will be generated upon population creation: the first group, of size N0, will be associated the indices 0 to N0 - 1, the second group (size N1), will get N0 to N0 + N1 - 1, etc.

classmethod from_network(graph, *args)[source]#

Make a NeuralPop object from a network. The groups of neurons are determined using instructions from an arbitrary number of GroupProperties.

get_param(groups=None, neurons=None, element='neuron')[source]#

Return the element (neuron or synapse) parameters for neurons or groups of neurons in the population.

Parameters:
  • groups (str, int or array-like, optional (default: None)) – Names or numbers of the groups for which the neural properties should be returned.

  • neurons (int or array-like, optional (default: None)) – IDs of the neurons for which parameters should be returned.

  • element (list of str, optional (default: "neuron")) – Element for which the parameters should be returned (either "neuron" or "synapse").

Returns:

param (list) – List of all dictionaries with the elements’ parameters.

property has_models#

Whether all groups have been assigned a neuronal model.

property inhibitory#

Return the ids of all inhibitory nodes inside the population.

property nest_gids#

Return the NEST gids of the nodes inside the population.

set_model(model, group=None)[source]#

Set the groups’ models.

Parameters:
  • model (dict) – Dictionary containing the model type as key (“neuron” or “synapse”) and the model name as value (e.g. {“neuron”: “iaf_neuron”}).

  • group (list of strings, optional (default: None)) – List of strings containing the names of the groups which models should be updated.

Note

By default, synapses are registered as “static_synapse”s in NEST; because of this, only the neuron_model attribute is checked by the has_models function: it will answer True if all groups have a ‘non-None’ neuron_model attribute.

Warning

No check is performed on the validity of the models, which means that errors will only be detected when building the graph in NEST.

set_neuron_param(params, neurons=None, group=None)[source]#

Set the parameters of specific neurons or of a whole group.

New in version 1.0.

Parameters:
  • params (dict) – Dictionary containing parameters for the neurons. Entries can be either a single number (same for all neurons) or a list (one entry per neuron).

  • neurons (list of ints, optional (default: None)) – Ids of the neurons whose parameters should be modified.

  • group (list of strings, optional (default: None)) – List of strings containing the names of the groups whose parameters should be updated. When modifying neurons from a single group, it is still usefull to specify the group name to speed up the pace.

Note

If both neurons and group are None, all neurons will be modified.

Warning

No check is performed on the validity of the parameters, which means that errors will only be detected when building the graph in NEST.

property syn_spec#

The properties of the synaptic connections between groups. Returns a dict containing tuples as keys and dicts of parameters as values.

The keys are tuples containing the names of the groups in the population, with the projecting group first (presynaptic neurons) and the receiving group last (post-synaptic neurons).

Example

For a population of excitatory (“exc”) and inhibitory (“inh”) neurons.

syn_spec = {
    ("exc", "exc"): {'model': 'stdp_synapse', 'weight': 2.5},
    ("exc", "inh"): {'model': 'static_synapse'},
    ("exc", "inh"): {'model': 'stdp_synapse', 'delay': 5.},
    ("inh", "inh"): {
        'model': 'stdp_synapse', 'weight': 5.,
        'delay': ('normal', 5., 2.)}
    }
}
classmethod uniform(size, neuron_type=1, neuron_model='aeif_cond_alpha', neuron_param=None, syn_model='static_synapse', syn_param=None, parent=None, meta_groups=None)[source]#

Make a NeuralPop of identical neurons belonging to a single “default” group.

Parameters:
  • size (int) – Number of neurons in the population.

  • neuron_type (int, optional (default: 1)) – Type of the neurons in the population: 1 for excitatory or -1 for inhibitory.

  • neuron_model (str, optional (default: default neuron model)) – Neuronal model for the simulator.

  • neuron_param (dict, optional (default: default neuron parameters)) – Parameters associated to neuron_model.

  • syn_model (str, optional (default: default static synapse)) – Synapse model for the simulator.

  • syn_param (dict, optional (default: default synaptic parameters)) – Parameters associated to syn_model.

  • parent (Graph object, optional (default: None)) – Parent graph described by the population.

  • meta_groups (list or dict of str/NeuralGroup items) – Set of groups which can overlap: a neuron can belong to several different meta groups, i.e. they do no need to be disjoint. If all meta-groups have a name, they can be passed directly through a list; otherwise a dict is necessary.

class nngt.Structure(size=None, parent=None, meta_groups=None, **kwargs)[source]#

The basic class that contains groups of nodes and their properties.

Variables:
  • ~nngt.Structure.idslst, Returns the ids of nodes in the structure.

  • ~nngt.Structure.is_validbool, Whether the structure is consistent with its associated network.

  • ~nngt.Structure.parentNetwork, Parent network.

  • ~nngt.Structure.sizeint, Returns the number of nodes in the structure.

Initialize Structure instance.

Parameters:
  • size (int, optional (default: 0)) – Number of nodes that the structure will contain.

  • parent (Network, optional (default: None)) – Network associated to this structure.

  • meta_groups (dict of str/Group items) – Optional set of groups. Contrary to the primary groups which define the structure and must be disjoint, meta groups can overlap: a neuron can belong to several different meta groups.

  • **kwargs (dict)

Returns:

struct (Structure object.)

add_meta_group(group, name=None, replace=False)[source]#

Add an existing meta group to the structure.

Parameters:
  • group (Group) – Meta group.

  • name (str, optional (default: group name)) – Name of the meta group.

  • replace (bool, optional (default: False)) – Whether to override previous exiting meta group with same name.

Note

The name of the group is automatically updated to match the name argument.

add_to_group(group_name, ids)[source]#

Add nodes to a specific group.

Parameters:
  • group_name (str or int) – Name or index of the group.

  • ids (list or 1D-array) – Node ids.

copy()[source]#

Return a deep copy of the structure.

create_group(nodes, name, properties=None, replace=False)[source]#

Create a new group in the structure.

Parameters:
  • nodes (int or array-like) – Desired number of nodes or list of the nodes indices.

  • name (str) – Name of the group.

  • properties (dict, optional (default: None)) – Properties associated to the nodes in this group.

  • replace (bool, optional (default: False)) – Whether to override previous exiting meta group with same name.

create_meta_group(nodes, name, properties=None, replace=False)[source]#

Create a new meta group and add it to the structure.

Parameters:
  • nodes (int or array-like) – Desired number of nodes or list of the nodes indices.

  • name (str) – Name of the group.

  • properties (dict, optional (default: None)) – Properties associated to the nodes in this group.

  • replace (bool, optional (default: False)) – Whether to override previous exiting meta group with same name.

classmethod from_groups(groups, names=None, parent=None, meta_groups=None)[source]#

Make a Structure object from a (list of) Group object(s).

Parameters:
  • groups (dict or list of Group objects) – Groups that will be used to form the structure. Note that a given node can only belong to a single group, so the groups should form pairwise disjoints complementary sets.

  • names (list of str, optional (default: None)) – Names that can be used as keys to retreive a specific group. If not provided, keys will be the group name (if not empty) or the position of the group in groups, stored as a string. In the latter case, the first group in a structure named struct will be retreived by either struct[0] or struct[‘0’].

  • parent (Graph, optional (default: None)) – Parent if the structure is created from an exiting graph.

  • meta_groups (list or dict of str/Group items) – Additional set of groups which can overlap: a node can belong to several different meta groups. Contrary to the primary groups, meta groups do therefore no need to be disjoint. If all meta-groups have a name, they can be passed directly through a list; otherwise a dict is necessary.

Example

For synaptic properties, if provided in syn_spec, all connections between groups will be set according to the values. Keys can be either group names or types (1 for excitatory, -1 for inhibitory). Because of this, several combination can be available for the connections between two groups. Because of this, priority is given to source (presynaptic properties), i.e. NNGT will look for the entry matching the first group name as source before looking for entries matching the second group name as target.

# we already created groups `g1`, `g2`, and `g3`
struct = Structure.from_groups([g1, g2, g3],
                               names=['g1', 'g2', 'g3'])

Note

If the structure is not generated from an existing Graph and the groups do not contain explicit ids, then the ids will be generated upon structure creation: the first group, of size N0, will be associated the indices 0 to N0 - 1, the second group (size N1), will get N0 to N0 + N1 - 1, etc.

get_group(nodes, numbers=False)[source]#

Return the group of the nodes.

Parameters:
  • nodes (int or array-like) – IDs of the nodes for which the group should be returned.

  • numbers (bool, optional (default: False)) – Whether the group identifier should be returned as a number; if False, the group names are returned.

get_properties(key=None, groups=None, nodes=None)[source]#

Return the properties of nodes or groups of nodes in the structure.

Parameters:
  • groups (str, int or array-like, optional (default: None)) – Names or numbers of the groups for which the neural properties should be returned.

  • nodes (int or array-like, optional (default: None)) – IDs of the nodes for which parameters should be returned.

Returns:

props (list) – List of all dictionaries with properties.

property ids#

Return all the ids of the nodes inside the structure.

property is_valid#

Whether the structure is consistent with the associated network.

property parent#

Parent Network, if it exists, otherwise None.

set_properties(props, nodes=None, group=None)[source]#

Set the parameters of specific nodes or of a whole group.

New in version 2.2.

Parameters:
  • props (dict) – Dictionary containing parameters for the nodes. Entries can be either a single number (same for all nodes) or a list (one entry per nodes).

  • nodes (list of ints, optional (default: None)) – Ids of the nodes whose parameters should be modified.

  • group (list of strings, optional (default: None)) – List of strings containing the names of the groups whose parameters should be updated. When modifying nodes from a single group, it is still usefull to specify the group name to speed up the pace.

Note

If both nodes and group are None, all nodes will be modified.

property size#

Number of nodes in this structure.