Skip to content

Commit 24848c4

Browse files
committed
minor: change numpy import to suppress depracation warning
1 parent 599c5ab commit 24848c4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pylops/basicoperators/restriction.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
__all__ = ["Restriction"]
22

33
import logging
4-
54
from typing import Sequence, Union
65

76
import numpy as np
87
import numpy.ma as np_ma
9-
from numpy.core.multiarray import normalize_axis_index
8+
from numpy.lib.array_utils import normalize_axis_index
109

1110
from pylops import LinearOperator
1211
from pylops.utils._internal import _value_or_sized_to_tuple
@@ -128,8 +127,13 @@ def __init__(
128127
)
129128
forceflat = None
130129

131-
super().__init__(dtype=np.dtype(dtype), dims=dims, dimsd=dimsd,
132-
forceflat=forceflat, name=name)
130+
super().__init__(
131+
dtype=np.dtype(dtype),
132+
dims=dims,
133+
dimsd=dimsd,
134+
forceflat=forceflat,
135+
name=name,
136+
)
133137

134138
iavareshape = np.ones(len(self.dims), dtype=int)
135139
iavareshape[axis] = len(iava)

pytests/test_torchoperator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_TorchOperator(par):
2121
"""
2222
# temporarily, skip tests on mac as torch seems not to recognized
2323
# numpy when v2 is installed
24-
if platform.system is not "Darwin":
24+
if platform.system() != "Darwin":
2525
Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"])))
2626
Top = TorchOperator(Dop, batch=False)
2727

@@ -47,7 +47,7 @@ def test_TorchOperator_batch(par):
4747
"""Apply forward for input with multiple samples (= batch) and flattened arrays"""
4848
# temporarily, skip tests on mac as torch seems not to recognized
4949
# numpy when v2 is installed
50-
if platform.system is not "Darwin":
50+
if platform.system() != "Darwin":
5151
Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"])))
5252
Top = TorchOperator(Dop, batch=True)
5353

@@ -66,7 +66,7 @@ def test_TorchOperator_batch_nd(par):
6666
"""Apply forward for input with multiple samples (= batch) and nd-arrays"""
6767
# temporarily, skip tests on mac as torch seems not to recognized
6868
# numpy when v2 is installed
69-
if platform.system is not "Darwin":
69+
if platform.system() != "Darwin":
7070
Dop = MatrixMult(
7171
np.random.normal(0.0, 1.0, (par["ny"], par["nx"])), otherdims=(2,)
7272
)

0 commit comments

Comments
 (0)