Skip to content

Commit

Permalink
replace deprecated np.product by np.prod in npfile.f90
Browse files Browse the repository at this point in the history
  • Loading branch information
tgastine committed Jul 29, 2024
1 parent 8dce5a9 commit 7752c52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/magic/npfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def read_array(self, dt, shape=-1, endian=None, order=None):
if minus_ones == 0:
pass
elif minus_ones == 1:
known_dimensions_size = -np.product(shape,axis=0) * dt.itemsize
known_dimensions_size = -np.prod(shape,axis=0) * dt.itemsize
unknown_dimension_size, illegal = divmod(self.remaining_bytes(),
known_dimensions_size)
if illegal:
Expand All @@ -213,7 +213,7 @@ def read_array(self, dt, shape=-1, endian=None, order=None):
else:
raise ValueError(
"illegal -1 count; can only specify one unknown dimension")
sz = dt.itemsize * np.product(shape)
sz = dt.itemsize * np.prod(shape)
dt_endian = self._endian_from_dtype(dt)
buf = self.file.read(sz)
arr = np.ndarray(shape=shape,
Expand Down Expand Up @@ -302,7 +302,7 @@ def fort_read(self, dt, shape=-1, endian=None, order=None, head_size=4):
if minus_ones == 0:
pass
elif minus_ones == 1:
known_dimensions_size = -np.product(shape,axis=0) * dt.itemsize
known_dimensions_size = -np.prod(shape,axis=0) * dt.itemsize
unknown_dimension_size, illegal = divmod(header,
known_dimensions_size)
if illegal:
Expand All @@ -311,7 +311,7 @@ def fort_read(self, dt, shape=-1, endian=None, order=None, head_size=4):
else:
raise ValueError(
"illegal -1 count; can only specify one unknown dimension")
sz = dt.itemsize * np.product(shape)
sz = dt.itemsize * np.prod(shape)

buf = self.file.read(sz)
arr = np.ndarray(shape=shape,
Expand Down

0 comments on commit 7752c52

Please sign in to comment.