Skip to content

Commit 2d6a298

Browse files
authored
Merge pull request #1579 from SpiNNakerManchester/astype
astype can not be generic
2 parents ee1d2a9 + c280b48 commit 2d6a298

5 files changed

Lines changed: 9 additions & 7 deletions

File tree

spynnaker/pyNN/models/neural_projections/connectors/convolution_connector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ def get_post_shape(self, shape: Tuple[int, ...]) -> Tuple[int, ...]:
295295
(2 * self.__padding_shape))
296296

297297
return tuple(int(i) for i in numpy.clip(
298-
post_shape // self.__strides, 1, numpy.inf).astype(integer))
298+
post_shape // self.__strides, 1, numpy.inf).astype(
299+
numpy.uint32))
299300

300301
@overrides(AbstractConnector.validate_connection)
301302
def validate_connection(

spynnaker/pyNN/models/neural_projections/connectors/small_world_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _set_n_connections(self, synapse_info: SynapseInformation) -> None:
129129
else:
130130
d = distances
131131

132-
self.__mask = (d < self.__degree).astype(float)
132+
self.__mask = (d < self.__degree).astype(numpy.float64)
133133
self.__n_connections = int(math.ceil(numpy.sum(self.__mask)))
134134

135135
@overrides(AbstractConnector.get_delay_maximum)

spynnaker/pyNN/models/spike_source/spike_source_poisson_machine_vertex.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,8 @@ def read_connections(
625625
addr += SDRAM_EDGE_PARAMS_BASE_BYTES
626626
data = SpynnakerDataView().read_memory(
627627
placement.x, placement.y, addr, size)
628-
weights_encoded = numpy.frombuffer(data, dtype=uint16).astype(float)
628+
weights_encoded = numpy.frombuffer(data, dtype=uint16).astype(
629+
numpy.float64)
629630
weight_scales = (
630631
next(iter(cast(AbstractEdgePartition,
631632
self.__sdram_partition).edges))

spynnaker/spynnaker_plotting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ def heat_plot_numpy(axes: Axes, data: NDArray, label: str = '',
160160
:param str label: Label for the graph
161161
:param options: plotting options
162162
"""
163-
neurons = data[:, 0].astype(int)
164-
times = data[:, 1].astype(int)
163+
neurons = data[:, 0].astype(np.uint32)
164+
times = data[:, 1].astype(np.uint32)
165165
values = data[:, 2]
166-
info_array = np.empty((max(neurons) + 1, max(times) + 1))
166+
info_array = np.empty((neurons.max() + 1, times.max() + 1))
167167
info_array[:] = np.nan
168168
info_array[neurons, times] = values
169169
_heat_plot(axes, info_array, label=label, **options)

spynnaker_integration_tests/test_spike_source/test_poisson_spike_source_sdram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def check_rate(
4848
for i in range(n_neurons):
4949
times, counts = numpy.unique(
5050
spikes[i].magnitude, return_counts=True)
51-
times = times.astype(int)
51+
times = times.astype(numpy.uint32)
5252
indices = numpy.where(times < runtime - 2)[0]
5353
times = times[indices]
5454
counts = counts[indices]

0 commit comments

Comments
 (0)