spynnaker8.models.populations package¶
Submodules¶
spynnaker8.models.populations.assembly module¶
spynnaker8.models.populations.idmixin module¶
-
class
spynnaker8.models.populations.idmixin.
IDMixin
(population, id)[source]¶ Bases:
object
-
celltype
¶
-
id
¶
-
is_standard_cell
¶
-
local
¶
-
position
¶ Return the cell position in 3D space. Cell positions are stored in an array in the parent Population, if any, or within the ID object otherwise. Positions are generated the first time they are requested and then cached.
-
spynnaker8.models.populations.population module¶
-
class
spynnaker8.models.populations.population.
Population
(size, cellclass, cellparams=None, structure=None, initial_values=None, label=None, constraints=None, additional_parameters=None)[source]¶ Bases:
spynnaker.pyNN.models.pynn_population_common.PyNNPopulationCommon
,spynnaker8.models.recorder.Recorder
,spynnaker8.models.populations.population_base.PopulationBase
PyNN 0.8/0.9 population object
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
annotations
¶ The annotations given by the end user
-
celltype
¶ Implements the PyNN expected celltype property
Returns: The celltype this property has been set to
-
static
create
(cellclass, cellparams=None, n=1)[source]¶ Pass through method to the constructor defined by PyNN. Create n cells all of the same type. Returns a Population object.
Parameters: - cellclass – see Population.__init__
- cellparams – see Population.__init__
- n – see Population.__init__(size…)
Returns: A New Population
-
describe
(template='population_default.txt', engine='default')[source]¶ Returns a human-readable description of the population.
The output may be customized by specifying a different template together with an associated template engine (see
pyNN.descriptions
).If template is None, then a dictionary containing the template context will be returned.
-
find_units
(variable)[source]¶ Get the units of a variable
Parameters: variable – The name of the variable Returns: The units of the variable
-
get
(parameter_names, gather=False, simplify=True)[source]¶ Get the values of a parameter for every local cell in the population.
Parameters: - parameter_names – Name of parameter. This is either a single string or a list of strings
- gather – pointless on sPyNNaker
Returns: A single list of values (or possibly a single value) if paramter_names is a string, or a dict of these if parameter names is a list.
Return type: str or list(str) or dict(str,str) or dict(str,list(str))
-
get_data
(variables='all', gather=True, clear=False, annotations=None)[source]¶ Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.
Parameters: - variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather (bool) –
Whether to collect data from all MPI nodes or just the current node.
Note
This is irrelevant on sPyNNaker, which always behaves as if this parameter is True.
- clear (bool) – Whether recorded data will be deleted from the Assembly.
- annotations (dict) – annotations to put on the neo block
Return type: neo.Block
-
get_data_by_indexes
(variables, indexes, clear=False, annotations=None)[source]¶ Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.
Parameters: - variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- indexes (list (int)) – List of neuron indexes to include in the data. Clearly only neurons recording will actually have any data If None will be taken as all recording as get_data
- clear (bool) – Whether recorded data will be deleted.
- annotations (dict) – annotations to put on the neo block
Return type: neo.Block
-
get_initial_value
(variable, selector=None)[source]¶ See AbstractPopulationInitializable.get_initial_value
-
initial_values
¶
-
position_generator
¶ NO PyNN description of this method.
-
positions
¶ Return the position array for structured populations.
-
record
(variables, to_file=None, sampling_interval=None, indexes=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - variables (str or list(str)) – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file (a Neo IO instance) – a file to automatically record to (optional). write_data() will be automatically called when end() is called.
- sampling_interval – a value in milliseconds, and an integer multiple of the simulation timestep.
-
set
(**kwargs)[source]¶ Set one or more parameters for every cell in the population.
param can be a dict, in which case value should not be supplied, or a string giving the parameter name, in which case value is the parameter value. value can be a numeric value, or list of such (e.g. for setting spike times):
p.set("tau_m", 20.0). p.set({'tau_m':20, 'v_rest':-65})
Parameters: - parameter (str or dict) – the parameter to set
- value – the value of the parameter to set.
-
set_initial_value
(variable, value, selector=None)[source]¶ See AbstractPopulationInitializable.set_initial_value
-
spinnaker_get_data
(variable)[source]¶ Public accessor for getting data as a numpy array, instead of the neo based object
Parameters: variable – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised. Returns: numpy array of the data
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io (neo instance or str) – a Neo IO instance, or a string for where to put a neo instance
- variables (str or list(str)) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – pointless on sPyNNaker
- clear – clears the storage data if set to true after reading it back
- annotations – annotations to put on the neo block
-
spynnaker8.models.populations.population_base module¶
-
class
spynnaker8.models.populations.population_base.
PopulationBase
[source]¶ Bases:
object
Shared methods between Populations and Population views.
Mainly pass through and not implemented
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
get_data
(variables='all', gather=True, clear=False)[source]¶ Return a Neo Block containing the data(spikes, state variables) recorded from the Population.
Parameters: - variables – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – For parallel simulators, if this is True, all data will be gathered to all nodes and the Neo Block will contain data from all nodes. Otherwise, the Neo Block will contain only data from the cells simulated on the local node.
- clear – If this is True, recorded data will be deleted from the Population.
-
get_gsyn
(*args, **kwargs)[source]¶ Warning
Deprecated. Use get_data([‘gsyn_exc’, ‘gsyn_inh’]) instead.
-
get_spike_counts
(gather=True)[source]¶ Returns a dict containing the number of spikes for each neuron.
The dict keys are neuron IDs, not indices.
-
local_cells
¶ An array containing the cell IDs of those neurons in the Population that exist on the local MPI node.
-
local_size
¶ Return the number of cells in the population on the local MPI node.
-
position_generator
¶ Warning
NO PyNN description of this method.
-
positions
¶ Warning
NO PyNN description of this method.
-
printSpikes
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, ‘spikes’) instead.
Note
Method signature is the PyNN0.7 one
-
print_gsyn
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, [‘gsyn_exc’, ‘gsyn_inh’]) instead.
Note
Method signature is the PyNN0.7 one
-
print_v
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, ‘v’) instead.
Note
Method signature is the PyNN0.7 one
-
record
(variables, to_file=None, sampling_interval=None, indexes=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - variables (str or list(str)) – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file (a Neo IO instance) – a file to automatically record to (optional). write_data() will be automatically called when end() is called.
- sampling_interval – a value in milliseconds, and an integer multiple of the simulation timestep.
-
record_gsyn
(sampling_interval=1, indexes=None, to_file=None)[source]¶ Warning
Deprecated. Use record([‘gsyn_exc’, ‘gsyn_inh’]) instead.
Note
Method signature is the PyNN 0.7 one with the extra non-PyNN sampling_interval and indexes
-
record_v
(sampling_interval=1, indexes=None, to_file=None)[source]¶ Warning
Deprecated. Use record(‘v’) instead.
Note
Method signature is the PyNN 0.7 one with the extra non-PyNN sampling_interval and indexes
-
structure
¶ The spatial structure of the parent Population.
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io (neo instance or str) – a Neo IO instance, or a string for where to put a Neo instance
- variables (str or list(str)) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – pointless on sPyNNaker
- clear – clears the storage data if set to true after reading it back
- annotations – annotations to put on the Neo block
-
spynnaker8.models.populations.population_view module¶
-
class
spynnaker8.models.populations.population_view.
PopulationView
(parent, selector, label=None)[source]¶ Bases:
spynnaker8.models.populations.population_base.PopulationBase
A view of a subset of neurons within a
Population
.In most ways, Populations and PopulationViews have the same behaviour, i.e., they can be recorded, connected with Projections, etc. It should be noted that any changes to neurons in a PopulationView will be reflected in the parent Population and vice versa.
It is possible to have views of views.
Note
Selector to Id is actually handled by
AbstractSized
.Parameters: selector – a slice or numpy mask array. The mask array should either be a boolean array (ideally) of the same size as the parent, or an integer array containing cell indices, i.e. if p.size == 5 then:
PopulationView(p, array([False, False, True, False, True])) PopulationView(p, array([2, 4])) PopulationView(p, slice(2, 5, 2))
will all create the same view.
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
celltype
¶ The type of neurons making up the Population.
-
conductance_based
¶ Indicates whether the post-synaptic response is modelled as a change in conductance or a change in current.
-
describe
(template='populationview_default.txt', engine='default')[source]¶ Returns a human-readable description of the population view.
The output may be customized by specifying a different template together with an associated template engine (see pyNN.descriptions).
If template is None, then a dictionary containing the template context will be returned.
-
get
(parameter_names, gather=False, simplify=True)[source]¶ Get the values of the given parameters for every local cell in the population, or, if gather=True, for all cells in the population.
Values will be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
-
get_data
(variables='all', gather=True, clear=False)[source]¶ Return a Neo Block containing the data(spikes, state variables) recorded from the Population.
Parameters: - variables – Either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather –
For parallel simulators, if gather is True, all data will be gathered to all nodes and the Neo Block will contain data from all nodes. Otherwise, the Neo Block will contain only data from the cells simulated on the local node.
Note
SpiNNaker always gathers.
- clear – If True, recorded data will be deleted from the Population.
-
get_spike_counts
(gather=True)[source]¶ Returns a dict containing the number of spikes for each neuron.
The dict keys are neuron IDs, not indices.
-
grandparent
¶ Returns the parent Population at the root of the tree (since the immediate parent may itself be a PopulationView).
The name “grandparent” is of course a little misleading, as it could be just the parent, or the great, great, great, …, grandparent.
-
id_to_index
(id)[source]¶ Given the ID(s) of cell(s) in the PopulationView, return its / their index / indices(order in the PopulationView).
assert pv.id_to_index(pv[3]) == 3
-
index_in_grandparent
(indices)[source]¶ Given an array of indices, return the indices in the parent population at the root of the tree.
-
initial_values
¶ A dict containing the initial values of the state variables.
-
initialize
(**initial_values)[source]¶ Set initial values of state variables, e.g. the membrane potential. Values passed to initialize() may be:
- single numeric values (all neurons set to the same value), or
- RandomDistribution objects, or
- lists / arrays of numbers of the same size as the population mapping functions, where a mapping function accepts a single argument(the cell index) and returns a single number.
Values should be expressed in the standard PyNN units( i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
Examples:
p.initialize(v=-70.0) p.initialize(v=rand_distr, gsyn_exc=0.0) p.initialize(v=lambda i: -65 + i / 10.0)
-
label
¶ A label for the Population.
-
mask
¶ The selector mask that was used to create this view.
-
parent
¶ A reference to the parent Population (that this is a view of).
-
record
(variables, to_file=None, sampling_interval=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - varables – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file – If specified, should be a Neo IO instance and write_data() will be automatically called when end() is called.
- sampling_interval – should be a value in milliseconds, and an integer multiple of the simulation timestep.
-
sample
(n, rng=None)[source]¶ Randomly sample n cells from the Population, and return a PopulationView object.
-
set
(**parameters)[source]¶ Set one or more parameters for every cell in the population. Values passed to set() may be:
- single values,
- RandomDistribution objects, or
- lists / arrays of values of the same size as the population mapping functions, where a mapping function accepts a single argument (the cell index) and returns a single value.
Here, a “single value” may be either a single number or a list / array of numbers (e.g. for spike times).
Values should be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
Examples:
p.set(tau_m=20.0, v_rest=-65). p.set(spike_times=[0.3, 0.7, 0.9, 1.4]) p.set(cm=rand_distr, tau_m=lambda i: 10 + i / 10.0)
-
size
¶ The total number of neurons in the Population.
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io – a Neo IO instance
- variables – either a single variable name or a list of variable names. These must have been previously recorded, otherwise an Exception will be raised.
- gather – For parallel simulators, if this is True, all data will be gathered to the master node and a single output file created there. Otherwise, a file will be written on each node, containing only data from the cells simulated on that node.
- clear – If this is True, recorded data will be deleted from the Population.
- annotations – should be a dict containing simple data types such as numbers and strings. The contents will be written into the output data file as metadata.
-
Module contents¶
-
class
spynnaker8.models.populations.
Assembly
(*populations, **kwargs)[source]¶ Bases:
pyNN.common.populations.Assembly
Create an Assembly of Populations and/or PopulationViews.
-
class
spynnaker8.models.populations.
IDMixin
(population, id)[source]¶ Bases:
object
-
celltype
¶
-
id
¶
-
is_standard_cell
¶
-
local
¶
-
position
¶ Return the cell position in 3D space. Cell positions are stored in an array in the parent Population, if any, or within the ID object otherwise. Positions are generated the first time they are requested and then cached.
-
-
class
spynnaker8.models.populations.
Population
(size, cellclass, cellparams=None, structure=None, initial_values=None, label=None, constraints=None, additional_parameters=None)[source]¶ Bases:
spynnaker.pyNN.models.pynn_population_common.PyNNPopulationCommon
,spynnaker8.models.recorder.Recorder
,spynnaker8.models.populations.population_base.PopulationBase
PyNN 0.8/0.9 population object
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
annotations
¶ The annotations given by the end user
-
celltype
¶ Implements the PyNN expected celltype property
Returns: The celltype this property has been set to
-
static
create
(cellclass, cellparams=None, n=1)[source]¶ Pass through method to the constructor defined by PyNN. Create n cells all of the same type. Returns a Population object.
Parameters: - cellclass – see Population.__init__
- cellparams – see Population.__init__
- n – see Population.__init__(size…)
Returns: A New Population
-
describe
(template='population_default.txt', engine='default')[source]¶ Returns a human-readable description of the population.
The output may be customized by specifying a different template together with an associated template engine (see
pyNN.descriptions
).If template is None, then a dictionary containing the template context will be returned.
-
find_units
(variable)[source]¶ Get the units of a variable
Parameters: variable – The name of the variable Returns: The units of the variable
-
get
(parameter_names, gather=False, simplify=True)[source]¶ Get the values of a parameter for every local cell in the population.
Parameters: - parameter_names – Name of parameter. This is either a single string or a list of strings
- gather – pointless on sPyNNaker
Returns: A single list of values (or possibly a single value) if paramter_names is a string, or a dict of these if parameter names is a list.
Return type: str or list(str) or dict(str,str) or dict(str,list(str))
-
get_data
(variables='all', gather=True, clear=False, annotations=None)[source]¶ Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.
Parameters: - variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather (bool) –
Whether to collect data from all MPI nodes or just the current node.
Note
This is irrelevant on sPyNNaker, which always behaves as if this parameter is True.
- clear (bool) – Whether recorded data will be deleted from the Assembly.
- annotations (dict) – annotations to put on the neo block
Return type: neo.Block
-
get_data_by_indexes
(variables, indexes, clear=False, annotations=None)[source]¶ Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.
Parameters: - variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- indexes (list (int)) – List of neuron indexes to include in the data. Clearly only neurons recording will actually have any data If None will be taken as all recording as get_data
- clear (bool) – Whether recorded data will be deleted.
- annotations (dict) – annotations to put on the neo block
Return type: neo.Block
-
get_initial_value
(variable, selector=None)[source]¶ See AbstractPopulationInitializable.get_initial_value
-
initial_values
¶
-
position_generator
¶ NO PyNN description of this method.
-
positions
¶ Return the position array for structured populations.
-
record
(variables, to_file=None, sampling_interval=None, indexes=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - variables (str or list(str)) – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file (a Neo IO instance) – a file to automatically record to (optional). write_data() will be automatically called when end() is called.
- sampling_interval – a value in milliseconds, and an integer multiple of the simulation timestep.
-
set
(**kwargs)[source]¶ Set one or more parameters for every cell in the population.
param can be a dict, in which case value should not be supplied, or a string giving the parameter name, in which case value is the parameter value. value can be a numeric value, or list of such (e.g. for setting spike times):
p.set("tau_m", 20.0). p.set({'tau_m':20, 'v_rest':-65})
Parameters: - parameter (str or dict) – the parameter to set
- value – the value of the parameter to set.
-
set_initial_value
(variable, value, selector=None)[source]¶ See AbstractPopulationInitializable.set_initial_value
-
spinnaker_get_data
(variable)[source]¶ Public accessor for getting data as a numpy array, instead of the neo based object
Parameters: variable – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised. Returns: numpy array of the data
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io (neo instance or str) – a Neo IO instance, or a string for where to put a neo instance
- variables (str or list(str)) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – pointless on sPyNNaker
- clear – clears the storage data if set to true after reading it back
- annotations – annotations to put on the neo block
-
-
class
spynnaker8.models.populations.
PopulationBase
[source]¶ Bases:
object
Shared methods between Populations and Population views.
Mainly pass through and not implemented
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
get_data
(variables='all', gather=True, clear=False)[source]¶ Return a Neo Block containing the data(spikes, state variables) recorded from the Population.
Parameters: - variables – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – For parallel simulators, if this is True, all data will be gathered to all nodes and the Neo Block will contain data from all nodes. Otherwise, the Neo Block will contain only data from the cells simulated on the local node.
- clear – If this is True, recorded data will be deleted from the Population.
-
get_gsyn
(*args, **kwargs)[source]¶ Warning
Deprecated. Use get_data([‘gsyn_exc’, ‘gsyn_inh’]) instead.
-
get_spike_counts
(gather=True)[source]¶ Returns a dict containing the number of spikes for each neuron.
The dict keys are neuron IDs, not indices.
-
local_cells
¶ An array containing the cell IDs of those neurons in the Population that exist on the local MPI node.
-
local_size
¶ Return the number of cells in the population on the local MPI node.
-
position_generator
¶ Warning
NO PyNN description of this method.
-
positions
¶ Warning
NO PyNN description of this method.
-
printSpikes
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, ‘spikes’) instead.
Note
Method signature is the PyNN0.7 one
-
print_gsyn
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, [‘gsyn_exc’, ‘gsyn_inh’]) instead.
Note
Method signature is the PyNN0.7 one
-
print_v
(filename, gather=True)[source]¶ Warning
Deprecated. Use write_data(file, ‘v’) instead.
Note
Method signature is the PyNN0.7 one
-
record
(variables, to_file=None, sampling_interval=None, indexes=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - variables (str or list(str)) – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file (a Neo IO instance) – a file to automatically record to (optional). write_data() will be automatically called when end() is called.
- sampling_interval – a value in milliseconds, and an integer multiple of the simulation timestep.
-
record_gsyn
(sampling_interval=1, indexes=None, to_file=None)[source]¶ Warning
Deprecated. Use record([‘gsyn_exc’, ‘gsyn_inh’]) instead.
Note
Method signature is the PyNN 0.7 one with the extra non-PyNN sampling_interval and indexes
-
record_v
(sampling_interval=1, indexes=None, to_file=None)[source]¶ Warning
Deprecated. Use record(‘v’) instead.
Note
Method signature is the PyNN 0.7 one with the extra non-PyNN sampling_interval and indexes
-
structure
¶ The spatial structure of the parent Population.
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io (neo instance or str) – a Neo IO instance, or a string for where to put a Neo instance
- variables (str or list(str)) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather – pointless on sPyNNaker
- clear – clears the storage data if set to true after reading it back
- annotations – annotations to put on the Neo block
-
-
class
spynnaker8.models.populations.
PopulationView
(parent, selector, label=None)[source]¶ Bases:
spynnaker8.models.populations.population_base.PopulationBase
A view of a subset of neurons within a
Population
.In most ways, Populations and PopulationViews have the same behaviour, i.e., they can be recorded, connected with Projections, etc. It should be noted that any changes to neurons in a PopulationView will be reflected in the parent Population and vice versa.
It is possible to have views of views.
Note
Selector to Id is actually handled by
AbstractSized
.Parameters: selector – a slice or numpy mask array. The mask array should either be a boolean array (ideally) of the same size as the parent, or an integer array containing cell indices, i.e. if p.size == 5 then:
PopulationView(p, array([False, False, True, False, True])) PopulationView(p, array([2, 4])) PopulationView(p, slice(2, 5, 2))
will all create the same view.
-
all_cells
¶ An array containing the cell IDs of all neurons in the Population (all MPI nodes).
-
celltype
¶ The type of neurons making up the Population.
-
conductance_based
¶ Indicates whether the post-synaptic response is modelled as a change in conductance or a change in current.
-
describe
(template='populationview_default.txt', engine='default')[source]¶ Returns a human-readable description of the population view.
The output may be customized by specifying a different template together with an associated template engine (see pyNN.descriptions).
If template is None, then a dictionary containing the template context will be returned.
-
get
(parameter_names, gather=False, simplify=True)[source]¶ Get the values of the given parameters for every local cell in the population, or, if gather=True, for all cells in the population.
Values will be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
-
get_data
(variables='all', gather=True, clear=False)[source]¶ Return a Neo Block containing the data(spikes, state variables) recorded from the Population.
Parameters: - variables – Either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
- gather –
For parallel simulators, if gather is True, all data will be gathered to all nodes and the Neo Block will contain data from all nodes. Otherwise, the Neo Block will contain only data from the cells simulated on the local node.
Note
SpiNNaker always gathers.
- clear – If True, recorded data will be deleted from the Population.
-
get_spike_counts
(gather=True)[source]¶ Returns a dict containing the number of spikes for each neuron.
The dict keys are neuron IDs, not indices.
-
grandparent
¶ Returns the parent Population at the root of the tree (since the immediate parent may itself be a PopulationView).
The name “grandparent” is of course a little misleading, as it could be just the parent, or the great, great, great, …, grandparent.
-
id_to_index
(id)[source]¶ Given the ID(s) of cell(s) in the PopulationView, return its / their index / indices(order in the PopulationView).
assert pv.id_to_index(pv[3]) == 3
-
index_in_grandparent
(indices)[source]¶ Given an array of indices, return the indices in the parent population at the root of the tree.
-
initial_values
¶ A dict containing the initial values of the state variables.
-
initialize
(**initial_values)[source]¶ Set initial values of state variables, e.g. the membrane potential. Values passed to initialize() may be:
- single numeric values (all neurons set to the same value), or
- RandomDistribution objects, or
- lists / arrays of numbers of the same size as the population mapping functions, where a mapping function accepts a single argument(the cell index) and returns a single number.
Values should be expressed in the standard PyNN units( i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
Examples:
p.initialize(v=-70.0) p.initialize(v=rand_distr, gsyn_exc=0.0) p.initialize(v=lambda i: -65 + i / 10.0)
-
label
¶ A label for the Population.
-
mask
¶ The selector mask that was used to create this view.
-
parent
¶ A reference to the parent Population (that this is a view of).
-
record
(variables, to_file=None, sampling_interval=None)[source]¶ Record the specified variable or variables for all cells in the Population or view.
Parameters: - varables – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
- to_file – If specified, should be a Neo IO instance and write_data() will be automatically called when end() is called.
- sampling_interval – should be a value in milliseconds, and an integer multiple of the simulation timestep.
-
sample
(n, rng=None)[source]¶ Randomly sample n cells from the Population, and return a PopulationView object.
-
set
(**parameters)[source]¶ Set one or more parameters for every cell in the population. Values passed to set() may be:
- single values,
- RandomDistribution objects, or
- lists / arrays of values of the same size as the population mapping functions, where a mapping function accepts a single argument (the cell index) and returns a single value.
Here, a “single value” may be either a single number or a list / array of numbers (e.g. for spike times).
Values should be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).
Examples:
p.set(tau_m=20.0, v_rest=-65). p.set(spike_times=[0.3, 0.7, 0.9, 1.4]) p.set(cm=rand_distr, tau_m=lambda i: 10 + i / 10.0)
-
size
¶ The total number of neurons in the Population.
-
write_data
(io, variables='all', gather=True, clear=False, annotations=None)[source]¶ Write recorded data to file, using one of the file formats supported by Neo.
Parameters: - io – a Neo IO instance
- variables – either a single variable name or a list of variable names. These must have been previously recorded, otherwise an Exception will be raised.
- gather – For parallel simulators, if this is True, all data will be gathered to the master node and a single output file created there. Otherwise, a file will be written on each node, containing only data from the cells simulated on that node.
- clear – If this is True, recorded data will be deleted from the Population.
- annotations – should be a dict containing simple data types such as numbers and strings. The contents will be written into the output data file as metadata.
-