Skip to content
Snippets Groups Projects
Commit 0ee82e90 authored by Jakob Roth's avatar Jakob Roth
Browse files

test_response: formatting

parent 0295ad8c
No related branches found
No related tags found
1 merge request!48Polarization response
Pipeline #206980 failed
...@@ -35,8 +35,8 @@ direc = "/data/" ...@@ -35,8 +35,8 @@ direc = "/data/"
OBS = [] OBS = []
for polmode in ["all", "stokesi", "stokesiavg"]: for polmode in ["all", "stokesi", "stokesiavg"]:
oo = rve.ms2observations( oo = rve.ms2observations(
f"{direc}CYG-ALL-2052-2MHZ.ms", "DATA", True, 0, polarizations=polmode f"{direc}CYG-ALL-2052-2MHZ.ms", "DATA", True, 0, polarizations=polmode
)[0] )[0]
# OBS.append(oo.to_single_precision()) # OBS.append(oo.to_single_precision())
OBS.append(oo.to_double_precision()) OBS.append(oo.to_double_precision())
npix, fov = 256, 1 * rve.DEG2RAD npix, fov = 256, 1 * rve.DEG2RAD
...@@ -51,10 +51,18 @@ def test_single_response(obs, facets): ...@@ -51,10 +51,18 @@ def test_single_response(obs, facets):
obs = obs.to_double_precision() obs = obs.to_double_precision()
sdom = dom[-1] sdom = dom[-1]
mask = ift.makeField(obs.mask.domain[1:], obs.mask.val[0]) mask = ift.makeField(obs.mask.domain[1:], obs.mask.val[0])
op = rve.SingleResponse(sdom, obs.uvw, obs.freq, mask=mask, facets=facets, epsilon=1e-6, op = rve.SingleResponse(
do_wgridding=False) sdom,
ift.extra.check_linear_operator(op, np.float64, np.complex128, obs.uvw,
only_r_linear=True, rtol=1e-6, atol=1e-6) obs.freq,
mask=mask,
facets=facets,
epsilon=1e-6,
do_wgridding=False,
)
ift.extra.check_linear_operator(
op, np.float64, np.complex128, only_r_linear=True, rtol=1e-6, atol=1e-6
)
def test_facet_consistency(): def test_facet_consistency():
...@@ -70,6 +78,7 @@ def test_facet_consistency(): ...@@ -70,6 +78,7 @@ def test_facet_consistency():
res0 = res res0 = res
ift.extra.assert_allclose(res0, res, rtol=1e-4, atol=1e-4) ift.extra.assert_allclose(res0, res, rtol=1e-4, atol=1e-4)
def test_jax_response_consistency(): def test_jax_response_consistency():
obs = OBS[0] obs = OBS[0]
obs = obs.to_double_precision() obs = obs.to_double_precision()
...@@ -78,14 +87,18 @@ def test_jax_response_consistency(): ...@@ -78,14 +87,18 @@ def test_jax_response_consistency():
radio_sky = ift.from_random(dom.domain) radio_sky = ift.from_random(dom.domain)
radio_sky_arr = radio_sky.val radio_sky_arr = radio_sky.val
R_old = rve.InterferometryResponse(obs, dom, do_wgridding=True, epsilon=1e-9, nthreads=1) R_old = rve.InterferometryResponse(
sky_domain_dict = dict(npix_x=sdom.shape[0], obs, dom, do_wgridding=True, epsilon=1e-9, nthreads=1
npix_y=sdom.shape[1], )
pixsize_x=float(sdom.distances[0]), sky_domain_dict = dict(
pixsize_y=float(sdom.distances[1]), npix_x=sdom.shape[0],
pol_labels=['I', 'Q', 'U', 'V'], npix_y=sdom.shape[1],
times=[0.], pixsize_x=float(sdom.distances[0]),
freqs=[0.]) pixsize_y=float(sdom.distances[1]),
pol_labels=["I", "Q", "U", "V"],
times=[0.0],
freqs=[0.0],
)
R_new = jrve.InterferometryResponse(obs, sky_domain_dict, True, 1e-9, nthreads=1) R_new = jrve.InterferometryResponse(obs, sky_domain_dict, True, 1e-9, nthreads=1)
vis_field_old = R_old(radio_sky).val vis_field_old = R_old(radio_sky).val
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment