ANNarchy 5.0.0
  • ANNarchy
  • Installation
  • Tutorial
  • Manual
  • Notebooks
  • Reference

  • ANNarchy
  • Core components
    • Network
    • Population
    • Projection
    • Monitor
    • PopulationView
    • Dendrite
  • Neuron and Synapse models
    • Neuron
    • Synapse
    • Parameter
    • Variable
    • Creating
    • Pruning
    • Constant
  • Neuron models
    • LeakyIntegrator
    • Izhikevich
    • IF_curr_exp
    • IF_cond_exp
    • IF_curr_alpha
    • IF_cond_alpha
    • HH_cond_exp
    • EIF_cond_alpha_isfa_ista
    • EIF_cond_exp_isfa_ista
  • Synapse models
    • Hebb
    • Oja
    • IBCM
    • STP
    • STDP
  • Inputs
    • InputArray
    • TimedArray
    • PoissonPopulation
    • TimedPoissonPopulation
    • SpikeSourceArray
    • HomogeneousCorrelatedSpikeTrains
    • CurrentInjection
    • DecodingProjection
    • ImagePopulation
    • VideoPopulation
  • Random Distributions
    • Uniform
    • DiscreteUniform
    • Normal
    • LogNormal
    • Exponential
    • Gamma
    • Binomial
  • Functions
    • add_function
    • functions
  • Callbacks
    • every
  • Utilities
    • report
    • timeit
    • sparse_random_matrix
    • sparse_delays_from_weights
    • magic_network
  • Convolution
    • Convolution
    • Pooling
    • Transpose
    • Copy
  • BOLD monitoring
    • BoldMonitor
    • BoldModel
    • balloon_RN
    • balloon_RL
    • balloon_CN
    • balloon_CL
    • balloon_maith2021
    • balloon_two_inputs
  • Tensorboard logging
    • Logger
  • ANN-to-SNN conversion
    • ANNtoSNNConverter
  • DEPRECATED Top-level API
    • setup
    • compile
    • clear
    • reset
    • set_seed
    • get_population
    • get_projection
    • populations
    • projections
    • monitors
    • simulate
    • simulate_until
    • step
    • enable_learning
    • disable_learning
    • get_time
    • set_time
    • get_current_step
    • set_current_step
    • dt
    • save
    • load
    • save_parameters
    • load_parameters
    • callbacks_enabled
    • disable_callbacks
    • enable_callbacks
    • clear_all_callbacks

On this page

  • Population
    • Parameters
    • Attributes
    • Methods
      • reset
      • clear
      • enable
      • disable
      • set
      • get
      • sum
      • compute_firing_rate
      • neuron
      • rank_from_coordinates
      • coordinates_from_rank
      • normalized_coordinates_from_rank
      • save
      • load

Population

Population(
    self,
    geometry,
    neuron,
    name=None,
    stop_condition=None,
    storage_order='post_to_pre',
    copied=False,
    net_id=0,
)

Population of neurons.

The object is returned by Network.create() and should not be created directly.

net = ann.Network()
pop = net.create(100, neuron=ann.Izhikevich, name="Excitatory population")

Parameters

Name Type Description Default
geometry tuple | int population geometry as tuple. If an integer is given, it is the size of the population. required
neuron Neuron Neuron instance. It can be user-defined or a built-in model. required
name str unique name of the population (optional). None
stop_condition str a single condition on a neural variable which can stop the simulation whenever it is true. None

Attributes

Name Description
geometry Geometry of the population.
width Width of the population.
height Height of the population.
depth Depth of the population.
dimension Number of dimensions of the population.
size Size of the population (total number of neurons).
ranks Array of ranks in the population (between 0 and size - 1).
parameters List of parameter names.
variables List of variable names.
attributes List of attribute names (parameters + variables).
functions List of functions defined by the neuron model.
targets List of connected targets.
refractory Refractory period (in ms).
neurons Returns iteratively each neuron in the population.

Methods

