Connectors¶
Base class¶
-
class
Connector(safe=True, callback=None)[source]¶ Base class for connectors.
- All connector sub-classes have the following optional keyword arguments:
- safe:
- if True, check that weights and delays have valid values. If False, this check is skipped.
- callback:
- a function that will be called with the fractional progress of the connection routine. An example would be progress_bar.set_level.
-
describe(template='connector_default.txt', engine='default')[source]¶ Returns a human-readable description of the connection method.
The output may be customized by specifying a different template togther with an associated template engine (see
pyNN.descriptions).If template is None, then a dictionary containing the template context will be returned.
Built-in connectors¶
-
class
AllToAllConnector(allow_self_connections=True, safe=True, callback=None)[source]¶ Connects all cells in the presynaptic population to all cells in the postsynaptic population.
Takes any of the standard
Connectoroptional arguments and, in addition:- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
-
class
OneToOneConnector(safe=True, callback=None)[source]¶ Where the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic population to cell i in the postsynaptic population for all i.
Takes any of the standard
Connectoroptional arguments.
-
class
FixedProbabilityConnector(p_connect, allow_self_connections=True, rng=None, safe=True, callback=None)[source]¶ For each pair of pre-post cells, the connection probability is constant.
Takes any of the standard
Connectoroptional arguments and, in addition:- p_connect:
- a float between zero and one. Each potential connection is created with this probability.
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- rng:
- an
RNGinstance used to evaluate whether connections exist
-
class
FromListConnector(conn_list, column_names=None, safe=True, callback=None)[source]¶ Make connections according to a list.
- Arguments:
- conn_list:
- a list of tuples, one tuple for each connection. Each tuple should contain: (pre_idx, post_idx, p1, p2, ..., pn) where pre_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, post_idx is the index of the postsynaptic neuron, and p1, p2, etc. are the synaptic parameters (e.g. weight, delay, plasticity parameters).
- column_names:
- the names of the parameters p1, p2, etc. If not provided, it is assumed the parameters are ‘weight’, ‘delay’ (for backwards compatibility).
- safe:
- if True, check that weights and delays have valid values. If False, this check is skipped.
- callback:
- if True, display a progress bar on the terminal.
-
class
FromFileConnector(file, distributed=False, safe=True, callback=None)[source]¶ Make connections according to a list read from a file.
- Arguments:
- file:
- either an open file object or the filename of a file containing a list of connections, in the format required by FromListConnector.
- distributed:
- if this is True, then each node will read connections from a file called filename.x, where x is the MPI rank. This speeds up loading connections for distributed simulations.
- safe:
- if True, check that weights and delays have valid values. If False, this check is skipped.
- callback:
- if True, display a progress bar on the terminal.
-
class
ArrayConnector(array, safe=True, callback=None)[source]¶ Provide an explicit boolean connection matrix, with shape (m, n) where m is the size of the presynaptic population and n that of the postsynaptic population.
-
class
FixedNumberPreConnector(n, allow_self_connections=True, with_replacement=False, rng=None, safe=True, callback=None)[source]¶ Each post-synaptic neuron is connected to exactly n pre-synaptic neurons chosen at random.
The sampling behaviour is controlled by the with_replacement argument.
“With replacement” means that each pre-synaptic neuron is chosen from the entire population. There is always therefore a possibility of multiple connections between a given pair of neurons.
“Without replacement” means that once a neuron has been selected, it cannot be selected again until the entire population has been selected. This means that if n is less than the size of the pre-synaptic population, there are no multiple connections. If n is greater than the size of the pre- synaptic population, all possible single connections are made before starting to add duplicate connections.
Takes any of the standard
Connectoroptional arguments and, in addition:- n:
- either a positive integer, or a RandomDistribution that produces positive integers. If n is a RandomDistribution, then the number of pre-synaptic neurons is drawn from this distribution for each post-synaptic neuron.
- with_replacement:
- if True, the selection of neurons to connect is made from the entire population. If False, once a neuron is selected it cannot be selected again until the entire population has been connected.
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- rng:
- an
RNGinstance used to evaluate which potential connections are created.
-
class
FixedNumberPostConnector(n, allow_self_connections=True, with_replacement=False, rng=None, safe=True, callback=None)[source]¶ Each pre-synaptic neuron is connected to exactly n post-synaptic neurons chosen at random.
The sampling behaviour is controlled by the with_replacement argument.
“With replacement” means that each post-synaptic neuron is chosen from the entire population. There is always therefore a possibility of multiple connections between a given pair of neurons.
“Without replacement” means that once a neuron has been selected, it cannot be selected again until the entire population has been selected. This means that if n is less than the size of the post-synaptic population, there are no multiple connections. If n is greater than the size of the post- synaptic population, all possible single connections are made before starting to add duplicate connections.
Takes any of the standard
Connectoroptional arguments and, in addition:- n:
- either a positive integer, or a RandomDistribution that produces positive integers. If n is a RandomDistribution, then the number of post-synaptic neurons is drawn from this distribution for each pre-synaptic neuron.
- with_replacement:
- if True, the selection of neurons to connect is made from the entire population. If False, once a neuron is selected it cannot be selected again until the entire population has been connected.
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- rng:
- an
RNGinstance used to evaluate which potential connections are created.
-
class
FixedTotalNumberConnector(n, allow_self_connections=True, with_replacement=True, rng=None, safe=True, callback=None)[source]¶
-
class
DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, rng=None, safe=True, callback=None)[source]¶ For each pair of pre-post cells, the connection probability depends on distance.
Takes any of the standard
Connectoroptional arguments and, in addition:- d_expression:
- the right-hand side of a valid Python expression for probability, involving ‘d’, e.g. “exp(-abs(d))”, or “d<3”
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- rng:
- an
RNGinstance used to evaluate whether connections exist
-
class
IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None)[source]¶ For each pair of pre-post cells, the connection probability depends on an arbitrary functions that takes the indices of the pre and post populations.
Takes any of the standard
Connectoroptional arguments and, in addition:- index_expression:
- a function that takes the two cell indices as inputs and calculates the probability matrix from it.
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- rng:
- an
RNGinstance used to evaluate whether connections exist
-
class
DisplacementDependentProbabilityConnector(disp_function, allow_self_connections=True, rng=None, safe=True, callback=None)[source]¶
-
class
SmallWorldConnector(degree, rewiring, allow_self_connections=True, n_connections=None, rng=None, safe=True, callback=None)[source]¶ Connect cells so as to create a small-world network.
Takes any of the standard
Connectoroptional arguments and, in addition:- degree:
- the region length where nodes will be connected locally.
- rewiring:
- the probability of rewiring each edge.
- allow_self_connections:
- if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
- n_connections:
- if specified, the number of efferent synaptic connections per neuron.
- rng:
- an
RNGinstance used to evaluate which connections are created.