From 288647173574200484a59a791c494c72269c8939 Mon Sep 17 00:00:00 2001 From: "M. Teodoro" Date: Thu, 5 Oct 2023 14:14:48 -0400 Subject: [PATCH] Set atol=1e-5 and rtol=0 in astrometric_utils unit tests. --- .../tweakreg/tests/test_astrometric_utils.py | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/romancal/tweakreg/tests/test_astrometric_utils.py b/romancal/tweakreg/tests/test_astrometric_utils.py index fa9d767ef..6b0388993 100644 --- a/romancal/tweakreg/tests/test_astrometric_utils.py +++ b/romancal/tweakreg/tests/test_astrometric_utils.py @@ -117,7 +117,9 @@ def get_parallax_correction(epoch, gaia_ref_epoch_coords): """ obs_date = Time(epoch, format="decimalyear") - earths_center_barycentric_coords = coord.get_body_barycentric("earth", obs_date) + earths_center_barycentric_coords = coord.get_body_barycentric( + "earth", obs_date + ) earth_X = earths_center_barycentric_coords.x earth_Y = earths_center_barycentric_coords.y earth_Z = earths_center_barycentric_coords.z @@ -197,7 +199,9 @@ def create_wcs_for_tweakreg_pipeline(input_dm, shift_1=0, shift_2=0): tel2sky = _create_tel2sky_model(input_dm) # create required frames - detector = cf.Frame2D(name="detector", axes_order=(0, 1), unit=(u.pix, u.pix)) + detector = cf.Frame2D( + name="detector", axes_order=(0, 1), unit=(u.pix, u.pix) + ) v2v3 = cf.Frame2D( name="v2v3", axes_order=(0, 1), @@ -455,7 +459,9 @@ def test_create_astrometric_catalog_write_results_to_disk(tmp_path, base_image): ("GAIADR3", None), ], ) -def test_create_astrometric_catalog_using_epoch(tmp_path, catalog, epoch, request): +def test_create_astrometric_catalog_using_epoch( + tmp_path, catalog, epoch, request +): """Test fetching data from supported catalogs for a specific epoch.""" output_filename = "ref_cat.ecsv" img = request.getfixturevalue("base_image")(shift_1=1000, shift_2=1000) @@ -622,7 +628,9 @@ def test_get_catalog_using_epoch(ra, dec, epoch): gaia_ref_epoch=gaia_ref_epoch, ) # calculate parallax corrections - get_parallax_correction(epoch=epoch, gaia_ref_epoch_coords=gaia_ref_epoch_coords) + get_parallax_correction( + epoch=epoch, gaia_ref_epoch_coords=gaia_ref_epoch_coords + ) # calculate the expected coordinates value after corrections have been applied to # Gaia's reference epoch coordinates @@ -638,11 +646,9 @@ def test_get_catalog_using_epoch(ra, dec, epoch): ) assert len(result) > 0 - # choosing atol=0 corresponds to abs(a - b) / abs(b) <= rtol, - # where a is the returned value from the VO API and b is the expected - # value from applying the calculated PM and parallax corrections. - assert np.isclose(returned_ra, expected_ra, atol=0, rtol=1e-5).all() - assert np.isclose(returned_dec, expected_dec, atol=0, rtol=1e-5).all() + + assert np.isclose(returned_ra, expected_ra, atol=1e-5, rtol=0).all() + assert np.isclose(returned_dec, expected_dec, atol=1e-5, rtol=0).all() def test_get_catalog_timeout():