spynnaker.pyNN.models.spike_source package

Submodules

spynnaker.pyNN.models.spike_source.spike_source_array_vertex module

class spynnaker.pyNN.models.spike_source.spike_source_array_vertex.SpikeSourceArrayVertex(n_neurons, spike_times, constraints, label, max_atoms_per_core, model, splitter)[source]

Bases: spinn_front_end_common.utility_models.reverse_ip_tag_multi_cast_source.ReverseIpTagMultiCastSource, spynnaker.pyNN.models.common.abstract_spike_recordable.AbstractSpikeRecordable, spynnaker.pyNN.models.common.simple_population_settable.SimplePopulationSettable, spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

Model for play back of spikes

SPIKE_RECORDING_REGION_ID = 0
clear_spike_recording(buffer_manager, placements)[source]

Clear the recorded data from the object

Parameters:
Return type:

None

describe()[source]

Returns a human-readable description of the cell or synapse type.

The output may be customised 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_spikes(placements, buffer_manager)[source]

Get the recorded spikes from the object

Parameters:
Returns:

A numpy array of 2-element arrays of (neuron_id, time) ordered by time, one element per event

Return type:

ndarray(tuple(int,int))

get_spikes_sampling_interval()[source]

Return the current sampling interval for spikes

Returns:Sampling interval in microseconds
Return type:float
is_recording_spikes()[source]

Determine if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
mark_no_changes()[source]

Marks the point after which changes are reported, so that new changes can be detected before the next check.

requires_mapping

True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.

Return type:bool
set_recording_spikes(new_state=True, sampling_interval=None, indexes=None)[source]

Set spikes to being recorded. If new_state is false all other parameters are ignored.

Parameters:
  • new_state (bool) – Set if the spikes are recording or not
  • sampling_interval (int or None) – The interval at which spikes are recorded. Must be a whole multiple of the timestep. None will be taken as the timestep.
  • indexes (list(int) or None) – The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording
set_value_by_selector(selector, key, value)[source]

Sets the value for a particular key but only for the selected subset.

Parameters:
spike_times

The spike times of the spike source array

spynnaker.pyNN.models.spike_source.spike_source_poisson_machine_vertex module

class spynnaker.pyNN.models.spike_source.spike_source_poisson_machine_vertex.SpikeSourcePoissonMachineVertex(resources_required, is_recording, constraints=None, label=None, app_vertex=None, vertex_slice=None)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.interface.buffer_management.buffer_models.abstract_receive_buffers_to_host.AbstractReceiveBuffersToHost, spinn_front_end_common.interface.provenance.provides_provenance_data_from_machine_impl.ProvidesProvenanceDataFromMachineImpl, spinn_front_end_common.abstract_models.abstract_supports_database_injection.AbstractSupportsDatabaseInjection, spinn_front_end_common.interface.profiling.abstract_has_profile_data.AbstractHasProfileData, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_rewrites_data_specification.AbstractRewritesDataSpecification, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spynnaker.pyNN.models.abstract_models.abstract_read_parameters_before_set.AbstractReadParametersBeforeSet

class EXTRA_PROVENANCE_DATA_ENTRIES[source]

Bases: enum.Enum

Entries for the provenance data generated by standard neuron models.

TDMA_MISSED_SLOTS = 0

The number of pre-synaptic events

FAST_RATE_PER_TICK_CUTOFF = 10
PARAMS_BASE_WORDS = 13
class POISSON_SPIKE_SOURCE_REGIONS[source]

Bases: enum.Enum

An enumeration.

POISSON_PARAMS_REGION = 1
PROFILER_REGION = 5
PROVENANCE_REGION = 4
RATES_REGION = 2
SPIKE_HISTORY_REGION = 3
SYSTEM_REGION = 0
TDMA_REGION = 6
PROFILE_TAG_LABELS = {0: 'TIMER', 1: 'PROB_FUNC'}
SEED_OFFSET_BYTES = 36
SEED_SIZE_BYTES = 16
SLOW_RATE_PER_TICK_CUTOFF = 0.01
generate_data_specification(spec, placement, routing_info, data_n_time_steps, graph, first_machine_time_step)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_profile_data(transceiver, placement)[source]

Get the profile data recorded during simulation

Parameters:
Return type:

ProfileData

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering

