From 79a578ad38cecbdf610af036b75eb47a9aa6c377 Mon Sep 17 00:00:00 2001 From: Wolfgang Kastaun <wolfgang.kastaun@aei.mpg.de> Date: Fri, 20 Dec 2024 19:45:56 +0100 Subject: [PATCH] Renamed shift boundary condition enum to ShiftBC --- lisainstrument/dynamic_delay_dask.py | 24 +++++++++++------------ lisainstrument/dynamic_delay_dsp.py | 14 +++++--------- lisainstrument/dynamic_delay_numpy.py | 28 +++++++++++++-------------- lisainstrument/fixed_shift_dask.py | 22 ++++++++++----------- lisainstrument/fixed_shift_dsp.py | 4 ++-- lisainstrument/fixed_shift_numpy.py | 22 ++++++++++----------- tests/test_dynamic_delay_dask.py | 8 ++++---- tests/test_dynamic_delay_dsp.py | 26 +++++++++---------------- tests/test_fixed_shift_dask.py | 24 ++++++++--------------- tests/test_fixed_shift_numpy.py | 8 +++----- 10 files changed, 79 insertions(+), 101 deletions(-) diff --git a/lisainstrument/dynamic_delay_dask.py b/lisainstrument/dynamic_delay_dask.py index 1304b7f..4c52e8a 100644 --- a/lisainstrument/dynamic_delay_dask.py +++ b/lisainstrument/dynamic_delay_dask.py @@ -12,7 +12,7 @@ import dask.array as da import numpy as np from typing_extensions import assert_never -from lisainstrument.dynamic_delay_numpy import DynShiftBC, DynShiftCfg +from lisainstrument.dynamic_delay_numpy import DynShiftCfg, ShiftBC from lisainstrument.fir_filters_dask import DaskArray1D, make_dask_array_1d from lisainstrument.fir_filters_numpy import make_numpy_array_1d from lisainstrument.regular_interpolators import ( @@ -32,7 +32,7 @@ class DynamicShiftDask: to values on the left. The boundary treatment can be specified for each boundary in terms of - DynShiftBC enums. + ShiftBC enums. The interpolation method is not fixed but provided via an interpolator instance implementing the RegularInterpMethod protocol. @@ -93,15 +93,15 @@ class DynamicShiftDask: samples_pad = samples if self.margin_left > 0: match self._cfg.left_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: npad_left = self.margin_left samples_pad = da.concatenate([da.zeros(npad_left), samples]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: npad_left = self.margin_left samples_pad = da.concatenate( [da.ones(npad_left) * samples[0], samples] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"DynamicShiftDask: left edge handling {self._cfg.left_bound.name} not " f"possible for given max delay {self._cfg.max_delay}." @@ -112,15 +112,15 @@ class DynamicShiftDask: if self.margin_right > 0: match self._cfg.right_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples_pad = da.concatenate( [samples_pad, da.zeros(self.margin_right)] ) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples_pad = da.concatenate( [samples_pad, da.ones(self.margin_right) * samples_pad[-1]] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"DynamicShiftDask: right edge handling {self._cfg.right_bound.name} not " f"possible for given min delay {self._cfg.min_delay}." @@ -150,8 +150,8 @@ class DynamicShiftDask: def make_dynamic_shift_linear_dask( min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftDask: """Set up DynamicShiftDask instance with linear interpolation method. @@ -173,8 +173,8 @@ def make_dynamic_shift_lagrange_dask( length: int, min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftDask: """Set up DynamicShiftDask instance with Lagrange interpolation method. diff --git a/lisainstrument/dynamic_delay_dsp.py b/lisainstrument/dynamic_delay_dsp.py index 3c394ef..7599e47 100644 --- a/lisainstrument/dynamic_delay_dsp.py +++ b/lisainstrument/dynamic_delay_dsp.py @@ -18,11 +18,7 @@ import numpy as np from lisainstrument import dsp from lisainstrument.dynamic_delay_dask import DynamicShiftDask -from lisainstrument.dynamic_delay_numpy import ( - DynamicShiftNumpy, - DynShiftBC, - DynShiftCfg, -) +from lisainstrument.dynamic_delay_numpy import DynamicShiftNumpy, DynShiftCfg, ShiftBC from lisainstrument.fir_filters_numpy import NumpyArray1D from lisainstrument.regular_interpolators import RegularInterpCore, RegularInterpolator @@ -114,8 +110,8 @@ def make_dynamic_shift_dsp_dask( order: int, min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftDask: """Set up DynamicShiftDask instance using dsp.timeshift. @@ -139,8 +135,8 @@ def make_dynamic_shift_dsp_numpy( order: int, min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftNumpy: """Set up DynamicShiftNumpy instance using dsp.timeshift. diff --git a/lisainstrument/dynamic_delay_numpy.py b/lisainstrument/dynamic_delay_numpy.py index bb5f2f6..0c277c9 100644 --- a/lisainstrument/dynamic_delay_numpy.py +++ b/lisainstrument/dynamic_delay_numpy.py @@ -20,7 +20,7 @@ from lisainstrument.regular_interpolators import ( ) -class DynShiftBC(Enum): +class ShiftBC(Enum): """Enum for various methods of handling boundaries in dynamic shift ZEROPAD: Assume all data outside given range is zero. @@ -46,8 +46,8 @@ class DynShiftCfg: min_delay: float max_delay: float - left_bound: DynShiftBC - right_bound: DynShiftBC + left_bound: ShiftBC + right_bound: ShiftBC @property def min_delay_int(self) -> int: @@ -75,7 +75,7 @@ class DynamicShiftNumpy: to values on the left. The boundary treatment can be specified for each boundary in terms of - DynShiftBC enums. + ShiftBC enums. The interpolation method is not fixed but provided via an interpolator instance implementing the RegularInterpMethod protocol. @@ -137,13 +137,13 @@ class DynamicShiftNumpy: npad_left = 0 if self.margin_left > 0: match self._cfg.left_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: npad_left = self.margin_left samples = np.concatenate([np.zeros(npad_left), samples]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: npad_left = self.margin_left samples = np.concatenate([np.ones(npad_left) * samples[0], samples]) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"DynamicShiftNumpy: left edge handling {self._cfg.left_bound.name} not " f"possible for given max delay {self._cfg.max_delay}." @@ -154,13 +154,13 @@ class DynamicShiftNumpy: if self.margin_right > 0: match self._cfg.right_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples = np.concatenate([samples, np.zeros(self.margin_right)]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples = np.concatenate( [samples, np.ones(self.margin_right) * samples[-1]] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"DynamicShiftNumpy: right edge handling {self._cfg.right_bound.name} not " f"possible for given min delay {self._cfg.min_delay=}." @@ -180,8 +180,8 @@ def make_dynamic_shift_lagrange_numpy( length: int, min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftNumpy: """Set up DynamicShiftNumpy instance with Lagrange interpolation method. @@ -203,8 +203,8 @@ def make_dynamic_shift_lagrange_numpy( def make_dynamic_shift_linear_numpy( min_delay: float, max_delay: float, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, ) -> DynamicShiftNumpy: """Set up DynamicShiftNumpy instance with linear interpolation method. diff --git a/lisainstrument/fixed_shift_dask.py b/lisainstrument/fixed_shift_dask.py index e6e2100..4db20a3 100644 --- a/lisainstrument/fixed_shift_dask.py +++ b/lisainstrument/fixed_shift_dask.py @@ -12,7 +12,7 @@ import dask.array as da import numpy as np from typing_extensions import assert_never -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fir_filters_dask import DaskArray1D, make_dask_array_1d from lisainstrument.fixed_shift_numpy import FixedShiftFactory, FixedShiftLagrange @@ -26,7 +26,7 @@ class FixedShiftDask: # pylint: disable=too-few-public-methods right of a given sample, negative shifts to values on the left. The boundary treatment can be specified for each boundary in terms of - DynShiftBC enums. + ShiftBC enums. The interpolation method is not fixed but provided via an interpolator instance implementing the RegularInterpMethod protocol. @@ -35,8 +35,8 @@ class FixedShiftDask: # pylint: disable=too-few-public-methods def __init__( self, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, interp_fac: FixedShiftFactory, ): """Not intended for direct use, employ named constructors instead @@ -53,13 +53,13 @@ class FixedShiftDask: # pylint: disable=too-few-public-methods def _padding_left(self, samples: da.Array, margin_left: int) -> da.Array: if margin_left > 0: match self._left_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples = da.concatenate([da.zeros(margin_left), samples]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples = da.concatenate( [da.ones(margin_left) * samples[0], samples] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"FixedShiftDask: left edge handling {self._left_bound.name} " f"impossible for given delay, would need margin of {margin_left}." @@ -74,13 +74,13 @@ class FixedShiftDask: # pylint: disable=too-few-public-methods def _padding_right(self, samples: da.Array, margin_right: int) -> da.Array: if margin_right > 0: match self._right_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples = da.concatenate([samples, da.zeros(margin_right)]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples = da.concatenate( [samples, da.ones(margin_right) * samples[-1]] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"FixedShiftDask: right edge handling {self._right_bound.name} " f"impossible for given delay, would need margin of {margin_right}." @@ -142,7 +142,7 @@ class FixedShiftDask: # pylint: disable=too-few-public-methods def make_fixed_shift_lagrange_dask( - left_bound: DynShiftBC, right_bound: DynShiftBC, length: int + left_bound: ShiftBC, right_bound: ShiftBC, length: int ) -> FixedShiftDask: """Create a FixedShiftDask instance that uses Lagrange interpolator diff --git a/lisainstrument/fixed_shift_dsp.py b/lisainstrument/fixed_shift_dsp.py index 39afef8..a85d643 100644 --- a/lisainstrument/fixed_shift_dsp.py +++ b/lisainstrument/fixed_shift_dsp.py @@ -17,7 +17,7 @@ from typing import Final import numpy as np from lisainstrument import dsp -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fir_filters_numpy import NumpyArray1D, make_numpy_array_1d from lisainstrument.fixed_shift_dask import FixedShiftDask from lisainstrument.fixed_shift_numpy import ( @@ -128,7 +128,7 @@ class FixedShiftWrapDSP(FixedShiftCore): def make_fixed_shift_dsp_dask( - left_bound: DynShiftBC, right_bound: DynShiftBC, length: int + left_bound: ShiftBC, right_bound: ShiftBC, length: int ) -> FixedShiftDask: """Create a FixedShiftDask instance that uses dsp.timeshift interpolator diff --git a/lisainstrument/fixed_shift_numpy.py b/lisainstrument/fixed_shift_numpy.py index 77eab13..5aec405 100644 --- a/lisainstrument/fixed_shift_numpy.py +++ b/lisainstrument/fixed_shift_numpy.py @@ -12,7 +12,7 @@ from typing import Callable, Final, Protocol, TypeAlias import numpy as np from typing_extensions import assert_never -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fir_filters_numpy import ( DefFilterFIR, EdgeHandling, @@ -250,7 +250,7 @@ class FixedShiftNumpy: # pylint: disable=too-few-public-methods right of a given sample, negative shifts to values on the left. The boundary treatment can be specified for each boundary in terms of - DynShiftBC enums. + ShiftBC enums. The interpolation method is not fixed but provided via an interpolator instance implementing the FixedShiftCore protocol. @@ -259,8 +259,8 @@ class FixedShiftNumpy: # pylint: disable=too-few-public-methods def __init__( self, - left_bound: DynShiftBC, - right_bound: DynShiftBC, + left_bound: ShiftBC, + right_bound: ShiftBC, interp_fac: FixedShiftFactory, ): """Not intended for direct use, employ named constructors instead @@ -277,13 +277,13 @@ class FixedShiftNumpy: # pylint: disable=too-few-public-methods def _padding_left(self, samples: np.ndarray, margin_left: int) -> np.ndarray: if margin_left > 0: match self._left_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples = np.concatenate([np.zeros(margin_left), samples]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples = np.concatenate( [np.ones(margin_left) * samples[0], samples] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"FixedShiftNumpy: left edge handling {self._left_bound.name} not " f"possible for given delay, need margin of {margin_left}." @@ -298,13 +298,13 @@ class FixedShiftNumpy: # pylint: disable=too-few-public-methods def _padding_right(self, samples: np.ndarray, margin_right: int) -> np.ndarray: if margin_right > 0: match self._right_bound: - case DynShiftBC.ZEROPAD: + case ShiftBC.ZEROPAD: samples = np.concatenate([samples, np.zeros(margin_right)]) - case DynShiftBC.FLAT: + case ShiftBC.FLAT: samples = np.concatenate( [samples, np.ones(margin_right) * samples[-1]] ) - case DynShiftBC.EXCEPTION: + case ShiftBC.EXCEPTION: msg = ( f"FixedShiftNumpy: right edge handling {self._right_bound.name} not " f"possible for given delay, need margin of {margin_right}." @@ -356,7 +356,7 @@ class FixedShiftNumpy: # pylint: disable=too-few-public-methods def make_fixed_shift_lagrange_numpy( - left_bound: DynShiftBC, right_bound: DynShiftBC, length: int + left_bound: ShiftBC, right_bound: ShiftBC, length: int ) -> FixedShiftNumpy: """Create a FixedShiftNumpy instance that uses Lagrange interpolator diff --git a/tests/test_dynamic_delay_dask.py b/tests/test_dynamic_delay_dask.py index 466a9e0..4bc93aa 100644 --- a/tests/test_dynamic_delay_dask.py +++ b/tests/test_dynamic_delay_dask.py @@ -9,7 +9,7 @@ from lisainstrument.dynamic_delay_dask import ( numpyfy_dask_multi, ) from lisainstrument.dynamic_delay_numpy import ( - DynShiftBC, + ShiftBC, make_dynamic_shift_lagrange_numpy, ) from lisainstrument.regular_interpolators import make_lagrange_polynomials @@ -28,7 +28,7 @@ def test_dynamic_shift_linear_dask() -> None: # ~ print(y[0], t[0], d[0]) op_da = make_dynamic_shift_linear_dask( - d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) op_np = numpyfy_dask_multi(op_da, chunks=19) @@ -59,7 +59,7 @@ def test_dynamic_shift_lagrange_dask() -> None: d = (0.93456456 + 0.0235345 * np.cos(4.3354 * t)) / dt op_da = make_dynamic_shift_lagrange_dask( - length, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + length, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) op_na = numpyfy_dask_multi(op_da, chunks=19) @@ -71,7 +71,7 @@ def test_dynamic_shift_lagrange_dask() -> None: ) op_np = make_dynamic_shift_lagrange_numpy( - length, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + length, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) s_np = op_np(y, -d) diff --git a/tests/test_dynamic_delay_dsp.py b/tests/test_dynamic_delay_dsp.py index 08eaec3..1f97c63 100644 --- a/tests/test_dynamic_delay_dsp.py +++ b/tests/test_dynamic_delay_dsp.py @@ -11,7 +11,7 @@ from lisainstrument.dynamic_delay_dsp import ( make_dynamic_shift_dsp_dask, make_dynamic_shift_dsp_numpy, ) -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fixed_shift_dask import make_fixed_shift_lagrange_dask from lisainstrument.fixed_shift_dsp import make_fixed_shift_dsp_dask @@ -45,7 +45,7 @@ def test_dynamic_shift_dsp_dask() -> None: d = (0.93456456 + 0.0235345 * np.cos(4.3354 * t)) / dt op_da = make_dynamic_shift_dsp_dask( - order, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + order, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) op_na = numpyfy_dask_multi(op_da, chunks=19) @@ -57,7 +57,7 @@ def test_dynamic_shift_dsp_dask() -> None: ) op_np = make_dynamic_shift_dsp_numpy( - order, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + order, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) s_np = op_np(y, -d) @@ -78,14 +78,14 @@ def test_dynamic_shift_dsp_dask_orders() -> None: d = 17 + (0.93456456 + 0.0235345 * np.cos(4.3354 * t)) / dt op1_da = make_dynamic_shift_dsp_dask( - order, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + order, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) op1_na = numpyfy_dask_multi(op1_da, chunks=19) s1_na = op1_na(y, -d) op2_da = make_dynamic_shift_lagrange_dask( - length, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION + length, d.min(), d.max(), ShiftBC.FLAT, ShiftBC.EXCEPTION ) op2_na = numpyfy_dask_multi(op2_da, chunks=19) @@ -110,14 +110,10 @@ def test_fixed_shift_dsp_dask() -> None: y = g(t) for d in (0.93456456 / dt, 3.1, 3.5, 3.9, 4.0, 4.1, 4.5, 4.9, 116.0): - op1_da = make_fixed_shift_lagrange_dask( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length - ) + op1_da = make_fixed_shift_lagrange_dask(ShiftBC.FLAT, ShiftBC.EXCEPTION, length) op1_na = numpyfy_dask_multi(op1_da, chunks=113) - op2_da = make_fixed_shift_dsp_dask( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length - ) + op2_da = make_fixed_shift_dsp_dask(ShiftBC.FLAT, ShiftBC.EXCEPTION, length) op2_na = numpyfy_dask_multi(op2_da, chunks=113) s1_na = op1_na(y, -d) @@ -128,14 +124,10 @@ def test_fixed_shift_dsp_dask() -> None: with pytest.raises(RuntimeError): op2_na(y, d) - op3_da = make_fixed_shift_lagrange_dask( - DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length - ) + op3_da = make_fixed_shift_lagrange_dask(ShiftBC.EXCEPTION, ShiftBC.FLAT, length) op3_na = numpyfy_dask_multi(op3_da, chunks=113) - op4_da = make_fixed_shift_dsp_dask( - DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length - ) + op4_da = make_fixed_shift_dsp_dask(ShiftBC.EXCEPTION, ShiftBC.FLAT, length) op4_na = numpyfy_dask_multi(op4_da, chunks=113) s3_na = op3_na(y, d) diff --git a/tests/test_fixed_shift_dask.py b/tests/test_fixed_shift_dask.py index 8ed02ab..c74037e 100644 --- a/tests/test_fixed_shift_dask.py +++ b/tests/test_fixed_shift_dask.py @@ -7,7 +7,7 @@ from lisainstrument.dynamic_delay_dask import ( make_dynamic_shift_lagrange_dask, numpyfy_dask_multi, ) -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fixed_shift_dask import make_fixed_shift_lagrange_dask from lisainstrument.fixed_shift_numpy import make_fixed_shift_lagrange_numpy @@ -40,12 +40,8 @@ def test_fixed_shift_lagrange_dask() -> None: for d in (0.93456456 / dt, 3.1, 3.5, 3.9, 4.0, 4.1, 4.5, 4.9, 116.0): - op_np = make_fixed_shift_lagrange_numpy( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length - ) - op_da = make_fixed_shift_lagrange_dask( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length - ) + op_np = make_fixed_shift_lagrange_numpy(ShiftBC.FLAT, ShiftBC.EXCEPTION, length) + op_da = make_fixed_shift_lagrange_dask(ShiftBC.FLAT, ShiftBC.EXCEPTION, length) op_na = numpyfy_dask_multi(op_da, chunks=113) s_np = op_np(y, -d) @@ -61,11 +57,9 @@ def test_fixed_shift_lagrange_dask() -> None: op_na(y, d) op2_np = make_fixed_shift_lagrange_numpy( - DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length - ) - op2_da = make_fixed_shift_lagrange_dask( - DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length + ShiftBC.EXCEPTION, ShiftBC.FLAT, length ) + op2_da = make_fixed_shift_lagrange_dask(ShiftBC.EXCEPTION, ShiftBC.FLAT, length) op2_na = numpyfy_dask_multi(op2_da, chunks=113) s2_np = op2_np(y, d) @@ -82,9 +76,7 @@ def test_fixed_shift_lagrange_dask() -> None: with pytest.raises(RuntimeError): op2_na(y, -d) - op3_da = make_fixed_shift_lagrange_dask( - DynShiftBC.FLAT, DynShiftBC.FLAT, length - ) + op3_da = make_fixed_shift_lagrange_dask(ShiftBC.FLAT, ShiftBC.FLAT, length) op3_na = numpyfy_dask_multi(op3_da, chunks=113) s3_na = op3_na(y, -d) @@ -110,12 +102,12 @@ def test_shift_lagrange_dask_fixed_vs_dyn() -> None: d1d = np.ones_like(y) * d op1_da = make_dynamic_shift_lagrange_dask( - length, d, d, DynShiftBC.FLAT, DynShiftBC.EXCEPTION + length, d, d, ShiftBC.FLAT, ShiftBC.EXCEPTION ) op1_na = numpyfy_dask_multi(op1_da, chunks=113) op2_da = make_fixed_shift_lagrange_dask( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length + ShiftBC.FLAT, ShiftBC.EXCEPTION, length ) op2_na = numpyfy_dask_multi(op2_da, chunks=113) diff --git a/tests/test_fixed_shift_numpy.py b/tests/test_fixed_shift_numpy.py index c7afb87..400f0f1 100644 --- a/tests/test_fixed_shift_numpy.py +++ b/tests/test_fixed_shift_numpy.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from lisainstrument.dynamic_delay_numpy import DynShiftBC +from lisainstrument.dynamic_delay_numpy import ShiftBC from lisainstrument.fixed_shift_numpy import make_fixed_shift_lagrange_numpy @@ -26,9 +26,7 @@ def test_fixed_shift_lagrange_dask() -> None: for d in (0.93456456 / dt, 3.1, 3.5, 3.9, 4.0, 4.1, 4.5, 4.9): # ~ d = 0.93456456 / dt - op_np = make_fixed_shift_lagrange_numpy( - DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length - ) + op_np = make_fixed_shift_lagrange_numpy(ShiftBC.FLAT, ShiftBC.EXCEPTION, length) s_np = op_np(y, -d) s_ex = g(t - d * dt) @@ -45,7 +43,7 @@ def test_fixed_shift_lagrange_dask() -> None: op_np(y, d) op2_np = make_fixed_shift_lagrange_numpy( - DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length + ShiftBC.EXCEPTION, ShiftBC.FLAT, length ) s2_np = op2_np(y, d) -- GitLab