spynnaker7.pyNN package

Subpackages

Submodules

spynnaker7.pyNN.spinnaker module

class spynnaker7.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: spynnaker.pyNN.abstract_spinnaker_common.AbstractSpiNNakerCommon, spynnaker7.pyNN.spynnaker7_simulator_interface.Spynnaker7SimulatorInterface

Spinnaker: the main entrance for the spynnaker front end

create_population(size, cellclass, cellparams, structure, label)[source]

creates a pynn 0.75 population

Parameters:
  • size – the number of atoms in this population
  • cellclass – the type of neuron model this pop represents
  • cellparams – the neuron parameters for this population
  • structure – something to do with space
  • label – the human readable label of the population
Returns:

a population instance

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
Returns:

get_distribution_to_stats()[source]
get_pynn_NumpyRNG()[source]

get specfic PyNN version of NumpyRNG :return: NumpyRNG :rtype: NumpyRNG

static get_random_distribution()[source]

Depricated use is_a_pynn_random instead

is_a_pynn_random(thing)[source]

Checks if the thing is a pynn random

The exact definition of a pynn random can or could change between pynn versions so can only be checked against a specific pynn version

Parameters:thing – any object
Returns:True if this object is a pynn random
Trype:bol

spynnaker7.pyNN.spynnaker7_simulator_interface module

class spynnaker7.pyNN.spynnaker7_simulator_interface.Spynnaker7SimulatorInterface[source]

Bases: spynnaker.pyNN.spynnaker_simulator_interface.SpynnakerSimulatorInterface

create_population(size, cellclass, cellparams, structure, label)[source]
create_projection(presynaptic_population, postsynaptic_population, connector, source, target, synapse_dynamics, label, rng)[source]

Module contents

spynnaker7.pyNN.IF_cond_exp

alias of IFCondExpBase

spynnaker7.pyNN.IF_curr_dual_exp

alias of IFCurrDualExpBase

spynnaker7.pyNN.IF_curr_exp

alias of IFCurrExpBase

spynnaker7.pyNN.IZK_curr_exp

alias of IzkCurrExpBase

spynnaker7.pyNN.IZK_cond_exp

alias of IzkCondExpBase

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

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

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

Bases: pacman.model.graphs.application.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

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 this vertex

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run :rtype: spinn_front_end_common.utilities.utility_objs.executable_start_type.ExecutableStartType

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:pacman.model.resources.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 spynnaker7.pyNN.ProjectionApplicationEdge(pre_vertex, post_vertex, synapse_information, label=None)[source]

Bases: pacman.model.graphs.application.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.impl.MachineVertex) – The machine vertex at the start of the edge
  • post_vertex (pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex) – 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.machine_edge.MachineEdge

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

Bases: pacman.model.graphs.application.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, spinn_front_end_common.abstract_models.abstract_changable_after_run.AbstractChangableAfterRun, spynnaker.pyNN.models.abstract_models.abstract_read_parameters_before_set.AbstractReadParametersBeforeSet, spinn_front_end_common.abstract_models.abstract_rewrites_data_specification.AbstractRewritesDataSpecification, spynnaker.pyNN.models.common.simple_population_settable.SimplePopulationSettable, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

A Poisson Spike source object

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

clears the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

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
default_parameters = {'duration': None, 'start': 0.0, 'rate': 1.0}
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.

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 this vertex

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run :rtype: spinn_front_end_common.utilities.utility_objs.executable_start_type.ExecutableStartType

static get_cpu_usage_for_atoms()[source]
static 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:pacman.model.resources.ResourceContainer
Raises:None – this method does not raise any known exception
get_sdram_usage_for_atoms(vertex_slice)[source]

calculates total sdram usage for a set of atoms

Parameters:vertex_slice – the atoms to calculate sdram usage for
Returns:sdram usage as a number of bytes
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.

mark_regions_reloaded()[source]

