The module ANNarchy.Projection
defines projections at the population level. A projection is an ensemble of connections (or synapses) between a subset of a population (called the pre-synaptic population) and a subset of another population (the post-synaptic population), with a specific connection type. The pre- and post-synaptic populations may be the same.
ANNarchy.
Projection
(pre, post, target, synapse=None, name=None, copied=False)[source]¶Represents all synapses of the same type between two populations.
Parameters:
Population
object).Population
object).Synapse
instance.By default, the synapse only ensures linear synaptic transmission:
psp = w * pre.r
g_target += w
connect_all_to_all
(weights, delays=0.0, allow_self_connections=False, force_multiple_weights=False, storage_format='lil', storage_order='post_to_pre')¶Builds an all-to-all connection pattern between the two populations.
Parameters:
weights
and there is no learning, a single weight value will be used for the whole projection instead of one per synapse. Setting force_multiple_weights
to True ensures that a value per synapse will be used.Additional Parameter:
Please note, these arguments should be changed carefully, as they can have large impact on the computational performance of ANNarchy.
connect_dog
(amp_pos, sigma_pos, amp_neg, sigma_neg, delays=0.0, limit=0.01, allow_self_connections=False)¶Builds a Difference-Of-Gaussians connection pattern between the two populations.
Each neuron in the postsynaptic population is connected to a region of the presynaptic population centered around the neuron with the same normalized coordinates using a Difference-Of-Gaussians profile.
Parameters:
connect_fixed_number_post
(number, weights=1.0, delays=0.0, allow_self_connections=False, force_multiple_weights=False)¶Builds a connection pattern between the two populations with a fixed number of post-synaptic neurons.
Each neuron in the pre-synaptic population sends connections to a fixed number of neurons of the post-synaptic population chosen randomly.
Parameters:
weights
and there is no learning, a single weight value will be used for the whole projection instead of one per synapse. Setting force_multiple_weights
to True ensures that a value per synapse will be used.connect_fixed_number_pre
(number, weights, delays=0.0, allow_self_connections=False, force_multiple_weights=False, storage_format='lil', storage_order='post_to_pre')¶Builds a connection pattern between the two populations with a fixed number of pre-synaptic neurons.
Each neuron in the postsynaptic population receives connections from a fixed number of neurons of the presynaptic population chosen randomly.
Parameters:
weights
and there is no learning, a single weight value will be used for the whole projection instead of one per synapse. Setting force_multiple_weights
to True ensures that a value per synapse will be used.connect_fixed_probability
(probability, weights, delays=0.0, allow_self_connections=False, force_multiple_weights=False, storage_format='lil', storage_order='post_to_pre')¶Builds a probabilistic connection pattern between the two populations.
Each neuron in the postsynaptic population is connected to neurons of the presynaptic population with the given probability. Self-connections are avoided by default.
Parameters:
weights
and there is no learning, a single weight value will be used for the whole projection instead of one per synapse. Setting force_multiple_weights
to True ensures that a value per synapse will be used.connect_from_file
(filename)¶Builds a connection pattern using data saved using the Projection.save_connectivity() method (not save()!).
Parameters:
Note
Only the ranks, weights and delays are loaded, not the other variables.
connect_from_matrix
(weights, delays=0.0, pre_post=False)¶Builds a connection pattern according to a dense connectivity matrix.
The matrix must be N*M, where N is the number of neurons in the post-synaptic population and M in the pre-synaptic one. Lists of lists must have the same size.
If a synapse should not be created, the weight value should be None.
Parameters:
pre_post
is True, the first dimension is the pre-synaptic population.connect_from_sparse
(weights, delays=0.0)¶Builds a connectivity pattern using a Scipy sparse matrix for the weights and (optionally) delays.
Warning: a sparse matrix has pre-synaptic ranks as first dimension.
Parameters:
connect_gaussian
(amp, sigma, delays=0.0, limit=0.01, allow_self_connections=False)¶Builds a Gaussian connection pattern between the two populations.
Each neuron in the postsynaptic population is connected to a region of the presynaptic population centered around the neuron with the same normalized coordinates using a Gaussian profile.
Parameters:
connect_one_to_one
(weights=1.0, delays=0.0, shift=None, force_multiple_weights=False)¶Builds a one-to-one connection pattern between the two populations.
Parameters:
weights
and there is no learning, a single weight value will be used for the whole projection instead of one per synapse. Setting force_multiple_weights
to True ensures that a value per synapse will be used.connect_with_func
(method, **args)¶Builds a connection pattern based on a user-defined method.
Parameters:
connectivity_matrix
(fill=0.0)[source]¶Returns a dense connectivity matrix (2D Numpy array) representing the connections between the pre- and post-populations.
The first index of the matrix represents post-synaptic neurons, the second the pre-synaptic ones.
If PopulationViews were used for creating the projection, the matrix is expanded to the whole populations by default.
Parameters:
dendrite
(post)[source]¶Returns the dendrite of a postsynaptic neuron according to its rank.
Parameters:
disable_learning
(update=None)[source]¶Disables learning for all synapses of this projection.
The effect depends on the rate-coded or spiking nature of the projection:
w
). This is equivalent to proj.update = False
.w
is disabled, but all other variables are updated. This is equivalent to proj.plasticity = False
.This method is useful when performing some tests on a trained network without messing with the learned weights.
enable_learning
(period=None, offset=None)[source]¶Enables learning for all the synapses of this projection.
Parameters:
For example, providing the following parameters at time 10 ms:
enable_learning(period=10., offset=5.)
would call the updating methods at times 15, 25, 35, etc...
The default behaviour is that the synaptic variables are updated at each time step. The parameters must be multiple of dt
get
(name)[source]¶Returns a list of parameters/variables values for each dendrite in the projection.
The list will have the same length as the number of actual dendrites (self.size), so it can be smaller than the size of the postsynaptic population. Use self.post_ranks to indice it.
Parameters:
load
(filename)[source]¶Loads the saved state of the projection.
Warning: Matlab data can not be loaded.
Parameters:
Example:
proj.load('proj1.txt')
receptive_fields
(variable='w', in_post_geometry=True)[source]¶Gathers all receptive fields within this projection.
Parameters:
reset
(attributes=-1, synapses=False)[source]¶Resets all parameters and variables of the projection to the value they had before the call to compile.
Parameters:
Note
Only parameters and variables are reinitialized, not the connectivity structure (including the weights and delays).
The parameter synapses
will be used in a future release to also reinitialize the connectivity structure.
save
(filename)[source]¶Saves all information about the projection (connectivity, current value of parameters and variables) into a file.
Parameter:
Warning
The ‘.mat’ data will not be loadable by ANNarchy, it is only for external analysis purpose.
Example:
proj.save('proj1.txt')
save_connectivity
(filename)[source]¶Saves the projection pattern in a file.
Only the connectivity matrix, the weights and delays are saved, not the other synaptic variables.
The generated data should be used to create a projection in another network:
proj.connect_from_file(filename)
Parameters:
set
(value)[source]¶Sets the parameters/variables values for each dendrite in the projection.
For parameters, you can provide:
For variables, you can provide:
Warning
It not possible to set different values to each synapse using this method. One should iterate over the dendrites:
for dendrite in proj.dendrites:
dendrite.w = np.ones(dendrite.size)
Parameter:
start_creating
(period=None)[source]¶Starts creating the synapses in the projection if the synapse defines a ‘creating’ argument.
‘structural_plasticity’ must be set to True in setup().
Parameters:
start_pruning
(period=None)[source]¶Starts pruning the synapses in the projection if the synapse defines a ‘pruning’ argument.
‘structural_plasticity’ must be set to True in setup().
Parameters:
stop_creating
()[source]¶Stops creating the synapses in the projection if the synapse defines a ‘creating’ argument.
‘structural_plasticity’ must be set to True in setup().
stop_pruning
()[source]¶Stops pruning the synapses in the projection if the synapse defines a ‘pruning’ argument.
‘structural_plasticity’ must be set to True in setup().
synapse
(pre, post)[source]¶Returns the synapse between a pre- and a post-synaptic neuron if it exists, None otherwise.
Parameters:
dendrites
¶Iteratively returns the dendrites corresponding to this projection.
nb_synapses
¶Total number of synapses in the projection.
size
¶Number of post-synaptic neurons receiving synapses.