Name Description
reset Resets all parameters and variables of the population to the value they had before the call to net.compile().
clear Clears all spiking events previously emitted (history of spikes, delayed spikes).
enable (Re)-enables computations in this population, after they were disabled by the disable() method.
disable Temporarily disables computations in this population (including the projections leading to it).
set Sets the value of neural variables and parameters from a dictionary.
get Returns the value of a neural variable or parameter based on its name.
sum Returns the array of weighted sums corresponding to the target:
compute_firing_rate Tells spiking neurons in the population to compute their mean firing rate over the given window and store the values in the variable r.
neuron Returns an IndividualNeuron object wrapping the neuron with the provided rank or coordinates.
rank_from_coordinates Returns the rank of a neuron based on coordinates.
coordinates_from_rank Returns the coordinates of a neuron based on its rank.
normalized_coordinates_from_rank Returns normalized coordinates of a neuron based on its rank.
save Saves all information about the population (structure, current value of parameters and variables) into a file.
load Load the saved state of the population by Population.save().

reset

reset(attributes=None)

Resets all parameters and variables of the population to the value they had before the call to net.compile().

Parameters

Name Type Description Default
attributes list list of attributes (parameter or variable) which should be reinitialized. Default: all attributes. None

clear

clear()

Clears all spiking events previously emitted (history of spikes, delayed spikes).

Can be useful if you do not want to totally reset a population (i.e. all variables), only to clear the spiking history between two trials.

Note: does nothing for rate-coded networks.

enable

enable()

(Re)-enables computations in this population, after they were disabled by the disable() method.

The status of the population is accessible through the enabled flag.

disable

disable()

Temporarily disables computations in this population (including the projections leading to it).

You can re-enable it with the enable() method.

set

set(values)

Sets the value of neural variables and parameters from a dictionary.

Example:

pop.set({'tau': 20.0, 'r': np.random.rand((8,8)) } )

Parameters

Name Type Description Default
values dict dictionary of attributes to be updated. required

get

get(name)

Returns the value of a neural variable or parameter based on its name.

Parameters

Name Type Description Default
name str attribute name as a string. required

sum

sum(target)

Returns the array of weighted sums corresponding to the target:

excitatory = pop.sum('exc')

For spiking networks, this is equivalent to accessing the conductances directly:

excitatory = pop.g_exc

If no incoming projection has the given target, the method returns zeros.

Note: it is not possible to distinguish the original population when the same target is used.

Parameters

Name Type Description Default
target str the desired projection target. required

compute_firing_rate

compute_firing_rate(window)

Tells spiking neurons in the population to compute their mean firing rate over the given window and store the values in the variable r.

This method has an effect on spiking neurons only.

If this method is not called, r will always be 0.0. r can of course be accessed and recorded as any other variable.

Parameters

Name Type Description Default
window float window in ms over which the spikes will be counted. required

neuron

neuron(*coord)

Returns an IndividualNeuron object wrapping the neuron with the provided rank or coordinates.

rank_from_coordinates

rank_from_coordinates(coord)

Returns the rank of a neuron based on coordinates.

Parameters

Name Type Description Default
coord tuple coordinate tuple, can be multidimensional. required

coordinates_from_rank

coordinates_from_rank(rank)

Returns the coordinates of a neuron based on its rank.

Parameters

Name Type Description Default
rank int rank of the neuron. required

normalized_coordinates_from_rank

normalized_coordinates_from_rank(rank, norm=1.0)

Returns normalized coordinates of a neuron based on its rank.

The geometry of the population is mapped to the hypercube [0, 1]^d

Parameters

Name Type Description Default
rank int rank of the neuron. required
norm float norm of the hypercube (default = 1.0). 1.0

save

save(filename)

Saves all information about the population (structure, current value of parameters and variables) into a file.

  • If the file name is ‘.npz’, the data will be saved and compressed using np.savez_compressed (recommended).
  • If the file name ends with ‘.gz’, the data will be pickled into a binary file and compressed using gzip.
  • If the file name is ‘.mat’, the data will be saved as a Matlab 7.2 file. Scipy must be installed.
  • Otherwise, the data will be pickled into a simple binary text file using pickle.

Warning: The ‘.mat’ data will not be loadable by ANNarchy, it is only for external analysis purpose.

Example:

pop.save('pop1.npz')
pop.save('pop1.txt')
pop.save('pop1.txt.gz')
pop.save('pop1.mat')

Parameters

Name Type Description Default
filename str Filename, may contain relative or absolute path. required

load

load(filename, pickle_encoding=None)

Load the saved state of the population by Population.save().

Warning: Matlab data can not be loaded.

Example:

pop.load('pop1.npz')
pop.load('pop1.txt')
pop.load('pop1.txt.gz')

Parameters

Name Type Description Default
filename the filename with relative or absolute path. required
Network
Projection
 

Copyright Julien Vitay, Helge Ülo Dinkelbach, Fred Hamker