spynnaker8 package

Subpackages

Submodules

spynnaker8.setup_pynn module

spynnaker8.setup_pynn.install_sPyNNaker8_into(module)[source]

Do the actual installation by creating a package within the given module’s implementation. This is very nasty!

spynnaker8.setup_pynn.version_satisfies(module, requirement)[source]

Perform a version check. This code could be smarter…

spynnaker8.spinnaker module

class spynnaker8.spinnaker.SpiNNaker(database_socket_addresses, extra_algorithm_xml_paths, extra_mapping_inputs, extra_mapping_algorithms, extra_pre_run_algorithms, extra_post_run_algorithms, extra_load_algorithms, time_scale_factor, min_delay, max_delay, graph_label, n_chips_required, timestep=0.1, hostname=None)[source]

Bases: spynnaker.pyNN.abstract_spinnaker_common.AbstractSpiNNakerCommon, pyNN.common.control.BaseState, spynnaker8.spynnaker8_simulator_interface.Spynnaker8SimulatorInterface

Main interface for the sPyNNaker implementation of PyNN 0.8/0.9

clear()[source]

Clear the current recordings and reset the simulation

dt

The machine time step.

Returns:the machine time step
get_distribution_to_stats()[source]
get_pynn_NumpyRNG()[source]
get_random_distribution()[source]
is_a_pynn_random(thing)[source]
mpi_rank

Gets the MPI rank of the simulator

Note

Meaningless on SpiNNaker, so we pretend we’re the head node.

Returns:Constant: 0
name

The name of the simulator. Used to ensure PyNN recording neo blocks are correctly labelled.

Returns:the name of the simulator.
num_processes

Gets the number of MPI worker processes

Note

Meaningless on SpiNNaker, so we pretend there’s one MPI process

Returns:Constant: 1
populations

The list of all populations in the simulation.

Returns:list of populations
projections

The list of all projections in the simulation.

Returns:list of projections
recorders

The recorders, used by the PyNN state object

Returns:the internal recorders object
reset()[source]

Reset the state of the current network to time t = 0.

run(simtime)[source]

Run the simulation for a span of simulation time.

Parameters:simtime – the time to run for, in milliseconds
Returns:None
run_until(tstop)[source]

Run the simulation until the given simulation time.

Parameters:tstop – when to run until in milliseconds
running

Whether the simulation is running or has run.

Note

Ties into our has_ran parameter for automatic pause and resume.

Returns:the has_ran variable from the SpiNNaker main interface
segment_counter

The number of the current recording segment being generated.

Returns:the segment counter
state

Used to bypass the dual level object

Returns:the SpiNNaker object
Return type:spynnaker8.spinnaker.SpiNNaker
t

The current simulation time

Returns:the current runtime already executed
class spynnaker8.spinnaker.Spynnaker8FailedState[source]

Bases: spynnaker.pyNN.utilities.spynnaker_failed_state.SpynnakerFailedState, spynnaker8.spynnaker8_simulator_interface.Spynnaker8SimulatorInterface

dt
static get_generated_output(output)[source]
mpi_rank
name
num_processes
recorders
segment_counter
t
write_on_end

spynnaker8.spynnaker8_simulator_interface module

class spynnaker8.spynnaker8_simulator_interface.Spynnaker8SimulatorInterface[source]

Bases: spynnaker.pyNN.spynnaker_simulator_interface.SpynnakerSimulatorInterface

dt
mpi_rank
name
num_processes
recorders
segment_counter
t

spynnaker8.spynnaker_plotting module

Plotting tools to be used together with https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/utility/plotting.py

class spynnaker8.spynnaker_plotting.SpynnakerPanel(*data, **options)[source]

Bases: object

Represents a single panel in a multi-panel figure.

Compatible with pyNN.utility.plotting’s Frame and can be mixed with pyNN.utility.plotting’s Panel

Unlike pyNN.utility.plotting.Panel, Spikes are plotted faster, other data is plotted as a heatmap

A panel is a Matplotlib Axes or Subplot instance. A data item may be an AnalogSignalArray, or a list of SpikeTrains. The Panel will automatically choose an appropriate representation. Multiple data items may be plotted in the same panel.

Valid options are any valid Matplotlib formatting options that should be applied to the Axes/Subplot, plus in addition:

data_labels:
a list of strings of the same length as the number of data items.
line_properties:
a list of dicts containing Matplotlib formatting options, of the same length as the number of data items.

Whole Neo Objects can be passed in as long as they contain a single Segment/run and only contain one type of data Whole Segments can be passed in only if they only contain one type of data

plot(axes)[source]

Plot the Panel’s data in the provided Axes/Subplot instance.

spynnaker8.spynnaker_plotting.handle_options(ax, options)[source]

Handles options that can not be passed to axes.plot

Removes the ones it has handled

axes.plot will throw an exception if it gets unwanted options

Parameters:
  • ax (matplotlib.axes) – An Axes in a matplot lib figure
  • options – All options the plotter can be configured with
spynnaker8.spynnaker_plotting.heat_plot(ax, neurons, times, values, label='', **options)[source]

Plots three lists of neurons, times and values into a heatmap

Parameters:
  • ax – An Axes in a matplotlib figure
  • neurons – List of neuron IDs
  • times – List of times
  • values – List of values to plot
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.heat_plot_neo(ax, signal_array, label='', **options)[source]

Plots neurons, times and values into a heatmap

Parameters:
  • ax – An Axes in a matplot lib figure
  • signal_array – Neo Signal array Object
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.heat_plot_numpy(ax, data, label='', **options)[source]

Plots neurons, times and values into a heatmap

Parameters:
  • ax – An Axes in a matplot lib figure
  • data – nparray of values in spknakker7 format
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.plot_segment(axes, segment, label='', **options)[source]

Plots a segment into a plot of spikes or a heatmap

If there is more than ode type of Data in the segment options must include the name of the data to plot

Note

method signature defined by pynn plotting. This allows mixing of this plotting tool and pynn’s

Parameters:
  • axes – An Axes in a matplot lib figure
  • segment – Data for one run to plot
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.plot_spikes(ax, spike_times, neurons, label='', **options)[source]

Plots the spikes based on two lists

Parameters:
  • ax – An Axes in a matplot lib figure
  • spike_times – List of Spiketimes
  • neurons – List of Neuron Ids
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.plot_spikes_numpy(ax, spikes, label='', **options)[source]

Plot all spikes

Parameters:
  • ax – An Axes in a matplot lib figure
  • spikes – spynakker7 format nparray of spikes
  • label – Label for the graph
  • options – plotting options
spynnaker8.spynnaker_plotting.plot_spiketrains(ax, spiketrains, label='', **options)[source]

Plot all spike trains in a Segment in a raster plot.

Parameters:
  • ax – An Axes in a matplot lib figure
  • spiketrains – List of spiketimes
  • label – Label for the graph
  • options – plotting options

Module contents

class spynnaker8.Cuboid(width, height, depth)[source]

Bases: pyNN.space.Shape

Represents a cuboidal volume within which neurons may be distributed.

Arguments:
height:
extent in y direction
width:
extent in x direction
depth:
extent in z direction
sample(n, rng)[source]

Return n points distributed randomly with uniform density within the cuboid.

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

Return the Euclidian distance between two cells.

Parameters:
  • 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 multiplied by this quantity).
class spynnaker8.Grid2D(aspect_ratio=1.0, dx=1.0, dy=1.0, x0=0.0, y0=0.0, z=0, fill_order='sequential', rng=None)[source]

Bases: pyNN.space.BaseStructure

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

Arguments:
dx, dy:
distances between points in the x, y directions.
x0, y0:
coordinates of the starting corner of the grid.
z:
the z-coordinate of all points in the grid.
aspect_ratio:
ratio of the number of grid points per side (not the ratio of the side lengths, unless dx == dy)
fill_order:
may be ‘sequential’ or ‘random’
calculate_size(n)[source]

docstring goes here

generate_positions(n)[source]

Calculate and return the positions of n neurons positioned according to this structure.

parameter_names = ('aspect_ratio', 'dx', 'dy', 'x0', 'y0', 'z', 'fill_order')
class spynnaker8.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', rng=None)[source]

Bases: pyNN.space.BaseStructure

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

Arguments:
dx, dy, dz:
distances between points in the x, y, z directions.
x0, y0. z0:
coordinates of the starting corner of the grid.
aspect_ratioXY, aspect_ratioXZ:
ratios of the number of grid points per side (not the ratio of the side lengths, unless dx == dy == dz)
fill_order:
may be ‘sequential’ or ‘random’.

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]

docstring goes here

generate_positions(n)[source]

Calculate and return the positions of n neurons positioned according to this structure.

parameter_names = ('aspect_ratios', 'dx', 'dy', 'dz', 'x0', 'y0', 'z0', 'fill_order')
class spynnaker8.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.

Arguments:
dx:
distance between points in the line.
y, z,:
y- and z-coordinates of all points in the line.
x0:
x-coordinate of the first point in the line.
generate_positions(n)[source]

Calculate and return the positions of n neurons positioned according to this structure.

parameter_names = ('dx', 'x0', 'y', 'z')
class spynnaker8.NumpyRNG(seed=None, parallel_safe=True)[source]

Bases: pyNN.random.WrappedRNG

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

normal_clipped(mu=0.0, sigma=1.0, low=-inf, high=inf, size=None)[source]
normal_clipped_to_boundary(mu=0.0, sigma=1.0, low=-inf, high=inf, size=None)[source]
translations = {'binomial': ('binomial', {'n': 'n', 'p': 'p'}), 'exponential': ('exponential', {'beta': 'scale'}), 'gamma': ('gamma', {'k': 'shape', 'theta': 'scale'}), 'lognormal': ('lognormal', {'mu': 'mean', 'sigma': 'sigma'}), 'normal': ('normal', {'mu': 'loc', 'sigma': 'scale'}), 'normal_clipped': ('normal_clipped', {'mu': 'mu', 'sigma': 'sigma', 'low': 'low', 'high': 'high'}), 'normal_clipped_to_boundary': ('normal_clipped_to_boundary', {'mu': 'mu', 'sigma': 'sigma', 'low': 'low', 'high': 'high'}), 'poisson': ('poisson', {'lambda_': 'lam'}), 'uniform': ('uniform', {'low': 'low', 'high': 'high'}), 'uniform_int': ('randint', {'low': 'low', 'high': 'high'}), 'vonmises': ('vonmises', {'mu': 'mu', 'kappa': 'kappa'})}
class spynnaker8.RandomDistribution(distribution, parameters_pos=None, rng=None, **parameters_named)[source]

Bases: pyNN.random.RandomDistribution

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

Parameters:
  • distribution – the name of a random number distribution.
  • parameters_pos – parameters of the distribution, provided as a tuple. For the correct ordering, see random.available_distributions.
  • rng – the random number generator to use, if a specific one is desired (e.g., to provide a seed). If present, should be a NumpyRNG, GSLRNG or NativeRNG object.
  • parameters_named – parameters of the distribution, provided as keyword arguments.

Parameters may be provided either through parameters_pos or through parameters_named, but not both. All parameters must be provided, there are no default values. Parameter names are, in general, as used in Wikipedia.

Examples:

>>> rd = RandomDistribution('uniform', (-70, -50))
>>> rd = RandomDistribution('normal', mu=0.5, sigma=0.1)
>>> rng = NumpyRNG(seed=8658764)
>>> rd = RandomDistribution('gamma', k=2.0, theta=5.0, rng=rng)
Available distributions
Name Parameters Comments
binomial n, p  
gamma k, theta  
exponential beta  
lognormal mu, sigma  
normal mu, sigma  
normal_clipped mu, sigma, low, high Values outside (low, high) are redrawn
normal_clipped_to_boundary mu, sigma, low, high Values below/above low/high are set to low/high
poisson lambda_ Trailing underscore since lambda is a Python keyword
uniform low, high  
uniform_int low, high Only generates integer values
vonmises mu, kappa  

Create a new RandomDistribution.

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

Arguments:
boundary - a subclass of Shape. origin - the coordinates (x,y,z) of the centre of the volume.
generate_positions(n)[source]

Calculate and return the positions of n neurons positioned according to this structure.

parameter_names = ('boundary', 'origin', 'rng')
class spynnaker8.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.

Arguments:
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 = {'x': [0], 'y': [1], 'z': [2], 'xy': [0, 1], 'yz': [1, 2], 'xz': [0, 2], 'xyz': range(0, 3), None: range(0, 3)}
distance_generator(f, g)[source]
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 spynnaker8.Sphere(radius)[source]

Bases: pyNN.space.Shape

Represents a spherical volume within which neurons may be distributed.

sample(n, rng)[source]

Return n points distributed randomly with uniform density within the sphere.

