Skip to content

Commit 9935975

Browse files
authored
Merge branch 'master' into allow_extra_synapse_data
2 parents 5a6ca1a + be432e5 commit 9935975

File tree

137 files changed

+1152
-792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1152
-792
lines changed

spynnaker/pyNN/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ def distance(src_cell: IDMixin, tgt_cell: IDMixin,
239239
periodic_boundaries: Optional[Tuple[
240240
Optional[Tuple[int, int]]]] = None) -> float:
241241
"""
242-
Return the Euclidean distance between two cells.
243-
244242
:param src_cell: Measure from this cell
245243
:param tgt_cell: To this cell
246244
:param mask:
@@ -254,6 +252,7 @@ def distance(src_cell: IDMixin, tgt_cell: IDMixin,
254252
(the post-synaptic position is multiplied by this quantity).
255253
:param offset:
256254
:param periodic_boundaries:
255+
:returns: The Euclidean distance between two cells.
257256
"""
258257
return _pynn_distance(
259258
src_cell, tgt_cell, mask, scale_factor, offset, periodic_boundaries)
@@ -348,7 +347,7 @@ def setup(timestep: Optional[Union[float, Literal["auto"]]] = None,
348347

349348
def name() -> str:
350349
"""
351-
Returns the name of the simulator.
350+
:returns: The name of the simulator.
352351
"""
353352
return SpynnakerDataView.get_sim_name()
354353

@@ -437,8 +436,8 @@ def end(_: Any = True) -> None:
437436

438437
def list_standard_models() -> List[str]:
439438
"""
440-
Return a list of all the StandardCellType classes available for this
441-
simulator.
439+
:returns: A list of all the StandardCellType classes available for this
440+
simulator.
442441
"""
443442
return [
444443
key
@@ -547,6 +546,7 @@ def create(
547546
:param cellclass: population class
548547
:param cellparams: population parameters.
549548
:param n: number of neurons
549+
:returns: A new Population
550550
"""
551551
SpynnakerDataView.check_user_can_act()
552552
return __pynn["create"](cellclass, cellparams, n)
@@ -591,6 +591,7 @@ def get_max_delay() -> int:
591591
Most likely value is timestep * 144
592592
593593
:raises NotImplementedError: As there is no system wide max_delay
594+
:returns: In SpyNNaker this method never returns
594595
"""
595596
raise NotImplementedError(
596597
"sPyNNaker does not have a system wide max_delay")

spynnaker/pyNN/config_setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,8 @@ def cfg_paths_skipped() -> Set[str]:
7474
Set of cfg path that would not be found based on other cfg settings
7575
7676
Assuming mode = Debug
77+
78+
:returns:
79+
List of cfg Option names that point to paths unlikely to be used.
7780
"""
7881
return fec_cfg_paths_skipped()

spynnaker/pyNN/connections/spif_live_spikes_connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ def __init__(self, receive_labels: Optional[Iterable[str]],
135135

136136
def add_receive_label(self, label: str) -> None:
137137
"""
138+
Adds this labels to the callbacks.
139+
138140
:param label:
139141
"""
140142
if label not in self.__receive_labels:

spynnaker/pyNN/connections/spynnaker_poisson_control_connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def __init__(
7474

7575
def add_poisson_label(self, label: str) -> None:
7676
"""
77+
Adds a send label.
78+
7779
:param label: The label of the Poisson source population.
7880
"""
7981
control = self.__convert_to_control_label(label)

spynnaker/pyNN/data/spynnaker_data_view.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def get_min_delay(cls) -> float:
109109
Typically `simulation_time_step_per_ms` but may be a positive multiple
110110
of it.
111111
112+
:returns: the minimum delay in milliseconds.
112113
:raises ~spinn_utilities.exceptions.SpiNNUtilsException:
113114
If the min_delay is currently unavailable
114115
"""
@@ -120,6 +121,10 @@ def get_min_delay(cls) -> float:
120121
def has_min_delay(cls) -> bool:
121122
"""
122123
Report if there is a minimum supported delay available.
124+
125+
If there is no delay time step could be used.
126+
127+
:returns: True if get_min_delay method will work
123128
"""
124129
if cls.__spy_data._min_delay is not None:
125130
return True
@@ -133,13 +138,15 @@ def iterate_projections(cls) -> Iterator[Projection]:
133138
The iteration will be empty if no projections added.
134139
135140
Note: This method is backed by a set so does not guarantee order
141+
142+
:returns: Unordered iterator of projections.
136143
"""
137144
return iter(cls.__spy_data._projections)
138145

139146
@classmethod
140147
def get_n_projections(cls) -> int:
141148
"""
142-
The number of projections previously added.
149+
:returns: The number of projections previously added.
143150
"""
144151
return len(cls.__spy_data._projections)
145152

@@ -174,13 +181,15 @@ def iterate_populations(cls) -> Iterator[Population]:
174181
The iteration will be empty if no populations added.
175182
176183
Note: This method is backed by a set so does not guarantee order
184+
185+
:returns: Unordered iterator of Populations
177186
"""
178187
return iter(cls.__spy_data._populations)
179188

180189
@classmethod
181190
def get_n_populations(cls) -> int:
182191
"""
183-
The number of populations previously added.
192+
:returns: The number of populations previously added.
184193
"""
185194
return len(cls.__spy_data._populations)
186195

@@ -221,6 +230,6 @@ def add_population(cls, population: Population) -> Tuple[int, int]:
221230
@classmethod
222231
def get_sim_name(cls) -> str:
223232
"""
224-
Gets the name to be returned by `pyNN.spiNNaker.name`.
233+
:returns: The name to be returned by `pyNN.spiNNaker.name`.
225234
"""
226235
return _version.NAME

spynnaker/pyNN/data/spynnaker_data_writer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def set_up_timings_and_delay(
6262
time_scale_factor: Optional[float],
6363
min_delay: Optional[Union[int, float]]) -> None:
6464
"""
65+
Setup the timings and delays for the simulation
66+
6567
:param simulation_time_step_us:
6668
An explicitly specified time step for the simulation in
6769
microseconds.
@@ -73,7 +75,6 @@ def set_up_timings_and_delay(
7375
new value or `None` to say use simulation_time_step_ms
7476
"""
7577
try:
76-
7778
# If there isn't a time scale factor given, try to work it out
7879
# on the basis that we can do 0.1ms steps in real time
7980
if time_scale_factor is None:

spynnaker/pyNN/external_devices_models/abstract_ethernet_controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@ class AbstractEthernetController(object, metaclass=AbstractBase):
3131
@abstractmethod
3232
def get_message_translator(self) -> AbstractEthernetTranslator:
3333
"""
34-
Get the translator of messages.
34+
:returns: The translator of messages.
3535
"""
3636
raise NotImplementedError
3737

3838
@abstractmethod
3939
def get_external_devices(self) -> Iterable[
4040
AbstractMulticastControllableDevice]:
4141
"""
42-
Get the external devices that are to be controlled by the controller.
42+
:returns:
43+
The external devices that are to be controlled by the controller.
4344
"""
4445
raise NotImplementedError
4546

4647
@abstractmethod
4748
def get_outgoing_partition_ids(self) -> List[str]:
4849
"""
49-
Get the partition IDs of messages coming out of the controller.
50+
:returns: The partition IDs of messages coming out of the controller.
5051
"""
5152
raise NotImplementedError

spynnaker/pyNN/external_devices_models/abstract_ethernet_sensor.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,36 @@ class AbstractEthernetSensor(object, metaclass=AbstractBase):
3030
@abstractmethod
3131
def get_n_neurons(self) -> int:
3232
"""
33-
Get the number of neurons that will be sent out by the device.
33+
:returns: The number of neurons that will be sent out by the device.
3434
"""
3535
raise NotImplementedError
3636

3737
@abstractmethod
3838
def get_injector_parameters(self) -> Dict[str, Any]:
3939
"""
40-
Get the parameters of the Spike Injector to use with this device.
40+
:returns:
41+
The parameters of the Spike Injector to use with this device.
4142
"""
4243
raise NotImplementedError
4344

4445
@abstractmethod
4546
def get_injector_label(self) -> str:
4647
"""
47-
Get the label to give to the Spike Injector.
48+
:returns: the label to give to the Spike Injector.
4849
"""
4950
raise NotImplementedError
5051

5152
@abstractmethod
5253
def get_translator(self) -> AbstractEthernetTranslator:
5354
"""
54-
Get a translator of multicast commands to Ethernet commands.
55+
:returns: A translator of multicast commands to Ethernet commands.
5556
"""
5657
raise NotImplementedError
5758

5859
@abstractmethod
5960
def get_database_connection(self) -> SpynnakerLiveSpikesConnection:
6061
"""
61-
Get a Database Connection instance that this device uses to inject
62-
packets.
62+
:returns: A Database Connection instance that this device uses to
63+
inject packets.
6364
"""
6465
raise NotImplementedError

spynnaker/pyNN/external_devices_models/arbitrary_fpga_device.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ def __init__(
3232
chip_coords: Optional[XY] = None, label: Optional[str] = None):
3333
"""
3434
:param n_neurons: Number of neurons
35-
:param fpga_link_id:
36-
:param fpga_id:
37-
:param board_address:
38-
:param chip_coords:
39-
:param label:
35+
:param fpga_link_id: The ID of the link of the FPGA (0-15)
36+
:param fpga_id: The ID of the FPGA on the board (0, 1 or 2)
37+
:param board_address: The IP address of the board with the FPGA,
38+
or None for the default board or if using chip_coords
39+
:param chip_coords: The coordinates of the chip connected to the FPGA,
40+
or None for the default board or if using board_address
41+
:param label: The optional name of the vertex.
4042
"""
4143
conn = FPGAConnection(
4244
fpga_id, fpga_link_id, board_address, chip_coords)

spynnaker/pyNN/external_devices_models/external_spinnaker_link_fpga_retina_device.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def get_y_from_fpga_retina(key: int, mode: int) -> Optional[int]:
2626
"""
2727
:param key:
2828
:param mode:
29+
:returns: y value if mode is expected otherwise None.
2930
"""
3031
if mode == 128:
3132
return key & 0x7f
@@ -42,6 +43,7 @@ def get_x_from_fpga_retina(key: int, mode: int) -> Optional[int]:
4243
"""
4344
:param key:
4445
:param mode:
46+
:returns: x value if mode is expected otherwise None.
4547
"""
4648
if mode == 128:
4749
return (key >> 7) & 0x7f
@@ -58,6 +60,7 @@ def get_spike_value_from_fpga_retina(key: int, mode: int) -> Optional[int]:
5860
"""
5961
:param key:
6062
:param mode:
63+
:returns: Spike value if mode is expected otherwise None.
6164
"""
6265
if mode == 128:
6366
return (key >> 14) & 0x1
@@ -98,7 +101,7 @@ def __init__(
98101
:param spinnaker_link_id:
99102
The SpiNNaker link to which the retina is connected
100103
:param polarity: The "polarity" of the retina data
101-
:param label:
104+
:param label: The optional name of the vertex.
102105
:param board_address:
103106
"""
104107
fixed_n_neurons = self.get_n_neurons(mode, polarity)
@@ -133,8 +136,13 @@ def _get_mask(self, mode: str) -> int:
133136
@staticmethod
134137
def get_n_neurons(mode: str, polarity: str) -> int:
135138
"""
139+
Calculate the number of neurons based on mode and polarity
140+
136141
:param mode: ``128`` or ``64`` or ``32`` or ``16``
142+
:param polarity: ``UP`` or ``DOWN``
143+
:returns: The number of neurons in the retina
137144
"""
145+
# Uses mode and polarity to determine the number of neurons needed
138146
if mode == ExternalFPGARetinaDevice.MODE_128:
139147
if (polarity == ExternalFPGARetinaDevice.UP_POLARITY or
140148
polarity == ExternalFPGARetinaDevice.DOWN_POLARITY):

0 commit comments

Comments
 (0)