Returns:The region numbers that have active recording
Return type:iterable(int)
get_recording_region_base_address(txrx, placement)[source]

Get the recording region base address

Parameters:
  • txrx (Transceiver) – the SpiNNMan instance
  • placement (Placement) – the placement object of the core to find the address of
Returns:

the base address of the recording region

Return type:

int

is_in_injection_mode

Whether this vertex is actually in injection mode.

Return type:bool
max_spikes_per_second()[source]

Get maximum expected number of spikes per second

Parameters:variable (str) – the variable to find units from
Returns:the units as a string.
Return type:str
max_spikes_per_ts()[source]

Get maximum expected number of spikes per timestep

Return type:int
parse_extra_provenance_items(label, names, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.
  • names (list(str)) – The base names describing the location of the machine vertex producing the provenance.
  • provenance_data (list(int)) – The list of words of raw provenance data.
Returns:

The interpreted provenance items.

Return type:

iterable(ProvenanceDataItem)

poisson_param_region_address(placement, transceiver)[source]
poisson_rate_region_address(placement, transceiver)[source]
read_parameters_from_machine(transceiver, placement, vertex_slice)[source]

Read the parameters from the machine before any are changed.

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface
  • placement (Placement) – the placement of a vertex
  • vertex_slice (Slice) – the slice of atoms for this vertex
Return type:

None

regenerate_data_specification(spec, placement, routing_info, graph, first_machine_time_step)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded

Parameters:
reload_required(first_machine_time_step)[source]

Return true if any data region needs to be reloaded

Return type:bool
reserve_memory_regions(spec, placement)[source]

Reserve memory regions for Poisson source parameters and output buffer.

Parameters:
Returns:

None

resources_required

The resources required by the vertex

Return type:ResourceContainer
set_reload_required(new_value)[source]

Indicate that the regions have been reloaded

Parameters:new_value – the new value
Return type:None
spynnaker.pyNN.models.spike_source.spike_source_poisson_machine_vertex.get_rates_bytes(vertex_slice, rate_data)[source]

Gets the size of the Poisson rates in bytes

Parameters:vertex_slice (Slice) –
Return type:int

spynnaker.pyNN.models.spike_source.spike_source_poisson_vertex module

class spynnaker.pyNN.models.spike_source.spike_source_poisson_vertex.SpikeSourcePoissonVertex(n_neurons, constraints, label, seed, max_atoms_per_core, model, rate=None, start=None, duration=None, rates=None, starts=None, durations=None, max_rate=None, splitter=None)[source]

Bases: spinn_front_end_common.abstract_models.impl.tdma_aware_application_vertex.TDMAAwareApplicationVertex, spynnaker.pyNN.models.common.abstract_spike_recordable.AbstractSpikeRecordable, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun, spynnaker.pyNN.models.common.simple_population_settable.SimplePopulationSettable, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl, pacman.model.partitioner_interfaces.legacy_partitioner_api.LegacyPartitionerAPI

A Poisson Spike source object

Parameters:
SPIKE_RECORDING_REGION_ID = 0
clear_spike_recording(buffer_manager, placements)[source]

Clear the recorded data from the object

Parameters:
Return type:

None

create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex.

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover.
  • resources_required (ResourceContainer) – The resources used by the machine vertex.
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex.
Returns:

The created machine vertex

Return type:

MachineVertex

describe()[source]

Return a human-readable description of the cell or synapse type.

The output may be customised 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.

Return type:dict(str, ..)
duration
durations
static get_cpu_usage_for_atoms()[source]
static get_dtcm_usage_for_atoms()[source]
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge partition that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_recording_sdram_usage(vertex_slice)[source]
Parameters:vertex_slice (Slice) –
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms.

Parameters:
  • vertex_slice (Slice) – the low value of atoms to calculate resources from
  • vertex_slice
Returns:

a resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource

Return type:

ResourceContainer

get_spikes(placements, buffer_manager)[source]

Get the recorded spikes from the object

Parameters:
Returns:

A numpy array of 2-element arrays of (neuron_id, time) ordered by time, one element per event

Return type:

ndarray(tuple(int,int))

get_spikes_sampling_interval()[source]

Return the current sampling interval for spikes

Returns:Sampling interval in microseconds
Return type:float
is_recording_spikes()[source]

Determine if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
kiss_seed(vertex_slice)[source]
mark_no_changes()[source]

Marks the point after which changes are reported, so that new changes can be detected before the next check.

max_rate
max_spikes_per_ts()[source]
n_atoms

The number of atoms in the vertex

Return type:int
n_profile_samples
rate
rate_change
rates
requires_mapping

True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.

Return type:bool
seed
set_recording_spikes(new_state=True, sampling_interval=None, indexes=None)[source]

Set spikes to being recorded. If new_state is false all other parameters are ignored.

Parameters:
  • new_state (bool) – Set if the spikes are recording or not
  • sampling_interval (int or None) – The interval at which spikes are recorded. Must be a whole multiple of the timestep. None will be taken as the timestep.
  • indexes (list(int) or None) – The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording
set_value(key, value)[source]

Set a property

Parameters:
  • key (str) – the name of the parameter to change
  • value (Any or float or int or list(float) or list(int)) – the new value of the parameter to assign
start
starts
time_to_spike
update_kiss_seed(vertex_slice, seed)[source]

updates a kiss seed from the machine

Parameters:
  • vertex_slice – the vertex slice to update seed of
  • seed – the seed
Return type:

None

Module contents

class spynnaker.pyNN.models.spike_source.SpikeSourceArray(spike_times=None)[source]

Bases: spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel

create_vertex(n_neurons, label, constraints, splitter)[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
Returns:

An application vertex for the population

Return type:

ApplicationVertex

default_population_parameters = {'splitter': None}
class spynnaker.pyNN.models.spike_source.SpikeSourceArrayVertex(n_neurons, spike_times, constraints, label, max_atoms_per_core, model, splitter)[source]

Bases: spinn_front_end_common.utility_models.reverse_ip_tag_multi_cast_source.ReverseIpTagMultiCastSource, spynnaker.pyNN.models.common.abstract_spike_recordable.AbstractSpikeRecordable, spynnaker.pyNN.models.common.simple_population_settable.SimplePopulationSettable, spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

Model for play back of spikes

SPIKE_RECORDING_REGION_ID = 0
clear_spike_recording(buffer_manager, placements)[source]

Clear the recorded data from the object

Parameters:
Return type:

None

describe()[source]

Returns a human-readable description of the cell or synapse type.

The output may be customised 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_spikes(placements, buffer_manager)[source]

Get the recorded spikes from the object

Parameters:
Returns:

A numpy array of 2-element arrays of (neuron_id, time) ordered by time, one element per event

Return type:

ndarray(tuple(int,int))

get_spikes_sampling_interval()[source]

Return the current sampling interval for spikes

Returns:Sampling interval in microseconds
Return type:float
is_recording_spikes()[source]

Determine if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
mark_no_changes()[source]

Marks the point after which changes are reported, so that new changes can be detected before the next check.

requires_mapping

True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.

Return type:bool
set_recording_spikes(new_state=True, sampling_interval=None, indexes=None)[source]

Set spikes to being recorded. If new_state is false all other parameters are ignored.

Parameters:
  • new_state (bool) – Set if the spikes are recording or not
  • sampling_interval (int or None) – The interval at which spikes are recorded. Must be a whole multiple of the timestep. None will be taken as the timestep.
  • indexes (list(int) or None) – The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording
set_value_by_selector(selector, key, value)[source]

Sets the value for a particular key but only for the selected subset.

Parameters:
spike_times

The spike times of the spike source array

class spynnaker.pyNN.models.spike_source.SpikeSourceFromFile(spike_time_file, min_atom=None, max_atom=None, min_time=None, max_time=None, split_value='t')[source]

Bases: spynnaker.pyNN.models.spike_source.spike_source_array.SpikeSourceArray

SpikeSourceArray that works from a file

spike_times
class spynnaker.pyNN.models.spike_source.SpikeSourcePoisson(rate=1.0, start=0, duration=None)[source]

Bases: spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel

create_vertex(n_neurons, label, constraints, seed, max_rate, splitter)[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
Returns:

An application vertex for the population

Return type:

ApplicationVertex

default_population_parameters = {'max_rate': None, 'seed': None, 'splitter': None}
classmethod get_max_atoms_per_core()[source]

Get the maximum number of atoms per core for this model

Return type:int
classmethod set_model_max_atoms_per_core(n_atoms=500)[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
class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonMachineVertex(resources_required, is_recording, constraints=None, label=None, app_vertex=None, vertex_slice=None)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.interface.buffer_management.buffer_models.abstract_receive_buffers_to_host.AbstractReceiveBuffersToHost, spinn_front_end_common.interface.provenance.provides_provenance_data_from_machine_impl.ProvidesProvenanceDataFromMachineImpl, spinn_front_end_common.abstract_models.abstract_supports_database_injection.AbstractSupportsDatabaseInjection, spinn_front_end_common.interface.profiling.abstract_has_profile_data.AbstractHasProfileData, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_rewrites_data_specification.AbstractRewritesDataSpecification, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spynnaker.pyNN.models.abstract_models.abstract_read_parameters_before_set.AbstractReadParametersBeforeSet

class EXTRA_PROVENANCE_DATA_ENTRIES[source]

Bases: enum.Enum

Entries for the provenance data generated by standard neuron models.

TDMA_MISSED_SLOTS = 0

The number of pre-synaptic events

FAST_RATE_PER_TICK_CUTOFF = 10
PARAMS_BASE_WORDS = 13
class POISSON_SPIKE_SOURCE_REGIONS[source]

Bases: enum.Enum

An enumeration.

POISSON_PARAMS_REGION = 1
PROFILER_REGION = 5
PROVENANCE_REGION = 4
RATES_REGION = 2
SPIKE_HISTORY_REGION = 3
SYSTEM_REGION = 0
TDMA_REGION = 6
PROFILE_TAG_LABELS = {0: 'TIMER', 1: 'PROB_FUNC'}
SEED_OFFSET_BYTES = 36
SEED_SIZE_BYTES = 16
SLOW_RATE_PER_TICK_CUTOFF = 0.01
generate_data_specification(spec, placement, routing_info, data_n_time_steps, graph, first_machine_time_step)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_profile_data(transceiver, placement)[source]

Get the profile data recorded during simulation

Parameters:
Return type:

ProfileData

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering

Returns:The region numbers that have active recording
Return type:iterable(int)
get_recording_region_base_address(txrx, placement)[source]

Get the recording region base address

Parameters:
  • txrx (Transceiver) – the SpiNNMan instance
  • placement (Placement) – the placement object of the core to find the address of
Returns:

the base address of the recording region

Return type:

int

is_in_injection_mode

Whether this vertex is actually in injection mode.

Return type:bool
max_spikes_per_second()[source]

Get maximum expected number of spikes per second

Parameters:variable (str) – the variable to find units from
Returns:the units as a string.
Return type:str
max_spikes_per_ts()[source]

Get maximum expected number of spikes per timestep

Return type:int
parse_extra_provenance_items(label, names, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.
  • names (list(str)) – The base names describing the location of the machine vertex producing the provenance.
  • provenance_data (list(int)) – The list of words of raw provenance data.
Returns:

The interpreted provenance items.

Return type:

iterable(ProvenanceDataItem)

poisson_param_region_address(placement, transceiver)[source]
poisson_rate_region_address(placement, transceiver)[source]
read_parameters_from_machine(transceiver, placement, vertex_slice)[source]

Read the parameters from the machine before any are changed.

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface
  • placement (Placement) – the placement of a vertex
  • vertex_slice (Slice) – the slice of atoms for this vertex
Return type:

None

regenerate_data_specification(spec, placement, routing_info, graph, first_machine_time_step)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded

Parameters:
reload_required(first_machine_time_step)[source]

Return true if any data region needs to be reloaded

Return type:bool
reserve_memory_regions(spec, placement)[source]

Reserve memory regions for Poisson source parameters and output buffer.

Parameters:
Returns:

None

resources_required

The resources required by the vertex

Return type:ResourceContainer
set_reload_required(new_value)[source]

Indicate that the regions have been reloaded

Parameters:new_value – the new value
Return type:None
class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonVariable(rates, starts, durations=None)[source]

Bases: spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel

create_vertex(n_neurons, label, constraints, seed, splitter)[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
Returns:

An application vertex for the population

Return type:

ApplicationVertex

default_population_parameters = {'seed': None, 'splitter': None}
classmethod get_max_atoms_per_core()[source]

Get the maximum number of atoms per core for this model

Return type:int
classmethod set_model_max_atoms_per_core(n_atoms=500)[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