Skip to content
Snippets Groups Projects
Commit 4decf95f authored by Wolfgang Kastaun's avatar Wolfgang Kastaun
Browse files

Updated unit tests to shift sign redefinition (tests still passing).

parent 9cf783ae
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ def test_dynamic_shift_linear_dask() -> None:
)
op_np = numpyfy_dask_multi(op_da, chunks=19)
s_da = op_np(y, d)
s_da = op_np(y, -d)
s_ex = g(np.maximum(t[0], t - d * dt))
assert s_ex == pytest.approx(s_da, abs=1e-15, rel=1e-14)
......@@ -63,7 +63,7 @@ def test_dynamic_shift_lagrange_dask() -> None:
)
op_na = numpyfy_dask_multi(op_da, chunks=19)
s_da: np.ndarray = op_na(y, d)
s_da: np.ndarray = op_na(y, -d)
s_ex = g(np.maximum(t[0], t - d * dt))
assert s_ex[op_da.margin_left :] == pytest.approx(
......@@ -74,7 +74,7 @@ def test_dynamic_shift_lagrange_dask() -> None:
length, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION
)
s_np = op_np(y, d)
s_np = op_np(y, -d)
assert np.all(s_np == s_da)
......
......@@ -49,7 +49,7 @@ def test_dynamic_shift_dsp_dask() -> None:
)
op_na = numpyfy_dask_multi(op_da, chunks=19)
s_da = op_na(y, d)
s_da = op_na(y, -d)
s_ex = g(np.maximum(t[0], t - d * dt))
assert s_ex[op_da.margin_left :] == pytest.approx(
......@@ -60,7 +60,7 @@ def test_dynamic_shift_dsp_dask() -> None:
order, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION
)
s_np = op_np(y, d)
s_np = op_np(y, -d)
assert np.all(s_np == s_da)
......@@ -82,14 +82,14 @@ def test_dynamic_shift_dsp_dask_orders() -> None:
)
op1_na = numpyfy_dask_multi(op1_da, chunks=19)
s1_na = op1_na(y, d)
s1_na = op1_na(y, -d)
op2_da = make_dynamic_shift_lagrange_dask(
length, d.min(), d.max(), DynShiftBC.FLAT, DynShiftBC.EXCEPTION
)
op2_na = numpyfy_dask_multi(op2_da, chunks=19)
s2_na = op2_na(y, d)
s2_na = op2_na(y, -d)
assert s1_na == pytest.approx(s2_na, abs=0, rel=5e-15)
......@@ -120,13 +120,13 @@ def test_fixed_shift_dsp_dask() -> None:
)
op2_na = numpyfy_dask_multi(op2_da, chunks=113)
s1_na = op1_na(y, d)
s2_na = op2_na(y, d)
s1_na = op1_na(y, -d)
s2_na = op2_na(y, -d)
assert s1_na == pytest.approx(s2_na, rel=1e-14, abs=0)
with pytest.raises(RuntimeError):
op2_na(y, -d)
op2_na(y, d)
op3_da = make_fixed_shift_lagrange_dask(
DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length
......@@ -138,10 +138,10 @@ def test_fixed_shift_dsp_dask() -> None:
)
op4_na = numpyfy_dask_multi(op4_da, chunks=113)
s3_na = op3_na(y, -d)
s4_na = op4_na(y, -d)
s3_na = op3_na(y, d)
s4_na = op4_na(y, d)
assert s3_na == pytest.approx(s4_na, rel=1e-14, abs=0)
with pytest.raises(RuntimeError):
op4_na(y, d)
op4_na(y, -d)
......@@ -48,8 +48,8 @@ def test_fixed_shift_lagrange_dask() -> None:
)
op_na = numpyfy_dask_multi(op_da, chunks=113)
s_np = op_np(y, d)
s_na = op_na(y, d)
s_np = op_np(y, -d)
s_na = op_na(y, -d)
s_ex = g(t - d * dt)
margin_ex = -int(np.floor(-d)) + order // 2
......@@ -58,7 +58,7 @@ def test_fixed_shift_lagrange_dask() -> None:
assert s_ex[margin_ex:] == pytest.approx(s_na[margin_ex:], abs=1e-15, rel=5e-13)
with pytest.raises(RuntimeError):
op_na(y, -d)
op_na(y, d)
op2_np = make_fixed_shift_lagrange_numpy(
DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length
......@@ -68,8 +68,8 @@ def test_fixed_shift_lagrange_dask() -> None:
)
op2_na = numpyfy_dask_multi(op2_da, chunks=113)
s2_np = op2_np(y, -d)
s2_na = op2_na(y, -d)
s2_np = op2_np(y, d)
s2_na = op2_na(y, d)
s2_ex = g(t + d * dt)
margin2_ex = int(np.floor(d)) + (length - 1 - order // 2)
......@@ -80,17 +80,17 @@ def test_fixed_shift_lagrange_dask() -> None:
)
with pytest.raises(RuntimeError):
op2_na(y, d)
op2_na(y, -d)
op3_da = make_fixed_shift_lagrange_dask(
DynShiftBC.FLAT, DynShiftBC.FLAT, length
)
op3_na = numpyfy_dask_multi(op3_da, chunks=113)
s3_na = op3_na(y, d)
s3_na = op3_na(y, -d)
assert s3_na == pytest.approx(s_np, rel=1e-14, abs=0)
s4_na = op3_na(y, -d)
s4_na = op3_na(y, d)
assert s4_na == pytest.approx(s2_np, rel=1e-14, abs=0)
......@@ -119,7 +119,7 @@ def test_shift_lagrange_dask_fixed_vs_dyn() -> None:
)
op2_na = numpyfy_dask_multi(op2_da, chunks=113)
s1_np = op1_na(y, d1d)
s2_np = op2_na(y, d)
s1_np = op1_na(y, -d1d)
s2_np = op2_na(y, -d)
assert s1_np == pytest.approx(s2_np, rel=1e-14, abs=0)
......@@ -30,7 +30,7 @@ def test_fixed_shift_lagrange_dask() -> None:
DynShiftBC.FLAT, DynShiftBC.EXCEPTION, length
)
s_np = op_np(y, d)
s_np = op_np(y, -d)
s_ex = g(t - d * dt)
margin_ex = -int(np.floor(-d)) + order // 2
......@@ -42,13 +42,13 @@ def test_fixed_shift_lagrange_dask() -> None:
# ~ assert np.min(np.abs(s_ex[:margin_ex] - s_np[:margin_ex])) > np.max(np.abs(y[:margin_ex]))*1e-10
with pytest.raises(RuntimeError):
op_np(y, -d)
op_np(y, d)
op2_np = make_fixed_shift_lagrange_numpy(
DynShiftBC.EXCEPTION, DynShiftBC.FLAT, length
)
s2_np = op2_np(y, -d)
s2_np = op2_np(y, d)
s2_ex = g(t + d * dt)
margin2_ex = int(np.floor(d)) + (length - 1 - order // 2)
......@@ -59,4 +59,4 @@ def test_fixed_shift_lagrange_dask() -> None:
# ~ assert np.min(np.abs(s2_ex[-margin2_ex:] - s2_np[-margin2_ex:])) > np.max(np.abs(y[-margin2_ex:]))*1e-10
with pytest.raises(RuntimeError):
op2_np(y, d)
op2_np(y, -d)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment