From fc1503e5a127e3841d064e7735036174045f05f8 Mon Sep 17 00:00:00 2001 From: Luca Pagano Date: Mon, 4 Nov 2024 15:05:28 +0100 Subject: [PATCH] mapmaking fixed --- litebird_sim/mapmaking/common.py | 2 +- pyproject.toml | 2 +- test/test_scanning.py | 7 ++++++- test/test_simulations.py | 19 ++++++++++--------- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/litebird_sim/mapmaking/common.py b/litebird_sim/mapmaking/common.py index 3f60e1c3..fbd90699 100644 --- a/litebird_sim/mapmaking/common.py +++ b/litebird_sim/mapmaking/common.py @@ -213,7 +213,7 @@ def _compute_pixel_indices( if output_coordinate_system == CoordinateSystem.Galactic: curr_pointings_det = rotate_coordinates_e2g(curr_pointings_det) - polang_all[idet] = curr_pointings_det[:, 2] + hwp_angle + polang_all[idet] = curr_pointings_det[:, 2] + 2 * hwp_angle pixidx_all[idet] = hpx.ang2pix(curr_pointings_det[:, :2]) diff --git a/pyproject.toml b/pyproject.toml index 94412552..03414b85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ include = [ [tool.poetry.dependencies] python = ">=3.9,<3.13" -numba = "^0.60.0" +numba = "^0.57.1" numpy = "^1.24" astropy = "5.3.4" tomlkit = "^0.12.1" diff --git a/test/test_scanning.py b/test/test_scanning.py index 9d6672b5..515eb35c 100644 --- a/test/test_scanning.py +++ b/test/test_scanning.py @@ -321,10 +321,15 @@ def test_simulation_pointings_hwp_mjd(tmp_path): pointings_and_orientation, hwp_angle = obs.get_pointings("all") pointings_and_orientation[..., 2] += 2 * hwp_angle + pointings_and_orientation[..., 2] = np.mod( + pointings_and_orientation[..., 2], 2 * np.pi + ) filename = Path(__file__).parent / f"reference_obs_pointings_hwp{idx:03d}.npy" reference = np.load(filename, allow_pickle=False) - assert np.allclose(pointings_and_orientation, reference) + reference[..., 2] = np.mod(reference[..., 2], 2 * np.pi) + + assert np.allclose(pointings_and_orientation, reference, rtol=1e-5) def test_scanning_quaternions(tmp_path): diff --git a/test/test_simulations.py b/test/test_simulations.py index 28ac1b44..4b77f020 100644 --- a/test/test_simulations.py +++ b/test/test_simulations.py @@ -520,17 +520,18 @@ def test_smart_pointings_angles(tmp_path): desired=np.array( [ 5.0, - 0.71681469, - 2.71681469, - 4.71681469, - 0.43362939, - 2.43362939, - 4.43362939, - 0.15044408, - 2.15044408, - 4.15044408, + 6.0, + 0.716815, + 1.716815, + 2.716815, + 3.716815, + 4.716815, + 5.716815, + 0.433629, + 1.433629, ] ), + rtol=1e-6, )