spynnaker.pyNN.models package¶

spynnaker.pyNN.models.abstract_pynn_model module¶

class spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel[source]

Bases: object

A Model that can be passed in to a Population object in PyNN

create_vertex(n_neurons, label, constraints)[source]

Create a vertex for a population of the model

Parameters: n_neurons (int) – The number of neurons in the population label (str) – The label to give to the vertex constraints (list(AbstractConstraint) or None) – A list of constraints to give to the vertex, or None An application vertex for the population ApplicationVertex
default_initial_values = {}
default_parameters = {}
default_population_parameters
Get the default values for the parameters at the population level
These are parameters that can be passed in to the Population constructor in addition to the standard PyNN options
Return type: dict(str, Any)
classmethod get_max_atoms_per_core()[source]

Get the maximum number of atoms per core for this model

Return type: int
classmethod get_parameter_names()[source]

Get the names of the parameters of the model

Return type: list(str)
classmethod has_parameter(name)[source]

Determine if the model has a parameter with the given name

Parameters: name (str) – The name of the parameter to check for bool
classmethod set_model_max_atoms_per_core(n_atoms=9223372036854775807)[source]

Set the maximum number of atoms per core for this model

Parameters: n_atoms (int or None) – The new maximum, or None for the largest possible

spynnaker.pyNN.models.defaults module¶

spynnaker.pyNN.models.defaults.default_initial_values(state_variables)[source]

Specifies arguments which are state variables. Only works on the __init__ method of a class that is additionally decorated with defaults()

Parameters: state_variables (iterable(str)) – The names of the arguments that are state variables
spynnaker.pyNN.models.defaults.default_parameters(parameters)[source]

Specifies arguments which are parameters. Only works on the __init__ method of a class that is additionally decorated with defaults()

Parameters: parameters (iterable(str)) – The names of the arguments that are parameters
spynnaker.pyNN.models.defaults.defaults(cls)[source]

Get the default parameters and state variables from the arguments to the __init__ method. This uses the decorators default_parameters() and default_initial_values() to determine the parameters and state variables respectively. If only one is specified, the other is assumed to be the remaining arguments. If neither are specified, it is assumed that all default arguments are parameters.

spynnaker.pyNN.models.defaults.get_dict_from_init(init, skip=None, include=None)[source]

Get an argument initialisation dictionary by examining an __init__ method or function.

Parameters: init (callable) – The method. skip (frozenset(str)) – The arguments to be skipped, if any include (frozenset(str)) – The arguments that must be present, if any an initialisation dictionary dict(str, Any)

spynnaker.pyNN.models.projection module¶

class spynnaker.pyNN.models.projection.Projection(pre_synaptic_population, post_synaptic_population, connector, synapse_type=None, source=None, receptor_type=None, space=None, label=None)[source]

Bases: object

A container for all the connections of a given type (same synapse type and plasticity mechanisms) between two populations, together with methods to set parameters of those connections, including of plasticity mechanisms.

Parameters: pre_synaptic_population (PopulationBase) – post_synaptic_population (PopulationBase) – connector (AbstractConnector) – synapse_type (AbstractSynapseDynamics) – source (None) – Unsupported; must be None receptor_type (str) – space (Space) – label (str) –
get(attribute_names, format, gather=True, with_address=True, multiple_synapses='last')[source]

Get a parameter/attribute of the projection.

Note

SpiNNaker always gathers.

Parameters: attribute_names (str or iterable(str)) – list of attributes to gather format (str) – "list" or "array" gather (bool) – gather over all nodes with_address (bool) – True if the source and target are to be included multiple_synapses (str) – What to do with the data if format=”array” and if the multiple source-target pairs with the same values exist. Currently only “last” is supported values selected
getDelays(format='list', gather=True)[source]

Deprecated since version 5.0: Use get('delay') instead.

getSynapseDynamics(parameter_name, format='list', gather=True)[source]

Deprecated since version 5.0: Use get(parameter_name) instead.

getWeights(format='list', gather=True)[source]

Deprecated since version 5.0: Use get('weight') instead.

label
Return type: str
mark_no_changes()[source]

Mark this projection as not having changes to be mapped.

post

The post-population or population view.

Return type: PopulationBase
pre

The pre-population or population view.

