Projections¶
-
class
Projection
(presynaptic_population, postsynaptic_population, connector, synapse_type=None, source=None, receptor_type=None, space=<pyNN.space.Space object>, label=None)[source]¶ Bases:
pyNN.common.projections.Projection
A container for all the connections of a given type (same synapse type and plasticity mechanisms) between two populations, together with methods to set the parameters of those connections, including the parameters of plasticity mechanisms.
- Arguments:
- presynaptic_neurons and postsynaptic_neurons:
- Population, PopulationView or Assembly objects.
- source:
- string specifying which attribute of the presynaptic cell signals action potentials. This is only needed for multicompartmental cells with branching axons or dendrodendritic synapses. All standard cells have a single source, and this is the default.
- receptor_type:
- string specifying which synaptic receptor_type type on the postsynaptic cell to connect to. For standard cells, this can be ‘excitatory’ or ‘inhibitory’. For non-standard cells, it could be ‘NMDA’, etc. If receptor_type is not given, the default values of ‘excitatory’ is used.
- connector:
- a Connector object, encapsulating the algorithm to use for connecting the neurons.
- synapse_type:
- a SynapseType object specifying which synaptic connection mechanisms to use.
- space:
- TO DOCUMENT
-
pre
¶ The pre-synaptic Population, PopulationView or Assembly.
-
post
¶ The post-synaptic Population, PopulationView or Assembly.
-
source
¶ A string specifying which attribute of the presynaptic cell signals action potentials.
-
target
¶ Name of the postsynaptic mechanism type (e.g. ‘excitatory’, ‘NMDA’).
-
label
¶ A label for the Projection.
-
rng
¶ The RNG object that was used by the Connector.
-
synapse_dynamics
¶ The SynapseDynamics object that was used to specify the synaptic plasticity mechanism, or None if the synapses are static.
-
connections
¶
-
MULTI_SYNAPSE_OPERATIONS
= {'last': <function Projection.<lambda>>, 'max': <built-in function max>, 'min': <built-in function min>, 'sum': <built-in function iadd>, 'first': <function Projection.<lambda>>}¶
-
describe
(template='projection_default.txt', engine='default')[source]¶ Returns a human-readable description of the projection.
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.
-
get
(attribute_names, format, gather=True, with_address=True, multiple_synapses='sum')[source]¶ Get the values of a given attribute (weight or delay) for all connections in this Projection.
- attribute_names:
- name of the attributes whose values are wanted, or a list of such names.
- format:
- “list” or “array”.
- gather:
- if True, get connection information from all MPI nodes, otherwise only from connections that exist in this node.
With list format, returns a list of tuples. By default, each tuple contains the indices of the pre- and post-synaptic cell followed by the attribute values in the order given in attribute_names. Example:
>>> prj.get(["weight", "delay"], format="list")[:5] [(0.0, 0.0, 0.3401892507507171, 0.1), (0.0, 1.0, 0.7990713166233654, 0.30000000000000004), (0.0, 2.0, 0.6180841812877726, 0.5), (0.0, 3.0, 0.6758149775627305, 0.7000000000000001), (0.0, 4.0, 0.7166906726862953, 0.9)]
If with_address is set to False, then the tuples will contain only the attribute values, not the cell indices.
With array format, returns a tuple of 2D NumPy arrays, one for each name in attribute_names. The array element X_ij contains the attribute value for the connection from the ith neuron in the pre- synaptic Population to the jth neuron in the post-synaptic Population, if a single such connection exists. If there are no such connections, X_ij will be NaN. Example:
>>> weights, delays = prj.get(["weight", "delay"], format="array") >>> weights array([[ 0.66210438, nan, 0.10744555, 0.54557088], [ 0.3676134 , nan, 0.41463193, nan], [ 0.57434871, 0.4329354 , 0.58482943, 0.42863916]])
If there are multiple such connections, the action to take is controlled by the multiple_synapses argument, which must be one of {‘last’, ‘first’, ‘sum’, ‘min’, ‘max’}.
Values will be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
-
getDelays
(*args, **kwargs)¶ Deprecated. Use
get('delay', format, gather)
instead.
-
getSynapseDynamics
(*args, **kwargs)¶ Deprecated. Use
get(parameter_name, format, gather)
instead.
-
getWeights
(*args, **kwargs)¶ Deprecated. Use
get('weight', format, gather)
instead.
-
printDelays
(*args, **kwargs)¶ Deprecated. Use
save('delay', file, format, gather)
instead.
-
printWeights
(*args, **kwargs)¶ Deprecated. Use
save('weight', file, format, gather)
instead.
-
randomizeDelays
(*args, **kwargs)¶ Deprecated. Use
set(delay=rand_distr)
instead.
-
randomizeSynapseDynamics
(*args, **kwargs)¶ Deprecated. Use
set(name=rand_distr)
instead.
-
randomizeWeights
(*args, **kwargs)¶ Deprecated. Use
set(weight=rand_distr)
instead.
-
save
(attribute_names, file, format='list', gather=True, with_address=True)[source]¶ Print synaptic attributes (weights, delays, etc.) to file. In the array format, zeros are printed for non-existent connections.
Values will be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
-
saveConnections
(*args, **kwargs)¶ Deprecated. Use
save('all', file, format='list', gather=gather)
instead.
-
set
(**attributes)[source]¶ Set connection attributes for all connections on the local MPI node.
Attribute names may be ‘weight’, ‘delay’, or the name of any parameter of a synapse dynamics model (e.g. ‘U’ for TsodyksMarkramSynapse).
- Each attribute value may be:
- a single number
- a RandomDistribution object
- a 2D array with the same dimensions as the connectivity matrix (as returned by get(format=’array’)
- a mapping function, which accepts a single float argument (the distance between pre- and post-synaptic cells) and returns a single value.
Weights should be in nA for current-based and µS for conductance-based synapses. Delays should be in milliseconds.
Note that where a projection contains multiple connections between a given pair of neurons, all these connections will be set to the same value.
-
setDelays
(*args, **kwargs)¶ Deprecated. Use
set(delay=d)
instead.
-
setSynapseDynamics
(*args, **kwargs)¶ Deprecated. Use
set(parameter_name=value)
instead.
-
setWeights
(*args, **kwargs)¶ Deprecated. Use
set(weight=w)
instead.
-
shape
¶
-
size
(gather=True)[source]¶ - Return the total number of connections.
- only local connections, if gather is False,
- all connections, if gather is True (default)
-
weightHistogram
(*args, **kwargs)¶ Deprecated. Use
numpy.histogram()
instead.
-
connect
(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, rng=None)¶ Connect a source of spikes to a synaptic target.
source and target can both be individual cells or populations/ assemblies of cells, in which case all possible connections are made with probability p, using either the random number generator supplied, or the default RNG otherwise. Weights should be in nA or µS.