Skip to content

Commit 90de34f

Browse files
committed
minor: Remove any reference to dir/dirs/nodir
1 parent 0afe198 commit 90de34f

24 files changed

+28
-368
lines changed

pylops/basicoperators/CausalIntegration.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ class CausalIntegration(LinearOperator):
1919
.. versionadded:: 2.0.0
2020
2121
Axis along which the model is integrated.
22-
dir : :obj:`int`, optional
23-
24-
.. deprecated:: 2.0.0
25-
Use ``axis`` instead.
26-
2722
sampling : :obj:`float`, optional
2823
Sampling step ``dx``.
2924
halfcurrent : :obj:`bool`, optional
@@ -96,21 +91,12 @@ def __init__(
9691
self,
9792
dims,
9893
axis=-1,
99-
dir=None,
10094
sampling=1,
10195
halfcurrent=True,
10296
dtype="float64",
10397
kind="full",
10498
removefirst=False,
10599
):
106-
if dir is not None:
107-
warnings.warn(
108-
"dir will be deprecated in version 2.0.0, use axis instead.",
109-
category=DeprecationWarning,
110-
stacklevel=2,
111-
)
112-
axis = dir
113-
114100
self.dims = _value_or_list_like_to_array(dims)
115101
self.axis = axis
116102
self.sampling = sampling

pylops/basicoperators/Diagonal.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ class Diagonal(LinearOperator):
2828
.. versionadded:: 2.0.0
2929
3030
Axis along which multiplication is applied.
31-
dir : :obj:`int`, optional
32-
33-
.. deprecated:: 2.0.0
34-
Use ``axis`` instead. Note that the default for ``axis`` is -1
35-
instead of 0 which was the default for ``dir``.
36-
3731
dtype : :obj:`str`, optional
3832
Type of elements in input array.
3933
@@ -65,17 +59,10 @@ class Diagonal(LinearOperator):
6559
6660
"""
6761

68-
def __init__(self, diag, dims=None, axis=-1, dir=None, dtype="float64"):
62+
def __init__(self, diag, dims=None, axis=-1, dtype="float64"):
6963
ncp = get_array_module(diag)
7064
self.diag = diag.ravel()
7165
self.complex = True if ncp.iscomplexobj(self.diag) else False
72-
if dir is not None:
73-
warnings.warn(
74-
"dir will be deprecated in version 2.0.0, use axis instead.",
75-
category=DeprecationWarning,
76-
stacklevel=2,
77-
)
78-
axis = dir
7966

8067
if dims is None:
8168
self.shape = (len(self.diag), len(self.diag))

pylops/basicoperators/FirstDerivative.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ class FirstDerivative(LinearOperator):
2222
.. versionadded:: 2.0.0
2323
2424
Axis along which derivative is applied.
25-
dir : :obj:`int`, optional
26-
27-
.. deprecated:: 2.0.0
28-
Use ``axis`` instead. Note that the default for ``axis`` is -1
29-
instead of 0 which was the default for ``dir``.
30-
3125
sampling : :obj:`float`, optional
3226
Sampling step :math:`\Delta x`.
3327
edge : :obj:`bool`, optional
@@ -74,20 +68,11 @@ def __init__(
7468
self,
7569
dims,
7670
axis=-1,
77-
dir=None,
7871
sampling=1.0,
7972
edge=False,
8073
dtype="float64",
8174
kind="centered",
8275
):
83-
if dir is not None:
84-
warnings.warn(
85-
"dir will be deprecated in version 2.0.0, use axis instead.",
86-
category=DeprecationWarning,
87-
stacklevel=2,
88-
)
89-
axis = dir
90-
9176
self.dims = _value_or_list_like_to_array(dims)
9277
self.axis = normalize_axis_index(axis, len(self.dims))
9378
self.sampling = sampling

pylops/basicoperators/Flip.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ class Flip(LinearOperator):
1919
.. versionadded:: 2.0.0
2020
2121
Axis along which model is flipped.
22-
dir : :obj:`int`, optional
23-
24-
.. deprecated:: 2.0.0
25-
Use ``axis`` instead. Note that the default for ``axis`` is -1
26-
instead of 0 which was the default for ``dir``.
27-
2822
dtype : :obj:`str`, optional
2923
Type of elements in input array.
3024
@@ -45,21 +39,13 @@ class Flip(LinearOperator):
4539
.. math::
4640
y[i] = x[N-1-i] \quad \forall i=0,1,2,\ldots,N-1
4741
48-
where :math:`N` is the dimension of the input model along ``dir``. As this operator is
42+
where :math:`N` is the dimension of the input model along ``axis``. As this operator is
4943
self-adjoint, :math:`x` and :math:`y` in the equation above are simply
5044
swapped in adjoint mode.
5145
5246
"""
5347

