spynnaker.pyNN package

Subpackages

Submodules

spynnaker.pyNN.exceptions module

spynnaker.pyNN.spinnaker module

class spynnaker.pyNN.spinnaker.Spinnaker(host_name=None, timestep=None, min_delay=None, max_delay=None, graph_label=None, database_socket_addresses=None, n_chips_required=None)[source]

Bases: spinn_front_end_common.interface.spinnaker_main_interface.SpinnakerMainInterface

Spinnaker: the main entrance for the spynnaker front end

add_application_vertex(vertex_to_add)[source]
create_population(size, cellclass, cellparams, structure, label)[source]
create_projection(presynaptic_population, postsynaptic_population, connector, source, target, synapse_dynamics, label, rng)[source]
Parameters:
  • presynaptic_population – source pop this projection goes from
  • postsynaptic_population – dest pop this projection goes to
  • connector – the definition of which neurons connect to each other
  • source
  • target – type of projection
  • synapse_dynamics – plasticity object
  • label – human readable version of the projection
  • rng – the random number generator to use on this projection
Return Projection:
 
max_supported_delay

The maximum supported delay based in milliseconds

min_supported_delay

The minimum supported delay based in milliseconds

run(run_time)[source]

Run the model created

Parameters:run_time – the time in ms to run the simulation for
stop(turn_off_machine=None, clear_routing_tables=None, clear_tags=None)[source]
Parameters:
  • turn_off_machine (bool) – decides if the machine should be powered down after running the execution. Note that this powers down all boards connected to the BMP connections given to the transceiver
  • clear_routing_tables (bool) – informs the tool chain if it should turn off the clearing of the routing tables
  • clear_tags (boolean) – informs the tool chain if it should clear the tags off the machine at stop
Return type:

None

Module contents

The spynnaker.pynn package contains the front-end specifications and implementation for the PyNN High-level API (http://neuralensemble.org/trac/PyNN)

spynnaker.pyNN.IF_cond_exp

alias of IFCondExp

spynnaker.pyNN.IF_curr_dual_exp

alias of IFCurrDualExp

spynnaker.pyNN.IF_curr_exp

alias of IFCurrExp

spynnaker.pyNN.IZK_curr_exp

alias of IzkCurrExp

spynnaker.pyNN.IZK_cond_exp

alias of IzkCondExp

class spynnaker.pyNN.DelayAfferentApplicationEdge(prevertex, delayvertex, label=None)[source]

Bases: pacman.model.graphs.application.impl.application_edge.ApplicationEdge

create_machine_edge(pre_vertex, post_vertex, label)[source]
class spynnaker.pyNN.DelayExtensionVertex(n_neurons, delay_per_stage, source_vertex, machine_time_step, timescale_factor, constraints=None, label='DelayExtension')[source]

Bases: pacman.model.graphs.application.impl.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.abstract_provides_n_keys_for_partition.AbstractProvidesNKeysForPartition, spinn_front_end_common.abstract_models.abstract_binary_uses_simulation_run.AbstractBinaryUsesSimulationRun

Provide delays to incoming spikes in multiples of the maximum delays of a neuron (typically 16 or 32)

Creates a new DelayExtension Object.

add_delays(vertex_slice, source_ids, stages)[source]

Add delayed connections for a given vertex slice

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

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice – The slice of atoms that the machine vertex will cover
  • resources_required – the resources used by the machine vertex
  • constraints – Constraints to be passed on to the machine vertex
generate_data_specification(obj, *args, **kwargs)[source]

Generate a data specification

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for vertices of this vertex

get_cpu_usage_for_atoms(vertex_slice)[source]
get_dtcm_usage_for_atoms(vertex_slice)[source]
get_n_keys_for_partition(partition, graph_mapper)[source]
get_outgoing_partition_constraints(partition)[source]

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

Parameters:partition – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list of pacman.model.constraints.abstract_constraint.AbstractConstraint
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (pacman.model.graph.slice.Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
get_sdram_usage_for_atoms()[source]
n_atoms

The number of atoms in the vertex

Returns:The number of atoms
Return type:int
n_delay_stages

The maximum number of delay stages required by any connection out of this delay extension vertex

source_vertex
write_delay_parameters(spec, vertex_slice, key, incoming_key, incoming_mask, n_vertices, machine_time_step, time_scale_factor)[source]

Generate Delay Parameter data

write_setup_info(spec, machine_time_step, time_scale_factor)[source]
class spynnaker.pyNN.ProjectionApplicationEdge(pre_vertex, post_vertex, synapse_information, label=None)[source]

Bases: pacman.model.graphs.application.impl.application_edge.ApplicationEdge

An edge which terminates on an AbstractPopulationVertex

add_synapse_information(synapse_information)[source]
create_machine_edge(pre_vertex, post_vertex, label)[source]

Create a machine edge between two machine vertices

Parameters:
  • pre_vertex (pacman.model.graph.machine.abstract_machine_vertex.AbstractMachineVertex) – The machine vertex at the start of the edge
  • post_vertex (pacman.model.graph.machine.abstract_machine_vertex.AbstractMachineVertex) – The machine vertex at the end of the edge
  • label (str) – label of the edge
Returns:

The created machine edge

Return type:

pacman.model.graph.machine.abstract_machine_edge.AbstractMachineEdge

delay_edge
n_delay_stages
synapse_information
class spynnaker.pyNN.SpikeSourcePoisson(n_neurons, constraints=None, label='SpikeSourcePoisson', rate=1.0, start=0.0, duration=None, seed=None)[source]

Bases: pacman.model.graphs.application.impl.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spynnaker.pyNN.models.common.abstract_spike_recordable.AbstractSpikeRecordable, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spynnaker.pyNN.models.common.population_settable_change_requires_mapping.PopulationSettableChangeRequiresMapping, spinn_front_end_common.abstract_models.abstract_binary_uses_simulation_run.AbstractBinaryUsesSimulationRun

A Poisson Spike source object

create_machine_vertex(obj, *args, **kwargs)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice – The slice of atoms that the machine vertex will cover
  • resources_required – the resources used by the machine vertex
  • constraints – Constraints to be passed on to the machine vertex
duration
generate_data_specification(obj, *args, **kwargs)[source]

Generate a data specification

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for vertices of this vertex

get_cpu_usage_for_atoms()[source]
get_dtcm_usage_for_atoms()[source]
static get_max_atoms_per_core()[source]
get_outgoing_partition_constraints(partition)[source]

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

Parameters:partition – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list of pacman.model.constraints.abstract_constraint.AbstractConstraint
static get_params_bytes(vertex_slice)[source]

Gets the size of the poisson parameters in bytes

Parameters:vertex_slice
get_resources_used_by_atoms(obj, *args, **kwargs)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (pacman.model.graph.slice.Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
get_sdram_usage_for_atoms(vertex_slice, n_machine_time_steps, machine_time_step)[source]
get_spikes(placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded spikes from the object

Parameters:
  • placements – the placements object
  • graph_mapper – the graph mapper object
  • buffer_manager – the buffer manager object
  • machine_time_step – the time step of the simulation
Returns:

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

is_recording_spikes()[source]

Determines if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
n_atoms
rate
static reserve_memory_regions(spec, poisson_params_sz, vertex)[source]

Reserve memory regions for poisson source parameters and output buffer.

seed
static set_model_max_atoms_per_core(new_value)[source]
set_recording_spikes()[source]

Sets spikes to being recorded

start
class spynnaker.pyNN.SpikeSourceArray(n_neurons, spike_times=None, port=None, tag=None, ip_address=None, board_address=None, max_on_chip_memory_usage_for_spikes_in_bytes=1048576, space_before_notification=640, constraints=None, label='SpikeSourceArray', spike_recorder_buffer_size=1048576, buffer_size_before_receive=524288)[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

Model for play back of spikes

static get_max_atoms_per_core()[source]
get_spikes(placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded spikes from the object

Parameters:
  • placements – the placements object
  • graph_mapper – the graph mapper object
  • buffer_manager – the buffer manager object
  • machine_time_step – the time step of the simulation
Returns:

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

is_recording_spikes()[source]

Determines 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. Immediately after calling this method, requires_mapping should return False.

requires_mapping

True if changes that have been made require that mapping be performed. Note that this should return True the first time it is called, as the vertex must require mapping as it has been created!

static set_model_max_atoms_per_core(new_value)[source]
set_recording_spikes()[source]

Sets spikes to being recorded

spike_times

The spike times of the spike source array

class spynnaker.pyNN.SpikeSourceFromFile(n_neurons, spike_time_file, machine_time_step, timescale_factor, port=None, tag=None, ip_address=None, board_address=None, min_atom=None, max_atom=None, min_time=None, max_time=None, max_on_chip_memory_usage_for_spikes_in_bytes=None, constraints=None, split_value='t', label='SpikeSourceArray')[source]

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

SpikeSourceArray that works from a file

spike_times
class spynnaker.pyNN.AllToAllConnector(weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Connects all cells in the presynaptic population to all cells in the postsynaptic population

Parameters:
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • weights (float) – may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA.
  • delays (float) – – as weights. If None, all synaptic delays will be set to the global minimum delay.
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.FixedNumberPreConnector(n, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Connects a fixed number of pre-synaptic neurons selected at random, to all post-synaptic neurons

Parameters:
  • n (int) – number of random pre-synaptic neurons connected to output
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • weights – may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA.
  • delays – If None, all synaptic delays will be set to the global minimum delay.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.FixedProbabilityConnector(p_connect, weights=0.0, delays=1, allow_self_connections=True, safe=True, space=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

For each pair of pre-post cells, the connection probability is constant.

Parameters:
  • p_connect (float) – a float between zero and one. Each potential connection is created with this probability.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • weights – may either be a float or a !RandomDistribution object. Units nA.
  • delays – If None, all synaptic delays will be set to the global minimum delay.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.FromListConnector(conn_list, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections according to a list.

Param:

conn_list: a list of tuples, one tuple for each connection. Each tuple should contain:

(pre_idx, post_idx, weight, delay)

where pre_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, and post_idx is the index of the postsynaptic neuron.

Creates a new FromListConnector.

CONN_LIST_DTYPE = [('source', 'uint32'), ('target', 'uint32'), ('weight', 'float64'), ('delay', 'float64')]
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.FromFileConnector(file, distributed=False, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.from_list_connector.FromListConnector

class spynnaker.pyNN.MultapseConnector(num_synapses, weights=0.0, delays=1, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Create a multapse connector. The size of the source and destination populations are obtained when the projection is connected. The number of synapses is specified. when instantiated, the required number of synapses is created by selecting at random from the source and target populations with replacement. Uniform selection probability is assumed.

Parameters:
  • num_synapses – Integer. This is the total number of synapses in the connection.
  • weights – may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA.
  • delays – as weights. If None, all synaptic delays will be set to the global minimum delay.

Creates a new connector.

create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.OneToOneConnector(weights=0.0, delays=1, space=None, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Where the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic pynn_population.py to cell i in the postsynaptic pynn_population.py for all i.

Parameters:
  • weights – may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA.
  • delays – as weights. If None, all synaptic delays will be set to the global minimum delay.
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.FixedNumberPostConnector(n, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
class spynnaker.pyNN.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, weights=0.0, delays=1, space=<pyNN.space.Space object>, safe=True, verbose=False, n_connections=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a distribution which varies with distance.

Parameters:
  • d_expression (string) – the right-hand side of a valid python expression for probability, involving ‘d’, e.g. “exp(-abs(d))”, or “d<3”, that can be parsed by eval(), that computes the distance dependent distribution
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • weights (float) – may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created, or a distance dependence as per a d_expression. Units nA.
  • delays (float) – – as weights. If None, all synaptic delays will be set to the global minimum delay.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance- dependent weights or delays
  • n_connections (int) – The number of efferent synaptic connections per neuron.
create_synaptic_block(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]
generate_on_machine()[source]
get_delay_maximum()[source]
get_delay_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_n_connections_from_pre_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, min_delay=None, max_delay=None)[source]
get_n_connections_to_post_vertex_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_maximum(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_mean(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
get_weight_variance(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice)[source]
spynnaker.pyNN.SynapseDynamics

alias of PyNNSynapseDynamics

spynnaker.pyNN.STDPMechanism

alias of SynapseDynamicsSTDP

spynnaker.pyNN.AdditiveWeightDependence

alias of WeightDependenceAdditive

spynnaker.pyNN.SpikePairRule

alias of TimingDependenceSpikePair

spynnaker.pyNN.MultiplicativeWeightDependence

alias of WeightDependenceMultiplicative

spynnaker.pyNN.PfisterSpikeTripletRule

alias of TimingDependencePfisterSpikeTriplet

class spynnaker.pyNN.NumpyRNG(seed=None, parallel_safe=True)[source]

Bases: pyNN.random.WrappedRNG

Wrapper for the numpy.random.RandomState class (Mersenne Twister PRNG).

describe()[source]
class spynnaker.pyNN.RandomDistribution(distribution='uniform', parameters=[], rng=None, boundaries=None, constrain='clip')[source]

Bases: object

Class which defines a next(n) method which returns an array of n random numbers from a given distribution.

If present, rng should be a NumpyRNG or GSLRNG object. distribution should be the name of a method supported by the underlying

random number generator object.
parameters should be a list or tuple containing the arguments expected
by the underlying method in the correct order. named arguments are not yet supported.
boundaries is a tuple (min, max) used to specify explicitly, for distribution
like Gaussian, Gamma or others, hard boundaries for the parameters. If parameters are drawn outside those boundaries, the policy applied will depend on the constrain parameter.
constrain control the policy for weights out of the specified boundaries.
If “clip”, random numbers are clipped to the boundaries. If “redraw”, random numbers are drawn till they fall within the boundaries.
Note that NumpyRNG and GSLRNG distributions may not have the same names,
e.g., ‘normal’ for NumpyRNG and ‘gaussian’ for GSLRNG, and the arguments may also differ.
next(n=1, mask_local=None)[source]

Return n random numbers from the distribution.

spynnaker.pyNN.distance(src, tgt, mask=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None)[source]

Return the Euclidian distance between two cells. mask allows only certain dimensions to be considered, e.g.:

* to ignore the z-dimension, use `mask=array([0,1])`
* to ignore y, `mask=array([0,2])`
* to just consider z-distance, `mask=array([2])`

scale_factor allows for different units in the pre- and post- position (the post-synaptic position is multipied by this quantity).

class spynnaker.pyNN.Space(axes=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None)[source]

Bases: object

Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.

axes – if not supplied, then the 3D distance is calculated. If supplied,
axes should be a string containing the axes to be used, e.g. ‘x’, or ‘yz’. axes=’xyz’ is the same as axes=None.
scale_factor – it may be that the pre and post populations use
different units for position, e.g. degrees and µm. In this case, scale_factor can be specified, which is applied to the positions in the post-synaptic population.
offset – if the origins of the coordinate systems of the pre- and post-
synaptic populations are different, offset can be used to adjust for this difference. The offset is applied before any scaling.
periodic_boundaries – either None, or a tuple giving the boundaries
for each dimension, e.g. ((x_min, x_max), None, (z_min, z_max)).
AXES = {'xz': [0, 2], 'yz': [1, 2], 'xy': [0, 1], 'y': [1], 'x': [0], 'xyz': [0, 1, 2], 'z': [2], None: [0, 1, 2]}
distance_generator(f, g)[source]

Return a function that calculates the distance matrix as a function of indices i,j, given two functions f(i) and g(j) that return coordinates.

distances(A, B, expand=False)[source]

Calculate the distance matrix between two sets of coordinates, given the topology of the current space. From http://projects.scipy.org/pipermail/numpy-discussion/2007-April/027203.html

class spynnaker.pyNN.Line(dx=1.0, x0=0.0, y=0.0, z=0.0)[source]

Bases: pyNN.space.BaseStructure

Represents a structure with neurons distributed evenly on a straight line.

generate_positions(n)[source]
parameter_names = ('dx', 'x0', 'y', 'z')
class spynnaker.pyNN.Grid2D(aspect_ratio=1.0, dx=1.0, dy=1.0, x0=0.0, y0=0.0, z=0, fill_order='sequential')[source]

Bases: pyNN.space.BaseStructure

Represents a structure with neurons distributed on a 2D grid.

aspect_ratio - ratio of the number of grid points per side (not the ratio
of the side lengths, unless dx == dy)
calculate_size(n)[source]
generate_positions(n)[source]
parameter_names = ('aspect_ratio', 'dx', 'dy', 'x0', 'y0', 'fill_order')
class spynnaker.pyNN.Grid3D(aspect_ratioXY=1.0, aspect_ratioXZ=1.0, dx=1.0, dy=1.0, dz=1.0, x0=0.0, y0=0.0, z0=0, fill_order='sequential')[source]

Bases: pyNN.space.BaseStructure

Represents a structure with neurons distributed on a 3D grid.

If fill_order is ‘sequential’, the z-index will be filled first, then y then x, i.e. the first cell will be at (0,0,0) (given default values for the other arguments), the second at (0,0,1), etc.

calculate_size(n)[source]
generate_positions(n)[source]
parameter_names = ('aspect_ratios', 'dx', 'dy', 'dz', 'x0', 'y0', 'z0', 'fill_order')
class spynnaker.pyNN.Cuboid(width, height, depth)[source]

Bases: pyNN.space.Shape

Represents a cuboidal volume within which neurons may be distributed.

height: extent in y direction width: extent in x direction depth: extent in z direction

sample(n, rng)[source]
class spynnaker.pyNN.Sphere(radius)[source]

Bases: pyNN.space.Shape

Represents a spherical volume within which neurons may be distributed.

sample(n, rng)[source]
class spynnaker.pyNN.RandomStructure(boundary, origin=(0.0, 0.0, 0.0), rng=None)[source]

Bases: pyNN.space.BaseStructure

Represents a structure with neurons distributed randomly within a given volume.

boundary - a subclass of Shape origin - the coordinates (x,y,z) of the centre of the volume.

generate_positions(n)[source]
parameter_names = ('boundary', 'origin', 'rng')
spynnaker.pyNN.register_binary_search_path(search_path)[source]

Registers an additional binary search path for executables

Parameters:search_path – absolute search path for binaries
spynnaker.pyNN.end()[source]

Do any necessary cleaning up before exiting.

Unregisters the controller, prints any data recorded using the low-level API

spynnaker.pyNN.setup(timestep=0.1, min_delay=None, max_delay=None, machine=None, database_socket_addresses=None, n_chips_required=None, **extra_params)[source]
Should be called at the very beginning of a script.
extra_params contains any keyword arguments that are required by a given simulator but not by others.
Parameters:
  • machine – A SpiNNaker machine used to run the simulation.
  • timestep
  • min_delay
  • max_delay
  • machine
  • database_socket_addresses
  • n_chips_required – The number of chips required for the simulation
  • extra_params
spynnaker.pyNN.run(run_time=None)[source]

Run the simulation for run_time ms.

Parameters:run_time – simulation length (in ms)
spynnaker.pyNN.get_spynnaker()[source]

helper method for other plugins to add stuff to the graph

Returns:The current spinnaker API, or None if before setup or after end.
spynnaker.pyNN.num_processes()[source]

Return the number of MPI processes (not used for SpiNNaker, always returns 1)

spynnaker.pyNN.rank()[source]

Return the MPI rank of the current node. (not used for SpiNNaker, always returns 0 - as this is the minimum rank suggesting the front node)

spynnaker.pyNN.reset()[source]

Reset the time to zero, and start the clock.

spynnaker.pyNN.set_number_of_neurons_per_core(neuron_type, max_permitted)[source]

Sets a ceiling on the number of neurons of a given type that can be placed on a single core.

spynnaker.pyNN.register_database_notification_request(hostname, notify_port, ack_port)[source]

Adds a socket system which is registered with the notification protocol

spynnaker.pyNN.Population(size, cellclass, cellparams, structure=None, label=None)[source]
spynnaker.pyNN.Projection(presynaptic_population, postsynaptic_population, connector, source=None, target='excitatory', synapse_dynamics=None, label=None, rng=None)[source]
spynnaker.pyNN.NativeRNG(seed_value)[source]

Fixes the random number generator’s seed

spynnaker.pyNN.get_current_time()[source]

returns the machine time step defined in setup

spynnaker.pyNN.create(cellclass, cellparams=None, n=1)[source]

Create n cells all of the same type.

If n > 1, return a list of cell ids/references. If n==1, return just the single id.

spynnaker.pyNN.connect(source, target, weight=0.0, delay=None, synapse_type='excitatory', p=1, rng=None)[source]

Connect a source of spikes to a synaptic target.

source and target can both be individual cells or lists of cells, in which case all possible connections are made with probability p, using either the random number generator supplied, or the default rng otherwise. Weights should be in nA or µS.

spynnaker.pyNN.get_time_step()[source]

The timestep requested

spynnaker.pyNN.get_min_delay()[source]

The minimum allowed synaptic delay.

spynnaker.pyNN.get_max_delay()[source]

The maximum allowed synaptic delay.

spynnaker.pyNN.set(cells, param, val=None)[source]

Set one or more parameters of an individual cell or list of cells.

param can be a dict, in which case val should not be supplied, or a string giving the parameter name, in which case val is the parameter value.

spynnaker.pyNN.initialize(cells, variable, value)[source]
spynnaker.pyNN.record(source, filename)[source]

Record spikes to a file. source should be a Population.

spynnaker.pyNN.record_v(source, filename)[source]

Record spikes to a file. source should be a Population.

spynnaker.pyNN.record_gsyn(source, filename)[source]

Record spikes to a file. source should be a Population.

spynnaker.pyNN.get_machine()[source]

Get the spinnaker machine in use