spynnaker.pyNN.utilities.ranged package

Module contents

class spynnaker.pyNN.utilities.ranged.SpynnakerRangedList(size=None, value=None, key=None, use_list_as_value=False)[source]

Bases: RangedList

Adds support for RandomDistribution to RangedList.

Parameters:
  • size (int or None) – Fixed length of the list; if None, the value must be a sized object.

  • value (object or Sized) – value to given to all elements in the list

  • key – The dict key this list covers. This is used only for better Exception messages

  • use_list_as_value (bool) – True if the value is a list

static as_list(value, size, ids=None)[source]

Converts (if required) the value into a list of a given size. An exception is raised if value cannot be given size elements.

Note

This method can be extended to add other conversions to list in which case is_list() must also be extended.

Parameters:

value

Returns:

value as a list

Raises:

Exception – if the number of values and the size do not match

static is_list(value, size)[source]

Determines if the value should be treated as a list.

Note

This method can be extended to add other checks for list in which case as_list() must also be extended.

Parameters:

value – The value to examine.