Return type: PopulationBase
printDelays(file, format='list', gather=True)[source]

Deprecated since version 5.0: Use save('delay') instead.

Print synaptic weights to file. In the array format, zeros are printed for non-existent connections.

printWeights(file, format='list', gather=True)[source]

Deprecated since version 5.0: Use save('weight') instead.

requires_mapping

Whether this projection requires mapping.

Return type: bool
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).

Note

SpiNNaker always gathers.

Parameters: attribute_names (str or list(str)) – file (str or pyNN.recording.files.BaseFile) – filename or open handle (which will be closed) format (str) – gather (bool) – Ignored with_address (bool) –
saveConnections(file, gather=True, compatible_output=True)[source]

Deprecated since version 5.0: Use save('all') instead.

set(**attributes)[source]

Warning

Not implemented.

size(gather=True)[source]

Return the total number of connections.

Note

SpiNNaker always gathers.

Warning

Not implemented.

Parameters: gather (bool) – If False, only get the number of connections locally.
weightHistogram(min=None, max=None, nbins=10)[source]

Deprecated since version 5.0: Use numpy.histogram on the weights instead.

Return a histogram of synaptic weights. If min and max are not given, the minimum and maximum weights are calculated automatically.

spynnaker.pyNN.models.recorder module¶

class spynnaker.pyNN.models.recorder.Recorder(population, vertex)[source]

Bases: object

Object to hold recording behaviour, used by populations.

Parameters: population (Population) – the population to record for vertex (ApplicationVertex) – the SpiNNaker graph vertex used by the population
cache_data()[source]

Store data for later extraction

extract_neo_block(variables, view_indexes, clear, annotations)[source]

Extracts block from the vertices and puts them into a Neo block

Parameters: variables (list(str)) – the variables to extract view_indexes (slice) – the indexes to be included in the view clear (bool) – if the variables should be cleared after reading annotations (dict(str,object)) – annotations to put on the Neo block The Neo block Block
get_all_possible_recordable_variables()[source]

All variables that could be recorded.

Return type: set(str)
get_all_recording_variables()[source]

All variables that have been set to record.

Return type: set(str)
get_events(variable)[source]

How to get rewiring events (of a post-population) from recorder

Returns: the rewires (event times, values) from the underlying vertex ndarray
get_recorded_matrix(variable)[source]

Perform safety checks and get the recorded data from the vertex in matrix format.

Parameters: variable (str) – The variable name to read. Supported variable names are: gsyn_exc, gsyn_inh, v data, indexes, sampling_interval tuple(ndarray, list(int), float)
get_recorded_pynn7(variable)[source]

Get recorded data in PyNN 0.7 format. Must not be spikes.

Parameters: variable (str) – The name of the variable to get. Supported variable names are: gsyn_exc, gsyn_inh, v ndarray
get_spikes()[source]

How to get spikes (of a population’s neurons) from the recorder.

Returns: the spikes (event times) from the underlying vertex ndarray
record(variables, to_file, sampling_interval, indexes)[source]

Same as record but without non-standard PyNN warning

This method is non-standard PyNN and is intended only to be called by record in a Population, View or Assembly

Parameters: variables (str or list(str) or None) – 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. Can also be None to reset the list of variables. to_file (io or rawio or str) – a file to automatically record to (optional). write_data() will be automatically called when sim.end() is called. sampling_interval (int) – a value in milliseconds, and an integer multiple of the simulation timestep. indexes (None or list(int)) – The indexes of neurons to record from. This is non-standard PyNN and equivalent to creating a view with these indexes and asking the View to record.
turn_off_all_recording(indexes=None)[source]

Turns off recording, is used by a pop saying .record()

Parameters: indexes (list or None) –
turn_on_record(variable, sampling_interval=None, to_file=None, indexes=None)[source]

Tell the vertex to record data.

Parameters: variable (str) – The variable to record, supported variables to record are: gsyn_exc, gsyn_inh, v, spikes. sampling_interval (int) – the interval to record them to_file (neo.io.baseio.BaseIO or str or None) – If set, a file to write to (by handle or name) indexes (list(int) or None) – List of indexes to record or None for all
write_to_files_indicators

What variables should be written to files, and where should they be written.

Return type: dict(str, neo.io.baseio.BaseIO or str or None)