Skip to content

Commit

Permalink
minor: change numpy import to suppress depracation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Jul 27, 2024
1 parent 599c5ab commit 24848c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions pylops/basicoperators/restriction.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
__all__ = ["Restriction"]

import logging

from typing import Sequence, Union

import numpy as np
import numpy.ma as np_ma
from numpy.core.multiarray import normalize_axis_index
from numpy.lib.array_utils import normalize_axis_index

from pylops import LinearOperator
from pylops.utils._internal import _value_or_sized_to_tuple
Expand Down Expand Up @@ -128,8 +127,13 @@ def __init__(
)
forceflat = None

super().__init__(dtype=np.dtype(dtype), dims=dims, dimsd=dimsd,
forceflat=forceflat, name=name)
super().__init__(
dtype=np.dtype(dtype),
dims=dims,
dimsd=dimsd,
forceflat=forceflat,
name=name,
)

iavareshape = np.ones(len(self.dims), dtype=int)
iavareshape[axis] = len(iava)
Expand Down
6 changes: 3 additions & 3 deletions pytests/test_torchoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_TorchOperator(par):
"""
# temporarily, skip tests on mac as torch seems not to recognized
# numpy when v2 is installed
if platform.system is not "Darwin":
if platform.system() != "Darwin":
Dop = MatrixMult(np.random.normal(0.0, 1.0, (par["ny"], par["nx"])))
Top = TorchOperator(Dop, batch=False)

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

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

0 comments on commit 24848c4

Please sign in to comment.