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

Add unit test for shift_inversion_dask module

parent 26b8f754
No related branches found
No related tags found
No related merge requests found
"""Unit tests for module shift_inversion_dask"""
import numpy as np
import pytest
from lisainstrument.shift_inversion_numpy import make_shift_inverse_lagrange_numpy
from lisainstrument.shift_inversion_dask import make_shift_inverse_lagrange_dask
from lisainstrument.dynamic_delay_dask import numpyfy_dask_multi
def test_shift_inversion_numpy():
"""Test basic functioning of shift_inversion_dask on analytic coordinate transform"""
order = 31
nsamp = 600
chunks = 70
k_mod = 8 * np.pi
a_mod = 1e-3
max_it = 6
tol = 1e-12
def dx_from_x(x):
return np.sin(x * k_mod) * a_mod
xi, dt = np.linspace(0, 1, nsamp, retstep=True)
fsample = 1 / dt
dxi = dx_from_x(xi)
op_np = make_shift_inverse_lagrange_numpy(order, a_mod * 1.01, max_it, tol / dt)
op_da = make_shift_inverse_lagrange_dask(order, a_mod * 1.01, max_it, tol / dt)
op_na = numpyfy_dask_multi(op_da, chunks)
ai_np = op_np(dxi, fsample)
ai_na = op_na(dxi, fsample)
assert ai_np == pytest.approx(ai_na, abs=tol, rel=0)
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