Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #91 from SpiNNakerManchester/numpy_fix
Browse files Browse the repository at this point in the history
kapow
  • Loading branch information
alan-stokes committed Nov 16, 2020
2 parents 5e4c3fc + d2696c4 commit 9b24c09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data_specification/enums/data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,10 @@ def encode_as_int(self, value):
:rtype: int
"""
if self._apply_scale:
# Deal with the cases that return np.int64 (e.g. RandomDistribution
# when using 'poisson', 'binomial' etc.)
if type(value) is np.int64:
# Deal with the cases that return np.int64 or np.int32
# (e.g. RandomDistribution when using 'poisson', 'binomial' etc.)
# The less than raises TypeError even with int32 on some numpy
if isinstance(value, np.integer):
value = int(value)
if not (self._min <= value <= self._max):
raise ValueError(
Expand Down

0 comments on commit 9b24c09

Please sign in to comment.