PopulationView
self, population, ranks, geometry=None) PopulationView(
Subset of a Population.
A list of ranks can be passed, but population views are usually created through slicing:
= net.create(1000, neuron)
pop
= pop[:800] # ann.PopulationView(pop, range(800))
E = pop[800:] # ann.PopulationView(pop, range(800, 1000)) I
Parameters
Name | Type | Description | Default |
---|---|---|---|
population | population object | required | |
ranks | list or numpy array containing the ranks of the selected neurons. | required | |
geometry | a geometry for the Populationview (optional) | None |
Attributes
Name | Description |
---|---|
population | Original population. |
ranks | Array of ranks in the PopulationView. |
geometry | Geometry of the PopulationView (optional). |
size | Size of the PopulationView (number of neurons). |
targets | List of targets connected to the population. |
name | Name of the original population. |
attributes | Äist of attributes of the original population. |
variables | List of variables of the original population. |
parameters | List of constants of the original population. |
Methods
Name | Description |
---|---|
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. |
get | Returns the parameter/variable value. |
set | Updates the neurons’ parameter/variable values. |
sum | Returns the array of weighted sums corresponding to the target: |
rank_from_coordinates
=False) rank_from_coordinates(coord, local
Returns the rank of a neuron based on coordinates.
When local is False
(default), the coordinates are relative to the ORIGINAL population, not the PopulationView.
When local is True
, the coordinates are interpreted relative to the geometry of the PopulationView if available. When you add two population views, the geometry is lost and the method will return an error.
The rank is relative to the original population. Iterate over len(pop) otherwise.
Parameters
Name | Type | Description | Default |
---|---|---|---|
coord | tuple | coordinate tuple, can be multidimensional. | required |
local | bool | whether the coordinates are local to the PopulationView or not. | False |
coordinates_from_rank
=False) coordinates_from_rank(rank, local
Returns the coordinates of a neuron based on its rank.
When local is False
(default), the coordinates are relative to the ORIGINAL population, not the PopulationView.
When local is True
, the coordinates are interpreted relative to the geometry of the PopulationView if available. When you add two population views, the geometry is lost and the method will return an error.
The rank is relative to the original population. Iterate over len(pop) otherwise.
Parameters
Name | Type | Description | Default |
---|---|---|---|
rank | int | rank of the neuron in the original population. | required |
local | bool | whether the coordinates are local to the PopulationView or not. | False |
get
get(name)
Returns the parameter/variable value.
Parameters
Name | Type | Description | Default |
---|---|---|---|
name | name of the parameter/variable. | required |
set
set(value)
Updates the neurons’ parameter/variable values.
Warning: If you modify the value of a global parameter, this will be the case for ALL neurons of the population, not only the subset.
Parameters
Name | Type | Description | Default |
---|---|---|---|
value | dict | dictionary of parameters/variables to be updated for the corresponding subset of neurons. It can be a single value or a list/1D array of the same size as the PopulationView . |
required |
sum
sum(target)
Returns the array of weighted sums corresponding to the target:
= pop[:50].sum('exc') excitatory
For spiking networks, this is equivalent to accessing the conductances directly::
= pop[:50].g_exc excitatory
If no incoming projection has the given target, the method returns zeros.
Parameters
Name | Type | Description | Default |
---|---|---|---|
target | str | the target. | required |