Indicate that the regions have been reloaded

n_atoms
none_pynn_default_parameters = {'seed': None, 'label': None, 'constraints': None}
rate
read_parameters_from_machine(transceiver, placement, vertex_slice)[source]

Read the parameters from the machine before any are changed

Parameters:
  • transceiver – the SpinnMan interface
  • placement – the placement of a vertex
  • vertex_slice – the slice of atoms for this vertex
regenerate_data_specification(obj, *args, **kwargs)[source]

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

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!

requires_memory_regions_to_be_reloaded()[source]

Return true if any data region needs to be reloaded

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

Reserve memory regions for poisson source parameters and output buffer.

Parameters:
  • spec – the data specification writer
  • placement – the location this vertex resides on in the machine
  • graph_mapper – the mapping between app and machine graphs
Returns:

None

seed
static set_model_max_atoms_per_core(new_value=500)[source]
set_recording_spikes(new_state=True)[source]

Sets spikes to being recorded

set_value(key, value)[source]

Set a property

Parameters:
  • key – the name of the parameter to change
  • value – the new value of the parameter to assign
start
class spynnaker7.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=None, 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, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

Model for play back of spikes

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

clears the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

default_parameters = {'spike_times': 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.

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.

none_pynn_default_parameters = {'tag': None, 'board_address': None, 'label': None, 'spike_recorder_buffer_size': 1048576, 'max_on_chip_memory_usage_for_spikes_in_bytes': 1048576, 'buffer_size_before_receive': 524288, 'space_before_notification': 640, 'ip_address': None, 'port': None, 'constraints': None}
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=9223372036854775807)[source]
set_recording_spikes(new_state=True)[source]

Sets spikes to being recorded

spike_times

The spike times of the spike source array

