spynnaker.pyNN.utilities.ranged package¶
Module contents¶
- class spynnaker.pyNN.utilities.ranged.SpynnakerRangedList(size: int | None = None, value: T | Callable[[int], T] | Sequence[T] | None = None, key=None, use_list_as_value=False)¶
Bases:
RangedListAdds support for
RandomDistributiontoRangedList.- Parameters:
- as_list(value: Callable[[int], T] | Sequence[T] | RandomDistribution, size: int, ids: Sequence[int] | ndarray[Any, dtype[integer]] | None = None) List[T][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
listness_check()must also be extended.- Parameters:
value
- Returns:
value as a list
- Raises:
Exception – if the number of values and the size do not match
- listness_check(value: T | Callable[[int], T] | Sequence[T] | RandomDistribution | None) bool[source]¶
Easier to override in subclasses as not type guard.
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.