spynnaker8.models.connectors package

Module contents

Connectors are objects that describe how neurons in Populations are connected to each other.

class spynnaker8.models.connectors.AllToAllConnector(allow_self_connections=True, safe=True, verbose=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.all_to_all_connector.AllToAllConnector, pyNN.connectors.AllToAllConnector

Connects all cells in the presynaptic population to all cells in the postsynaptic population

Parameters:
  • allow_self_connections (bool) – 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.
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.ArrayConnector(array, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.array_connector.ArrayConnector

Make connections using an array of integers based on the IDs of the neurons in the pre- and post-populations.

Parameters:
  • array (ndarray(2, uint8)) – an array of integers
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
class spynnaker8.models.connectors.CSAConnector(cset, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.csa_connector.CSAConnector

A CSA (Connection Set Algebra, Djurfeldt 2012) connector.

Parameters:
  • cset (csa.connset.CSet) – a connection set description
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.distance_dependent_probability_connector.DistanceDependentProbabilityConnector, pyNN.connectors.DistanceDependentProbabilityConnector

Make connections using a distribution which varies with distance.

Parameters:
  • d_expression (str) – the right-hand side of a valid python expression for probability, involving d, e.g. "exp(-abs(d))", or "d<3", that can be parsed by eval(), that computes the distance dependent distribution
  • allow_self_connections (bool) – 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.
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • n_connections (int) – The number of efferent synaptic connections per neuron.
  • rng (NumpyRNG) – random number generator
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.FixedNumberPostConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_number_post_connector.FixedNumberPostConnector, pyNN.connectors.FixedNumberPostConnector

PyNN connector that puts a fixed number of connections on each of the post neurons.

Parameters:
  • n (int) – number of random post-synaptic neurons connected to pre-neurons
  • allow_self_connections (bool) – 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.
  • safe (bool) – Whether to check that weights and delays have valid values; if False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • with_replacement (bool) – if False, once a connection is made, it can’t be made again; if True, multiple connections between the same pair of neurons are allowed
  • rng (NumpyRNG or None) – random number generator
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.FixedNumberPreConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_number_pre_connector.FixedNumberPreConnector, pyNN.connectors.FixedNumberPreConnector

Connects a fixed number of pre-synaptic neurons selected at random, to all post-synaptic neurons.

Parameters:
  • n (int) – number of random pre-synaptic neurons connected to post-neurons
  • allow_self_connections (bool) – 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.
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • with_replacement (bool) – if False, once a connection is made, it can’t be made again; if True, multiple connections between the same pair of neurons are allowed
  • rng (NumpyRNG or None) – random number generator
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.FixedProbabilityConnector(p_connect, allow_self_connections=True, safe=True, verbose=False, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_probability_connector.FixedProbabilityConnector, pyNN.connectors.FixedProbabilityConnector

For each pair of pre-post cells, the connection probability is constant.

Parameters:
  • p_connect (float) – a number between zero and one. Each potential connection is created with this probability.
  • allow_self_connections (bool) – 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.
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • space (Space) – a Space object, needed if you wish to specify distance-dependent weights or delays - not implemented
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • rng (NumpyRNG or None) – random number generator
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

p_connect
class spynnaker8.models.connectors.FromFileConnector(file, distributed=False, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker8.models.connectors.from_list_connector.FromListConnector, pyNN.connectors.FromFileConnector

Make connections according to a list read from a file.

Parameters:
  • file (str or FileIO) –

    Either an open file object or the filename of a file containing a list of connections, in the format required by FromListConnector. Column headers, if included in the file, must be specified using a list or tuple, e.g.:

    # columns = ["i", "j", "weight", "delay", "U", "tau_rec"]
    

    Note that the header requires # at the beginning of the line.

  • distributed (bool) –

    Basic pyNN says:

    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.

    Note

    Always leave this as False with sPyNNaker, which is not MPI-based.

  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
get_reader(file)[source]

Get a file reader object using the PyNN methods.

Returns:A pynn StandardTextFile or similar
class spynnaker8.models.connectors.FromListConnector(conn_list, safe=True, verbose=False, column_names=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.from_list_connector.FromListConnector

Make connections according to a list.

Parameters:
  • conn_list (list(tuple(int,int,..)) or ndarray) – 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).
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • column_names (tuple(str) or list(str) or None) – the names of the parameters p1, p2, etc. If not provided, it is assumed the parameters are weight, delay (for backwards compatibility).
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.index_based_probability_connector.IndexBasedProbabilityConnector

Create an index-based probability connector. The index_expression must depend on the indices i, j of the populations.

Parameters:
  • index_expression (str) – A function of the indices of the populations, written as a Python expression; the indices will be given as variables i and j when the expression is evaluated.
  • allow_self_connections (bool) – allow a neuron to connect to itself
  • rng (NumpyRNG or None) – random number generator
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • callback (callable) –

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
spynnaker8.models.connectors.FixedTotalNumberConnector

alias of spynnaker8.models.connectors.multapse_connector.MultapseConnector

class spynnaker8.models.connectors.OneToOneConnector(safe=True, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.one_to_one_connector.OneToOneConnector, pyNN.connectors.OneToOneConnector

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.

Parameters:
  • safe (bool) – if True, check that weights and delays have valid values. If False, this check is skipped.
  • callback (callable) –

    a function that will be called with the fractional progress of the connection routine. An example would be progress_bar.set_level.

    Note

    Not supported by sPyNNaker.

class spynnaker8.models.connectors.SmallWorldConnector(degree, rewiring, allow_self_connections=True, n_connections=None, rng=None, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.small_world_connector.SmallWorldConnector

Create a connector that uses connection statistics based on the Small World network connectivity model. Note that this is typically used from a population to itself.

Parameters:
  • degree (float) – the region length where nodes will be connected locally
  • rewiring (float) – the probability of rewiring each edge
  • allow_self_connections (bool) – 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 (int or None) – if specified, the number of efferent synaptic connections per neuron
  • rng (NumpyRNG or None) – random number generator
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • callback (callable) – For PyNN compatibility only.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
class spynnaker8.models.connectors.KernelConnector(shape_pre, shape_post, shape_kernel, weight_kernel=None, delay_kernel=None, shape_common=None, pre_sample_steps_in_post=None, pre_start_coords_in_post=None, post_sample_steps_in_pre=None, post_start_coords_in_pre=None, safe=True, space=None, verbose=False, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.kernel_connector.KernelConnector

Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, col) neuron to many pre(row, col, kernel) through a (kernel) set of weights and/or delays.

TODO

Should these include allow_self_connections and with_replacement?

Parameters:
  • shape_pre (tuple(int,int)) – 2D shape of the pre population (rows/height, cols/width, usually the input image shape)
  • shape_post (tuple(int,int)) – 2D shape of the post population (rows/height, cols/width)
  • shape_kernel (tuple(int,int)) – 2D shape of the kernel (rows/height, cols/width)
  • weight_kernel (ndarray or NumpyRNG or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the weights
  • delay_kernel (ndarray or NumpyRNG or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the delays
  • shape_common (tuple(int,int)) – (optional) 2D shape of common coordinate system (for both pre and post, usually the input image sizes)
  • pre_sample_steps_in_post (tuple(int,int)) – (optional) Sampling steps/jumps for pre pop \(\Leftrightarrow\) \((\mathsf{step}_x, \mathsf{step}_y)\)
  • pre_start_coords_in_post (tuple(int,int)) – (optional) Starting row/col for pre sampling \(\Leftrightarrow\) \((\mathsf{offset}_x, \mathsf{offset}_y)\)
  • post_sample_steps_in_pre (tuple(int,int)) – (optional) Sampling steps/jumps for post pop \(\Leftrightarrow\) \((\mathsf{step}_x, \mathsf{step}_y)\)
  • post_start_coords_in_pre (tuple(int,int)) – (optional) Starting row/col for post sampling \(\Leftrightarrow\) \((\mathsf{offset}_x, \mathsf{offset}_y)\)
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • space (Space) – Currently ignored; for future compatibility.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • callback (callable) – (ignored)