54-
def __init__(self, dims, axis=-1, dir=None, dtype="float64"):
55-
if dir is not None:
56-
warnings.warn(
57-
"dir will be deprecated in version 2.0.0, use axis instead.",
58-
category=DeprecationWarning,
59-
stacklevel=2,
60-
)
61-
axis = dir
62-
48+
def __init__(self, dims, axis=-1, dtype="float64"):
6349
self.dims = _value_or_list_like_to_array(dims)
6450
self.axis = axis
6551
N = np.prod(self.dims)

pylops/basicoperators/Laplacian.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
def Laplacian(
1111
dims,
1212
axes=(-2, -1),
13-
dirs=None,
1413
weights=(1, 1),
1514
sampling=(1, 1),
1615
edge=False,
@@ -32,12 +31,6 @@ def Laplacian(
3231
.. versionadded:: 2.0.0
3332
3433
Axes along which the Laplacian is applied.
35-
dirs : :obj:`int`, optional
36-
37-
.. deprecated:: 2.0.0
38-
Use ``axes`` instead. Note that the default for ``axes`` is (-2, -1)
39-
instead of (0, 1) which was the default for ``dirs``.
40-
4134
weights : :obj:`tuple`, optional
4235
Weight to apply to each direction (real laplacian operator if
4336
``weights=(1, 1)``)
@@ -73,13 +66,6 @@ def Laplacian(
7366
/ (\Delta x \Delta y)
7467
7568
"""
76-
if dirs is not None:
77-
warnings.warn(
78-
"dirs will be deprecated in version 2.0.0, use axes instead.",
79-
category=DeprecationWarning,
80-
stacklevel=2,
81-
)
82-
axes = dirs
8369
axes = tuple(normalize_axis_index(ax, len(dims)) for ax in axes)
8470
if not (len(axes) == len(weights) == len(sampling)):
8571
raise ValueError("axes, weights, and sampling have different size")

pylops/basicoperators/Restriction.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ class Restriction(LinearOperator):
3939
.. versionadded:: 2.0.0
4040
4141
Axis along which restriction is applied to model.
42-
dir : :obj:`int`, optional
43-
44-
.. deprecated:: 2.0.0
45-
Use ``axis`` instead. Note that the default for ``axis`` is -1
46-
instead of 0 which was the default for ``dir``.
47-
4842
dtype : :obj:`str`, optional
4943
Type of elements in input array.
5044
inplace : :obj:`bool`, optional
@@ -90,15 +84,7 @@ class Restriction(LinearOperator):
9084
9185
"""
9286

93-
def __init__(self, dims, iava, axis=-1, dir=None, dtype="float64", inplace=True):
94-
if dir is not None:
95-
warnings.warn(
96-
"dir will be deprecated in version 2.0.0, use axis instead.",
97-
category=DeprecationWarning,
98-
stacklevel=2,
99-
)
100-
axis = dir
101-
87+
def __init__(self, dims, iava, axis=-1, dtype="float64", inplace=True):
10288
ncp = get_array_module(iava)
10389
self.dims = _value_or_list_like_to_array(dims)
10490
self.axis = normalize_axis_index(axis, len(self.dims))

pylops/basicoperators/Roll.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ class Roll(LinearOperator):
2020
.. versionadded:: 2.0.0
2121
2222
Axis along which model is rolled.
23-
dir : :obj:`int`, optional
24-
25-
.. deprecated:: 2.0.0
26-
Use ``axis`` instead. Note that the default for ``axis`` is -1
27-
instead of 0 which was the default for ``dir``.
28-
2923
shift : :obj:`int`, optional
3024
Number of samples by which elements are shifted
3125
dtype : :obj:`str`, optional
@@ -47,15 +41,7 @@ class Roll(LinearOperator):
4741
4842
"""
4943

50-
def __init__(self, dims, axis=-1, dir=None, shift=1, dtype="float64"):
51-
if dir is not None:
52-
warnings.warn(
53-
"dir will be deprecated in version 2.0.0, use axis instead.",
54-
category=DeprecationWarning,
55-
stacklevel=2,
56-
)
57-
axis = dir
58-
44+
def __init__(self, dims, axis=-1, shift=1, dtype="float64"):
5945
self.dims = _value_or_list_like_to_array(dims)
6046
self.axis = axis
6147
N = np.prod(self.dims)

pylops/basicoperators/SecondDerivative.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ class SecondDerivative(LinearOperator):
2323
.. versionadded:: 2.0.0
2424
2525
Axis along which derivative is applied.
26-
dir : :obj:`int`, optional
27-
28-
.. deprecated:: 2.0.0
29-
Use ``axis`` instead. Note that the default for ``axis`` is -1
30-
instead of 0 which was the default for ``dir``.
31-
3226
sampling : :obj:`float`, optional
3327
Sampling step :math:`\Delta x`.
3428
edge : :obj:`bool`, optional
@@ -74,20 +68,11 @@ def __init__(
7468
self,
7569
dims,
7670
axis=-1,
77-
dir=None,
7871
sampling=1,
7972
edge=False,
8073
dtype="float64",
8174
kind="centered",
8275
):
83-
if dir is not None:
84-
warnings.warn(
85-
"dir will be deprecated in version 2.0.0, use axis instead.",
86-
category=DeprecationWarning,
87-
stacklevel=2,
88-
)
89-
axis = dir
90-
9176
self.dims = _value_or_list_like_to_array(dims)
9277
self.axis = normalize_axis_index(axis, len(self.dims))
9378
self.sampling = sampling

pylops/basicoperators/Smoothing1D.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pylops.signalprocessing import Convolve1D
66

77

8-
def Smoothing1D(nsmooth, dims, axis=-1, dir=None, dtype="float64"):
8+
def Smoothing1D(nsmooth, dims, axis=-1, dtype="float64"):
99
r"""1D Smoothing.
1010
1111
Apply smoothing to model (and data) to a multi-dimensional array
@@ -21,12 +21,6 @@ def Smoothing1D(nsmooth, dims, axis=-1, dir=None, dtype="float64"):
2121
.. versionadded:: 2.0.0
2222
2323
Axis along which model (and data) are smoothed.
24-
dir : :obj:`int`, optional
25-
26-
.. deprecated:: 2.0.0
27-
Use ``axis`` instead. Note that the default for ``axis`` is -1
28-
instead of 0 which was the default for ``dir``.
29-
3024
dtype : :obj:`str`, optional
3125
Type of elements in input array.
3226
@@ -71,19 +65,6 @@ def Smoothing1D(nsmooth, dims, axis=-1, dir=None, dtype="float64"):
7165
"""
7266
if nsmooth % 2 == 0:
7367
nsmooth += 1
74-
75-
if dir is not None:
76-
warnings.warn(
77-
"dir will be deprecated in version 2.0.0, use axis instead.",
78-
category=DeprecationWarning,
79-
stacklevel=2,
80-
)
81-
axis = dir
82-
83-
return Convolve1D(
84-
dims,
85-
np.ones(nsmooth) / float(nsmooth),
86-
axis=axis,
87-
offset=(nsmooth - 1) / 2,
88-
dtype=dtype,
89-
)
68+
h = np.ones(nsmooth) / float(nsmooth)
69+
offset = (nsmooth - 1) / 2
70+
return Convolve1D(dims, h, axis=axis, offset=offset, dtype=dtype)

pylops/basicoperators/Smoothing2D.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pylops.signalprocessing import Convolve2D
77

88

9-
def Smoothing2D(nsmooth, dims, axes=(-2, -1), nodir=None, dtype="float64"):
9+
def Smoothing2D(nsmooth, dims, axes=(-2, -1), dtype="float64"):
1010
r"""2D Smoothing.
1111
1212
Apply smoothing to model (and data) along two ``axes`` of a
@@ -22,13 +22,6 @@ def Smoothing2D(nsmooth, dims, axes=(-2, -1), nodir=None, dtype="float64"):
2222
.. versionadded:: 2.0.0
2323
2424
Axes along which model (and data) are smoothed.
25-
nodir : :obj:`int`, optional
26-
Direction along which smoothing is **not** applied (set to ``None`` for 2d
27-
arrays)
28-
29-
.. deprecated:: 2.0.0
30-
Use ``axes`` instead. Note that ``axes`` applies along axes instead.
31-
3225
dtype : :obj:`str`, optional
3326
Type of elements in input array.
3427
@@ -67,26 +60,6 @@ def Smoothing2D(nsmooth, dims, axes=(-2, -1), nodir=None, dtype="float64"):
6760
nsmooth[0] += 1
6861
if nsmooth[1] % 2 == 0:
6962
nsmooth[1] += 1
70-
if nodir is not None:
71-
warnings.warn(
72-
"nodir will be deprecated in version 2.0.0, use axes instead.",
73-
category=DeprecationWarning,
74-
stacklevel=2,
75-
)
76-
if nodir == 0:
77-
axes = (1, 2)
78-
elif nodir == 1:
79-
axes = (0, 2)
80-
else:
81-
axes = (0, 1)
82-
else:
83-
axes = tuple(normalize_axis_index(ax, len(dims)) for ax in axes)
84-
8563
h = np.ones((nsmooth[0], nsmooth[1])) / float(nsmooth[0] * nsmooth[1])
86-
return Convolve2D(
87-
dims,
88-
h=h,
89-
offset=[(nsmooth[0] - 1) / 2, (nsmooth[1] - 1) / 2],
90-
axes=axes,
91-
dtype=dtype,
92-
)
64+
offset = [(nsmooth[0] - 1) / 2, (nsmooth[1] - 1) / 2]
65+
return Convolve2D(dims, h=h, offset=offset, axes=axes, dtype=dtype)

0 commit comments

Comments
 (0)