class spynnaker7.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 spynnaker7.pyNN.AllToAllConnector(weights=0.0, delays=1, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.all_to_all_connector.AllToAllConnector

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.
  • space – a Space object, needed if you wish to specify distance- dependent weights or delays
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose
class spynnaker7.pyNN.FixedNumberPreConnector(n, weights=0.0, delays=1, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_number_pre_connector.FixedNumberPreConnector

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

Parameters:
  • n – number of random pre-synaptic neurons connected to output
  • allow_self_connections – 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.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose
class spynnaker7.pyNN.FixedProbabilityConnector(p_connect, weights=0.0, delays=1, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_probability_connector.FixedProbabilityConnector, pyNN.connectors.FixedProbabilityConnector

For each pair of pre-post cells, the connection probability is
constant.
Parameters:
  • p_connect – a float between zero and one. Each potential connection is created with this probability.
  • allow_self_connections – 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.
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • space – a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented
  • verbose
class spynnaker7.pyNN.FromListConnector(conn_list, safe=True, verbose=False)[source]

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

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.

class spynnaker7.pyNN.FromFileConnector(file, distributed=False, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.from_file_connector.FromFileConnector

get_reader(file)[source]

get a filereader object using the pynn methods

Returns:A pynn StandardTextFile or similar
class spynnaker7.pyNN.MultapseConnector(num_synapses, weights=0.0, delays=1, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.multapse_connector.MultapseConnector

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.
class spynnaker7.pyNN.OneToOneConnector(weights=0.0, delays=1, space=<pyNN.space.Space object>, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.one_to_one_connector.OneToOneConnector

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.

class spynnaker7.pyNN.FixedNumberPostConnector(n, weights=0.0, delays=1, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_number_post_connector.FixedNumberPostConnector

pynn connector that puts a fixed number of connections on each of the post neurons

Parameters:
  • n (int) – number of random post-synaptic neurons connected to output
  • allow_self_connections
  • space – a Space object, needed if you wish to specify distance- dependent weights or delays
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose
  • 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.
class spynnaker7.pyNN.DistanceDependentProbabilityConnector(d_expression, weights=0.0, delays=1, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=False, n_connections=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.distance_dependent_probability_connector.DistanceDependentProbabilityConnector

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.
  • 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.
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • 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.
spynnaker7.pyNN.SynapseDynamics

alias of PyNNSynapseDynamics

spynnaker7.pyNN.STDPMechanism

alias of SynapseDynamicsSTDP

spynnaker7.pyNN.AdditiveWeightDependence

alias of WeightDependenceAdditive

spynnaker7.pyNN.SpikePairRule

alias of TimingDependenceSpikePair

spynnaker7.pyNN.MultiplicativeWeightDependence

alias of WeightDependenceMultiplicative

class spynnaker7.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 spynnaker7.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.

spynnaker7.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 spynnaker7.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 spynnaker7.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 spynnaker7.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 spynnaker7.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 spynnaker7.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 spynnaker7.pyNN.Sphere(radius)[source]

Bases: pyNN.space.Shape

Represents a spherical volume within which neurons may be distributed.

sample(n, rng)[source]
class spynnaker7.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')
spynnaker7.pyNN.end()[source]

Do any necessary cleaning up before exiting.

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

spynnaker7.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 – The timestep in milleseconds. Value will be rounded up to whole microseconds. Set to None to use the value from the config file
  • min_delay – the minumum number of time steps supported for delays
  • max_delay – the maximum number of time steps supported for delays
  • machine – The machine ip address
  • database_socket_addresses – the set of sockets needed to be listened

to for database notification protocol :param n_chips_required: The number of chips required for the simulation :param extra_params: random other crap :rtype: float or None

spynnaker7.pyNN.run(run_time=None)[source]

Run the simulation for run_time ms.

Parameters:run_time – simulation length (in ms)
spynnaker7.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.
spynnaker7.pyNN.num_processes()[source]

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

spynnaker7.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)

spynnaker7.pyNN.reset()[source]

Reset the time to zero, and start the clock.

spynnaker7.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.

Parameters:
  • neuron_type (The string reprensetation of the neuron type) – the neuron type that will have its max atoms set
  • max_permitted (int) – The max amount of atoms to be set
Return type:

None

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

Adds a socket system which is registered with the notification protocol

Parameters:
  • hostname – ip address of host
  • notify_port – port for listeing for when database is set up
  • ack_port – the port for sending back the ack
Return type:

None

spynnaker7.pyNN.Population(size, cellclass, cellparams, structure=None, label=None)[source]

building a new pop

Parameters:
  • size – n neurons
  • cellclass – the neuron class that needs to be created
  • cellparams – the params to put into the neuron model
  • structure
  • label – the human readable label
Returns:

a new population object

spynnaker7.pyNN.Projection(presynaptic_population, postsynaptic_population, connector, source=None, target='excitatory', synapse_dynamics=None, label=None, rng=None)[source]

builds a new projection object

Parameters:
  • presynaptic_population – the source pop
  • postsynaptic_population – the dest pop
  • connector – the connector describing connecitivty
  • source
  • target – type of synapse, exicitiatory or inhibitoary for example.
  • synapse_dynamics – plasticity
  • label – human readable label
  • rng – random number generator if needed
Returns:

a new Projection object

spynnaker7.pyNN.NativeRNG(seed_value)[source]

Fixes the random number generator’s seed :param seed_value: :return:

spynnaker7.pyNN.get_current_time()[source]

returns the machine time step defined in setup :return: the runtime currently

spynnaker7.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.

spynnaker7.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 uS.

spynnaker7.pyNN.get_time_step()[source]

The timestep requested :return:

spynnaker7.pyNN.get_min_delay()[source]

The minimum allowed synaptic delay. :return:

spynnaker7.pyNN.get_max_delay()[source]

The maximum allowed synaptic delay. :return:

spynnaker7.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.

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

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

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

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

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

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

spynnaker7.pyNN.get_machine()[source]

Get the spinnaker machine in use