-
Notifications
You must be signed in to change notification settings - Fork 28
ULTRA l1c counts nside update #2857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
63416d0
68ce19b
b2e10e2
d9a420f
12e3353
d6bc40a
4e54f6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| from copy import deepcopy | ||
| from pathlib import Path | ||
| from unittest import mock | ||
| from unittest.mock import patch | ||
|
|
||
| import astropy_healpix.healpy as hp | ||
| import numpy as np | ||
|
|
@@ -101,10 +102,14 @@ def test_init_cdf( | |
|
|
||
| cdf_filepath = write_cdf(ultra_pset, istp=False) | ||
|
|
||
| ultra_pset_from_dataset = ena_maps.UltraPointingSet(ultra_pset) | ||
|
|
||
| ultra_pset_from_str = ena_maps.UltraPointingSet(cdf_filepath) | ||
| ultra_pset_from_path = ena_maps.UltraPointingSet(Path(cdf_filepath)) | ||
| # Mock the downsample_counts method to avoid dimension bugs | ||
| # since this is a dummy cdf, the dimensions are not present. | ||
| with patch.object( | ||
| ena_maps.UltraPointingSet, "downsample_counts", lambda self: None | ||
| ): | ||
| ultra_pset_from_str = ena_maps.UltraPointingSet(cdf_filepath) | ||
| ultra_pset_from_path = ena_maps.UltraPointingSet(Path(cdf_filepath)) | ||
| ultra_pset_from_dataset = ena_maps.UltraPointingSet(ultra_pset) | ||
|
Comment on lines
+105
to
+112
|
||
|
|
||
| np.testing.assert_allclose( | ||
| ultra_pset_from_dataset.data["counts"].values, | ||
|
|
@@ -118,7 +123,6 @@ def test_init_cdf( | |
| rtol=1e-6, | ||
| ) | ||
|
|
||
| @pytest.mark.usefixtures("_setup_ultra_l1c_pset_products") | ||
| @pytest.mark.usefixtures("_setup_ultra_l1c_pset_products") | ||
| def test_different_spacing_raises_error(self): | ||
| """Test that different spaced az/el from the L1C dataset raises ValueError""" | ||
|
|
@@ -135,6 +139,23 @@ def test_different_spacing_raises_error(self): | |
| spice_reference_frame=geometry.SpiceFrame.IMAP_DPS, | ||
| ) | ||
|
|
||
| def test_downsample_counts(self): | ||
| ultra_pset = self.l1c_pset_products[0] | ||
|
|
||
| # First check that counts are at a finer resolution than exposure factor | ||
| counts_npix_before = ultra_pset["counts"].shape[-1] | ||
| assert counts_npix_before != ultra_pset["exposure_factor"].shape[-1] | ||
| pset = ena_maps.UltraPointingSet(ultra_pset) | ||
|
|
||
| # Verify counts are now at the same resolution as pset | ||
| counts_nside_after = hp.npix2nside(pset.data["counts"].shape[-1]) | ||
| assert counts_nside_after == pset.nside | ||
|
|
||
| # Verify counts are the same after downsampling. | ||
| np.testing.assert_allclose( | ||
| pset.data["counts"].values.sum(), ultra_pset["counts"].values.sum() | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def hi_pset_cdf_path(imap_tests_path): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.