class spynnaker8.AllToAllConnector(allow_self_connections=True, safe=True, verbose=None, callbacks=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.all_to_all_connector.AllToAllConnector, pyNN.connectors.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.
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • verbose
  • callbacks
class spynnaker8.ArrayConnector(array, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.array_connector.ArrayConnector

Create an array connector.

Parameters:array (integer) – an array of integers
class spynnaker8.CSAConnector(cset, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.csa_connector.CSAConnector

Create an CSA (Connection Set Algebra, Djurfeldt 2012) connector.

Parameters:cset (string) – a connection set description
class spynnaker8.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.distance_dependent_probability_connector.DistanceDependentProbabilityConnector, pyNN.connectors.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.
  • 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.
class spynnaker8.FixedNumberPostConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.fixed_number_post_connector.FixedNumberPostConnector, pyNN.connectors.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 pre-neurons
  • 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.
  • safe (bool) – Whether to check that weights and delays have valid values; if False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • with_replacement (bool) – if False, once a connection is made, it can’t be made again; if True, multiple connections between the same pair of neurons are allowed
  • rng – random number generator
  • callback – list of callbacks to run
class spynnaker8.FixedNumberPreConnector(n, allow_self_connections=True, safe=True, verbose=False, with_replacement=False, rng=None, callback=None)[source]

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

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 post-neurons
  • 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.
  • safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
  • verbose (bool) – Whether to output extra information about the connectivity to a CSV file
  • with_replacement (bool) – if False, once a connection is made, it can’t be made again; if True, multiple connections between the same pair of neurons are allowed
  • rng
  • callback
class spynnaker8.FixedProbabilityConnector(p_connect, allow_self_connections=True, safe=True, verbose=False, rng=None, callback=None)[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 (float) – a number 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
  • rng
  • callback
p_connect
class spynnaker8.FromFileConnector(file, distributed=False, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker8.models.connectors.from_list_connector.FromListConnector, pyNN.connectors.FromFileConnector

get_reader(file)[source]

Get a file reader object using the PyNN methods.

Returns:A pynn StandardTextFile or similar
class spynnaker8.FromListConnector(conn_list, safe=True, verbose=False, column_names=None, callback=None)[source]

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

Make connections according to a list.

Parameters:
  • conn_list – a list of tuples, one tuple for each connection. Each tuple should contain: (pre_idx, post_idx, p1, p2, …, pn) where pre_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, post_idx is the index of the postsynaptic neuron, and p1, p2, etc. are the synaptic parameters (e.g., weight, delay, plasticity parameters).
  • column_names – the names of the parameters p1, p2, etc. If not provided, it is assumed the parameters are weight, delay (for backwards compatibility).
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • callback – if given, a callable that display a progress bar on the terminal.
class spynnaker8.IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.index_based_probability_connector.IndexBasedProbabilityConnector

Create an index-based probability connector. The index_expression must depend on the indices i, j of the populations.

Parameters:
  • index_expression (str) – a function of the indices of the populations An expression
  • allow_self_connections (bool) – allow a neuron to connect to itself
spynnaker8.FixedTotalNumberConnector

alias of spynnaker8.models.connectors.multapse_connector.MultapseConnector

class spynnaker8.OneToOneConnector(safe=True, callback=None)[source]

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

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

Parameters:
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.
  • callback – a function that will be called with the fractional progress of the connection routine. An example would be progress_bar.set_level.
class spynnaker8.SmallWorldConnector(degree, rewiring, allow_self_connections=True, space=<pyNN.space.Space object>, safe=True, verbose=False, n_connections=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.small_world_connector.SmallWorldConnector

class spynnaker8.KernelConnector(shape_pre, shape_post, shape_kernel, weight_kernel=None, delay_kernel=None, shape_common=None, pre_sample_steps=None, pre_start_coords=None, post_sample_steps=None, post_start_coords=None, safe=True, space=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.kernel_connector.KernelConnector

Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, col) neuron to many pre(row, col, kernel) through a (kernel) set of weights and/or delays.

TODO: should these include allow_self_connections and with_replacement?

Parameters:
  • shape_pre – 2D shape of the pre population (rows/height, cols/width, usually the input image shape)
  • shape_post – 2D shape of the post population (rows/height, cols/width)
  • shape_kernel – 2D shape of the kernel (rows/height, cols/width)
  • (optional) (pre/post_start_coords) – 2D matrix of size shape_kernel describing the weights
  • (optional) – 2D matrix of size shape_kernel describing the delays
  • (optional) – 2D shape of common coordinate system (for both pre and post, usually the input image sizes)
  • (optional) – Sampling steps/jumps for pre/post pop <=> (startX, endX, _stepX_) None or 2-item array
  • (optional) – Starting row/col for pre/post sampling <=> (_startX_, endX, stepX) None or 2-item array
spynnaker8.StaticSynapse

alias of spynnaker8.models.synapse_dynamics.synapse_dynamics_static.SynapseDynamicsStatic

spynnaker8.STDPMechanism

alias of spynnaker8.models.synapse_dynamics.synapse_dynamics_stdp.SynapseDynamicsSTDP

spynnaker8.AdditiveWeightDependence

alias of spynnaker8.models.synapse_dynamics.weight_dependence.weight_dependence_additive.WeightDependenceAdditive

spynnaker8.MultiplicativeWeightDependence

alias of spynnaker8.models.synapse_dynamics.weight_dependence.weight_dependence_multiplicative.WeightDependenceMultiplicative

spynnaker8.SpikePairRule

alias of spynnaker8.models.synapse_dynamics.timing_dependence.timing_dependence_spike_pair.TimingDependenceSpikePair

spynnaker8.IF_cond_exp

alias of spynnaker.pyNN.models.neuron.builds.if_cond_exp_base.IFCondExpBase

spynnaker8.IF_curr_exp

alias of spynnaker.pyNN.models.neuron.builds.if_curr_exp_base.IFCurrExpBase

spynnaker8.IF_curr_alpha

alias of spynnaker.pyNN.models.neuron.builds.if_curr_alpha.IFCurrAlpha

spynnaker8.Izhikevich

alias of spynnaker.pyNN.models.neuron.builds.izk_curr_exp_base.IzkCurrExpBase

class spynnaker8.SpikeSourceArray(spike_times=None)[source]

Bases: spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel

create_vertex(n_neurons, label, constraints)[source]

Create a vertex for a population of the model

Parameters:
  • n_neurons (int) – The number of neurons in the population
  • label (str) – The label to give to the vertex
  • constraints (list or None) – A list of constraints to give to the vertex, or None
Returns:

An application vertex for the population

Return type:

pacman.model.graphs.application.ApplicationVertex

default_population_parameters = {}
class spynnaker8.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)[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 or None) – A list of constraints to give to the vertex, or None
Returns:

An application vertex for the population

Return type:

pacman.model.graphs.application.ApplicationVertex

default_population_parameters = {'max_rate': None, 'seed': 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 spynnaker8.Assembly(*populations, **kwargs)[source]

Bases: pyNN.common.populations.Assembly

Create an Assembly of Populations and/or PopulationViews.

class spynnaker8.Population(size, cellclass, cellparams=None, structure=None, initial_values=None, label=None, constraints=None, additional_parameters=None)[source]

Bases: spynnaker.pyNN.models.pynn_population_common.PyNNPopulationCommon, spynnaker8.models.recorder.Recorder, spynnaker8.models.populations.population_base.PopulationBase

PyNN 0.8/0.9 population object

all()[source]

Iterator over cell IDs on all MPI nodes.

all_cells

An array containing the cell IDs of all neurons in the Population (all MPI nodes).

annotations

The annotations given by the end user

can_record(variable)[source]

Determine whether variable can be recorded from this population.

celltype

Implements the PyNN expected celltype property

Returns:The celltype this property has been set to
static create(cellclass, cellparams=None, n=1)[source]

Pass through method to the constructor defined by PyNN. Create n cells all of the same type. Returns a Population object.

Parameters:
  • cellclass – see Population.__init__
  • cellparams – see Population.__init__
  • n – see Population.__init__(size…)
Returns:

A New Population

describe(template='population_default.txt', engine='default')[source]

Returns a human-readable description of the population.

The output may be customized by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

find_units(variable)[source]

Get the units of a variable

Parameters:variable – The name of the variable
Returns:The units of the variable
get(parameter_names, gather=False, simplify=True)[source]

Get the values of a parameter for every local cell in the population.

Parameters:
  • parameter_names – Name of parameter. This is either a single string or a list of strings
  • gather – pointless on sPyNNaker
Returns:

A single list of values (or possibly a single value) if paramter_names is a string, or a dict of these if parameter names is a list.

Return type:

str or list(str) or dict(str,str) or dict(str,list(str))

get_data(variables='all', gather=True, clear=False, annotations=None)[source]

Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.

Parameters:
  • variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
  • gather (bool) –

    Whether to collect data from all MPI nodes or just the current node.

    Note

    This is irrelevant on sPyNNaker, which always behaves as if this parameter is True.

  • clear (bool) – Whether recorded data will be deleted from the Assembly.
  • annotations (dict) – annotations to put on the neo block
Return type:

neo.Block

get_data_by_indexes(variables, indexes, clear=False, annotations=None)[source]

Return a Neo Block containing the data (spikes, state variables) recorded from the Assembly.

Parameters:
  • variables (str or list) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
  • indexes (list (int)) – List of neuron indexes to include in the data. Clearly only neurons recording will actually have any data If None will be taken as all recording as get_data
  • clear (bool) – Whether recorded data will be deleted.
  • annotations (dict) – annotations to put on the neo block
Return type:

neo.Block

get_initial_value(variable, selector=None)[source]

See AbstractPopulationInitializable.get_initial_value

get_initial_values(selector=None)[source]

See AbstractPopulationInitializable.get_initial_values

get_spike_counts(gather=True)[source]

Return the number of spikes for each neuron.

initial_values
initialize(**kwargs)[source]
position_generator

NO PyNN description of this method.

positions

Return the position array for structured populations.

record(variables, to_file=None, sampling_interval=None, indexes=None)[source]

Record the specified variable or variables for all cells in the Population or view.

Parameters:
  • variables (str or list(str)) – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
  • to_file (a Neo IO instance) – a file to automatically record to (optional). write_data() will be automatically called when end() is called.
  • sampling_interval – a value in milliseconds, and an integer multiple of the simulation timestep.
set(**kwargs)[source]

Set one or more parameters for every cell in the population.

param can be a dict, in which case value should not be supplied, or a string giving the parameter name, in which case value is the parameter value. value can be a numeric value, or list of such (e.g. for setting spike times):

p.set("tau_m", 20.0).
p.set({'tau_m':20, 'v_rest':-65})
Parameters:
  • parameter (str or dict) – the parameter to set
  • value – the value of the parameter to set.
set_initial_value(variable, value, selector=None)[source]

See AbstractPopulationInitializable.set_initial_value

spinnaker_get_data(variable)[source]

Public accessor for getting data as a numpy array, instead of the neo based object

Parameters:variable – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
Returns:numpy array of the data
tset(**kwargs)[source]

Deprecated. Use set(parametername=value_array) instead.

write_data(io, variables='all', gather=True, clear=False, annotations=None)[source]

Write recorded data to file, using one of the file formats supported by Neo.

Parameters:
  • io (neo instance or str) – a Neo IO instance, or a string for where to put a neo instance
  • variables (str or list(str)) – either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
  • gather – pointless on sPyNNaker
  • clear – clears the storage data if set to true after reading it back
  • annotations – annotations to put on the neo block
class spynnaker8.PopulationView(parent, selector, label=None)[source]

Bases: spynnaker8.models.populations.population_base.PopulationBase

A view of a subset of neurons within a Population.

In most ways, Populations and PopulationViews have the same behaviour, i.e., they can be recorded, connected with Projections, etc. It should be noted that any changes to neurons in a PopulationView will be reflected in the parent Population and vice versa.

It is possible to have views of views.

Note

Selector to Id is actually handled by AbstractSized.

Parameters:selector

a slice or numpy mask array. The mask array should either be a boolean array (ideally) of the same size as the parent, or an integer array containing cell indices, i.e. if p.size == 5 then:

PopulationView(p, array([False, False, True, False, True]))
PopulationView(p, array([2, 4]))
PopulationView(p, slice(2, 5, 2))

will all create the same view.

all()[source]

Iterator over cell IDs (on all MPI nodes).

all_cells

An array containing the cell IDs of all neurons in the Population (all MPI nodes).

can_record(variable)[source]

Determine whether variable can be recorded from this population.

celltype

The type of neurons making up the Population.

conductance_based

Indicates whether the post-synaptic response is modelled as a change in conductance or a change in current.

describe(template='populationview_default.txt', engine='default')[source]

Returns a human-readable description of the population view.

The output may be customized by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

find_units(variable)[source]

Warning

NO PyNN description of this method.

get(parameter_names, gather=False, simplify=True)[source]

Get the values of the given parameters for every local cell in the population, or, if gather=True, for all cells in the population.

Values will be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).

get_data(variables='all', gather=True, clear=False)[source]

Return a Neo Block containing the data(spikes, state variables) recorded from the Population.

Parameters:
  • variables – Either a single variable name or a list of variable names. Variables must have been previously recorded, otherwise an Exception will be raised.
  • gather

    For parallel simulators, if gather is True, all data will be gathered to all nodes and the Neo Block will contain data from all nodes. Otherwise, the Neo Block will contain only data from the cells simulated on the local node.

    Note

    SpiNNaker always gathers.

  • clear – If True, recorded data will be deleted from the Population.
get_spike_counts(gather=True)[source]

Returns a dict containing the number of spikes for each neuron.

The dict keys are neuron IDs, not indices.

grandparent

Returns the parent Population at the root of the tree (since the immediate parent may itself be a PopulationView).

The name “grandparent” is of course a little misleading, as it could be just the parent, or the great, great, great, …, grandparent.

id_to_index(id)[source]

Given the ID(s) of cell(s) in the PopulationView, return its / their index / indices(order in the PopulationView).

assert pv.id_to_index(pv[3]) == 3

index_in_grandparent(indices)[source]

Given an array of indices, return the indices in the parent population at the root of the tree.

initial_values

A dict containing the initial values of the state variables.

initialize(**initial_values)[source]

Set initial values of state variables, e.g. the membrane potential. Values passed to initialize() may be:

  • single numeric values (all neurons set to the same value), or
  • RandomDistribution objects, or
  • lists / arrays of numbers of the same size as the population mapping functions, where a mapping function accepts a single argument(the cell index) and returns a single number.

Values should be expressed in the standard PyNN units( i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).

Examples:

p.initialize(v=-70.0)
p.initialize(v=rand_distr, gsyn_exc=0.0)
p.initialize(v=lambda i: -65 + i / 10.0)
label

A label for the Population.

mask

The selector mask that was used to create this view.

parent

A reference to the parent Population (that this is a view of).

record(variables, to_file=None, sampling_interval=None)[source]

Record the specified variable or variables for all cells in the Population or view.

Parameters:
  • varables – either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
  • to_file – If specified, should be a Neo IO instance and write_data() will be automatically called when end() is called.
  • sampling_interval – should be a value in milliseconds, and an integer multiple of the simulation timestep.
sample(n, rng=None)[source]

Randomly sample n cells from the Population, and return a PopulationView object.

set(**parameters)[source]

Set one or more parameters for every cell in the population. Values passed to set() may be:

  • single values,
  • RandomDistribution objects, or
  • lists / arrays of values of the same size as the population mapping functions, where a mapping function accepts a single argument (the cell index) and returns a single value.

Here, a “single value” may be either a single number or a list / array of numbers (e.g. for spike times).

Values should be expressed in the standard PyNN units (i.e. millivolts, nanoamps, milliseconds, microsiemens, nanofarads, event per second).

Examples:

p.set(tau_m=20.0, v_rest=-65).
p.set(spike_times=[0.3, 0.7, 0.9, 1.4])
p.set(cm=rand_distr, tau_m=lambda i: 10 + i / 10.0)
size

The total number of neurons in the Population.

write_data(io, variables='all', gather=True, clear=False, annotations=None)[source]

Write recorded data to file, using one of the file formats supported by Neo.

Parameters:
  • io – a Neo IO instance
  • variables – either a single variable name or a list of variable names. These must have been previously recorded, otherwise an Exception will be raised.
  • gather – For parallel simulators, if this is True, all data will be gathered to the master node and a single output file created there. Otherwise, a file will be written on each node, containing only data from the cells simulated on that node.
  • clear – If this is True, recorded data will be deleted from the Population.
  • annotations – should be a dict containing simple data types such as numbers and strings. The contents will be written into the output data file as metadata.
spynnaker8.SpiNNakerProjection

alias of spynnaker8.models.projection.Projection

spynnaker8.end(_=True)[source]

Cleans up the SpiNNaker machine and software

Parameters:_ – was named compatible_output, which we don’t care about, so is a non-existent parameter
Return type:None
spynnaker8.setup(timestep=0.1, min_delay='auto', max_delay='auto', graph_label=None, database_socket_addresses=None, extra_algorithm_xml_paths=None, extra_mapping_inputs=None, extra_mapping_algorithms=None, extra_pre_run_algorithms=None, extra_post_run_algorithms=None, extra_load_algorithms=None, time_scale_factor=None, n_chips_required=None, **extra_params)[source]

The main method needed to be called to make the PyNN 0.8 setup. Needs to be called before any other function

Parameters:
  • timestep – the time step of the simulations
  • min_delay – the min delay of the simulation
  • max_delay – the max delay of the simulation
  • graph_label – the label for the graph
  • database_socket_addresses – the sockets used by external devices for the database notification protocol
  • extra_algorithm_xml_paths – list of paths to where other XML are located
  • extra_mapping_inputs – other inputs used by the mapping process
  • extra_mapping_algorithms – other algorithms to be used by the mapping process
  • extra_pre_run_algorithms – extra algorithms to use before a run
  • extra_post_run_algorithms – extra algorithms to use after a run
  • extra_load_algorithms – extra algorithms to use within the loading phase
  • time_scale_factor – multiplicative factor to the machine time step (does not affect the neuron models accuracy)
  • n_chips_required – The number of chips needed by the simulation
  • extra_params – other stuff
Returns:

rank thing

spynnaker8.run(simtime, callbacks=None)[source]

The run() function advances the simulation for a given number of milliseconds, e.g.:

Parameters:
  • simtime – time to run for (in milliseconds)
  • callbacks – callbacks to run
Returns:

the actual simulation time that the simulation stopped at

spynnaker8.run_until(tstop)[source]

Run until a (simulation) time period has completed.

Parameters:tstop – the time to stop at (in milliseconds)
Returns:the actual simulation time that the simulation stopped at
spynnaker8.run_for(simtime, callbacks=None)

The run() function advances the simulation for a given number of milliseconds, e.g.:

Parameters:
  • simtime – time to run for (in milliseconds)
  • callbacks – callbacks to run
Returns:

the actual simulation time that the simulation stopped at

spynnaker8.num_processes()[source]

The number of MPI processes.

Note

Always 1 on SpiNNaker, which doesn’t use MPI.

Returns:the number of MPI processes
spynnaker8.rank()[source]

The MPI rank of the current node.

Note

Always 0 on SpiNNaker, whcih doesn’t use MPI.

Returns:MPI rank
spynnaker8.reset(annotations=None)[source]

Resets the simulation to t = 0

Parameters:annotations – the annotations to the data objects
Return type:None
spynnaker8.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 – neuron type
  • max_permitted – the number to set to
Return type:

None

spynnaker8.get_projections_data(projection_data)[source]
spynnaker8.Projection(presynaptic_population, postsynaptic_population, connector, synapse_type=None, source=None, receptor_type='excitatory', space=None, label=None)[source]

Used to support PEP 8 spelling correctly

Parameters:
  • presynaptic_population – the source pop
  • postsynaptic_population – the dest pop
  • connector – the connector type
  • synapse_type – the synapse type
  • source – the source
  • receptor_type – the recpetor type
  • space – the space object
  • label – the label
Returns:

a projection object for SpiNNaker

spynnaker8.get_current_time()[source]

Gets the time within the simulation

Returns:returns the current time
spynnaker8.create(cellclass, cellparams=None, n=1)[source]

Builds a population with certain params

Parameters:
  • cellclass – population class
  • cellparams – population params.
  • n – n neurons
Return type:

None

spynnaker8.connect(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, rng=None)[source]

Builds a projection

Parameters:
  • pre – source pop
  • post – destination pop
  • weight – weight of the connections
  • delay – the delay of the connections
  • receptor_type – excitatory / inhibitatory
  • p – probability
  • rng – random number generator
Return type:

None

spynnaker8.get_time_step()[source]

The integration time step

Returns:get the time step of the simulation (in ms)
spynnaker8.get_min_delay()[source]

The minimum allowed synaptic delay; delays will be clamped to be at least this.

Returns:returns the min delay of the simulation
spynnaker8.get_max_delay()[source]

The maximum allowed synaptic delay; delays will be clamped to be at most this.

Returns:returns the max delay of the simulation
spynnaker8.initialize(cells, **initial_values)[source]

Sets cells to be initialised to the given values

Parameters:
  • cells – the cells to change params on
  • initial_values – the params and there values to change
Return type:

None

spynnaker8.list_standard_models()[source]

Return a list of all the StandardCellType classes available for this simulator.

spynnaker8.name()[source]

Returns the name of the simulator

:rtype:None

spynnaker8.num_processes()[source]

The number of MPI processes.

Note

Always 1 on SpiNNaker, which doesn’t use MPI.

Returns:the number of MPI processes
spynnaker8.record(variables, source, filename, sampling_interval=None, annotations=None)[source]

Sets variables to be recorded.

Parameters:
  • variables – may be either a single variable name or a list of variable names. For a given celltype class, celltype.recordable contains a list of variables that can be recorded for that celltype.
  • source – where to record from
  • filename – file name to write data to
  • sampling_interval – how often to sample the recording, not ignored so far
  • annotations – the annotations to data writers
Returns:

neo object

spynnaker8.record_v(source, filename)[source]

Deprecated method for getting voltage. This is not documented in the public facing API.

Parameters:
  • source – the population / view / assembly to record
  • filename – the neo file to write to
Return type:

None

spynnaker8.record_gsyn(source, filename)[source]

Deprecated method for getting both types of gsyn. This is not documented in the public facing API

Parameters:
  • source – the population / view / assembly to record
  • filename – the neo file to write to
Return type:

None