imap-processing 0.9.0__py3-none-any.whl → 0.11.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of imap-processing might be problematic. Click here for more details.
- imap_processing/_version.py +2 -2
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +749 -442
- imap_processing/cdf/config/imap_glows_global_cdf_attrs.yaml +7 -0
- imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml +8 -2
- imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +0 -1
- imap_processing/cdf/config/imap_glows_l2_variable_attrs.yaml +358 -0
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +59 -25
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +22 -0
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +32 -8
- imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +94 -5
- imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +65 -37
- imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +16 -1
- imap_processing/cdf/config/imap_swe_global_cdf_attrs.yaml +7 -0
- imap_processing/cdf/config/imap_swe_l1a_variable_attrs.yaml +14 -14
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +25 -24
- imap_processing/cdf/config/imap_swe_l2_variable_attrs.yaml +238 -0
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +100 -92
- imap_processing/cdf/utils.py +2 -2
- imap_processing/cli.py +45 -9
- imap_processing/codice/codice_l1a.py +104 -58
- imap_processing/codice/constants.py +111 -155
- imap_processing/codice/data/esa_sweep_values.csv +256 -256
- imap_processing/codice/data/lo_stepping_values.csv +128 -128
- imap_processing/ena_maps/ena_maps.py +519 -0
- imap_processing/ena_maps/utils/map_utils.py +145 -0
- imap_processing/ena_maps/utils/spatial_utils.py +226 -0
- imap_processing/glows/__init__.py +3 -0
- imap_processing/glows/ancillary/imap_glows_pipeline_settings_v001.json +52 -0
- imap_processing/glows/l1a/glows_l1a.py +72 -14
- imap_processing/glows/l1b/glows_l1b.py +2 -1
- imap_processing/glows/l1b/glows_l1b_data.py +25 -1
- imap_processing/glows/l2/glows_l2.py +324 -0
- imap_processing/glows/l2/glows_l2_data.py +156 -51
- imap_processing/hi/l1a/science_direct_event.py +57 -51
- imap_processing/hi/l1b/hi_l1b.py +43 -28
- imap_processing/hi/l1c/hi_l1c.py +225 -42
- imap_processing/hi/utils.py +20 -3
- imap_processing/hit/l0/constants.py +2 -2
- imap_processing/hit/l0/decom_hit.py +1 -1
- imap_processing/hit/l1a/hit_l1a.py +94 -13
- imap_processing/hit/l1b/hit_l1b.py +158 -9
- imap_processing/ialirt/l0/process_codicehi.py +156 -0
- imap_processing/ialirt/l0/process_codicelo.py +5 -2
- imap_processing/ialirt/packet_definitions/ialirt.xml +28 -20
- imap_processing/ialirt/packet_definitions/ialirt_codicehi.xml +241 -0
- imap_processing/ialirt/packet_definitions/ialirt_swapi.xml +170 -0
- imap_processing/ialirt/packet_definitions/ialirt_swe.xml +258 -0
- imap_processing/ialirt/process_ephemeris.py +72 -40
- imap_processing/idex/decode.py +241 -0
- imap_processing/idex/idex_l1a.py +143 -81
- imap_processing/idex/idex_l1b.py +244 -10
- imap_processing/lo/l0/lo_science.py +61 -0
- imap_processing/lo/l1a/lo_l1a.py +98 -10
- imap_processing/lo/l1b/lo_l1b.py +2 -2
- imap_processing/lo/l1c/lo_l1c.py +2 -2
- imap_processing/lo/packet_definitions/lo_xtce.xml +1082 -9178
- imap_processing/mag/l0/decom_mag.py +2 -2
- imap_processing/mag/l1a/mag_l1a.py +7 -7
- imap_processing/mag/l1a/mag_l1a_data.py +62 -30
- imap_processing/mag/l1b/mag_l1b.py +11 -6
- imap_processing/quality_flags.py +18 -3
- imap_processing/spice/geometry.py +149 -177
- imap_processing/spice/kernels.py +26 -26
- imap_processing/spice/spin.py +233 -0
- imap_processing/spice/time.py +96 -31
- imap_processing/swapi/l1/swapi_l1.py +60 -31
- imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +363 -384
- imap_processing/swe/l1a/swe_l1a.py +8 -3
- imap_processing/swe/l1a/swe_science.py +24 -24
- imap_processing/swe/l1b/swe_l1b.py +2 -1
- imap_processing/swe/l1b/swe_l1b_science.py +181 -122
- imap_processing/swe/l2/swe_l2.py +337 -70
- imap_processing/swe/utils/swe_utils.py +28 -0
- imap_processing/tests/cdf/test_utils.py +2 -2
- imap_processing/tests/codice/conftest.py +20 -17
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hskp_20241110193622_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-aggregated_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-counters-singles_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-angular_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-priority_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-nsw-species_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-priority_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-species_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/test_codice_l0.py +55 -121
- imap_processing/tests/codice/test_codice_l1a.py +147 -59
- imap_processing/tests/conftest.py +81 -22
- imap_processing/tests/ena_maps/test_ena_maps.py +309 -0
- imap_processing/tests/ena_maps/test_map_utils.py +286 -0
- imap_processing/tests/ena_maps/test_spatial_utils.py +161 -0
- imap_processing/tests/glows/conftest.py +7 -1
- imap_processing/tests/glows/test_glows_l1a_cdf.py +3 -7
- imap_processing/tests/glows/test_glows_l1a_data.py +34 -6
- imap_processing/tests/glows/test_glows_l1b_data.py +29 -17
- imap_processing/tests/glows/test_glows_l2.py +101 -0
- imap_processing/tests/hi/conftest.py +3 -3
- imap_processing/tests/hi/data/l1/imap_hi_l1b_45sensor-de_20250415_v999.cdf +0 -0
- imap_processing/tests/hi/data/l1/imap_his_pset-calibration-prod-config_20240101_v001.csv +31 -0
- imap_processing/tests/hi/test_hi_l1b.py +14 -9
- imap_processing/tests/hi/test_hi_l1c.py +136 -36
- imap_processing/tests/hi/test_l1a.py +0 -2
- imap_processing/tests/hi/test_science_direct_event.py +18 -14
- imap_processing/tests/hi/test_utils.py +16 -11
- imap_processing/tests/hit/helpers/__init__.py +0 -0
- imap_processing/tests/hit/helpers/l1_validation.py +405 -0
- imap_processing/tests/hit/test_data/sci_sample.ccsds +0 -0
- imap_processing/tests/hit/test_decom_hit.py +8 -10
- imap_processing/tests/hit/test_hit_l1a.py +117 -180
- imap_processing/tests/hit/test_hit_l1b.py +149 -55
- imap_processing/tests/hit/validation_data/hit_l1b_standard_sample2_nsrl_v4_3decimals.csv +62 -0
- imap_processing/tests/hit/validation_data/sci_sample_raw.csv +62 -0
- imap_processing/tests/ialirt/test_data/l0/20240827095047_SWE_IALIRT_packet.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/BinLog CCSDS_FRAG_TLM_20240826_152323Z_IALIRT_data_for_SDC.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/eu_SWP_IAL_20240826_152033.csv +644 -0
- imap_processing/tests/ialirt/test_data/l0/hi_fsw_view_1_ccsds.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/idle_export_eu.SWE_IALIRT_20240827_093852.csv +914 -0
- imap_processing/tests/ialirt/test_data/l0/imap_codice_l1a_hi-ialirt_20240523200000_v0.0.0.cdf +0 -0
- imap_processing/tests/ialirt/unit/test_process_codicehi.py +106 -0
- imap_processing/tests/ialirt/unit/test_process_ephemeris.py +33 -5
- imap_processing/tests/ialirt/unit/test_process_swapi.py +85 -0
- imap_processing/tests/ialirt/unit/test_process_swe.py +106 -0
- imap_processing/tests/idex/conftest.py +29 -1
- imap_processing/tests/idex/test_data/compressed_2023_102_14_24_55.pkts +0 -0
- imap_processing/tests/idex/test_data/non_compressed_2023_102_14_22_26.pkts +0 -0
- imap_processing/tests/idex/test_idex_l0.py +6 -3
- imap_processing/tests/idex/test_idex_l1a.py +151 -1
- imap_processing/tests/idex/test_idex_l1b.py +124 -2
- imap_processing/tests/lo/test_lo_l1a.py +62 -2
- imap_processing/tests/lo/test_lo_science.py +85 -0
- imap_processing/tests/lo/validation_data/Instrument_FM1_T104_R129_20240803_ILO_SPIN_EU.csv +2 -0
- imap_processing/tests/mag/conftest.py +16 -0
- imap_processing/tests/mag/test_mag_decom.py +6 -4
- imap_processing/tests/mag/test_mag_l1a.py +36 -7
- imap_processing/tests/mag/test_mag_l1b.py +55 -4
- imap_processing/tests/mag/test_mag_validation.py +148 -0
- imap_processing/tests/mag/validation/L1a/T001/all_p_ones.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T001/mag-l0-l1a-t001-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T002/all_n_ones.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T002/mag-l0-l1a-t002-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T003/field_like.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T003/mag-l0-l1a-t003-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T004/field_like.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T004/mag-l0-l1a-t004-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T005/field_like_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T005/mag-l0-l1a-t005-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T006/hdr_field.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T006/mag-l0-l1a-t006-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T007/hdr_field_and_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T007/mag-l0-l1a-t007-out.csv +17 -0
- imap_processing/tests/mag/validation/L1a/T008/field_like_range_change.txt +19200 -0
- imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-in.bin +0 -0
- imap_processing/tests/mag/validation/L1a/T008/mag-l0-l1a-t008-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T009/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-mago-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T010/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T010/mag-l1a-l1b-t010-mago-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T011/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-mago-out.csv +17 -0
- imap_processing/tests/spice/test_geometry.py +128 -133
- imap_processing/tests/spice/test_kernels.py +37 -37
- imap_processing/tests/spice/test_spin.py +184 -0
- imap_processing/tests/spice/test_time.py +43 -20
- imap_processing/tests/swapi/test_swapi_l1.py +11 -10
- imap_processing/tests/swapi/test_swapi_l2.py +13 -3
- imap_processing/tests/swe/test_swe_l1a.py +1 -1
- imap_processing/tests/swe/test_swe_l1b.py +20 -3
- imap_processing/tests/swe/test_swe_l1b_science.py +54 -35
- imap_processing/tests/swe/test_swe_l2.py +148 -5
- imap_processing/tests/test_cli.py +39 -7
- imap_processing/tests/test_quality_flags.py +19 -19
- imap_processing/tests/test_utils.py +3 -2
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -3314
- imap_processing/tests/ultra/test_data/mock_data.py +161 -0
- imap_processing/tests/ultra/unit/conftest.py +73 -0
- imap_processing/tests/ultra/unit/test_badtimes.py +58 -0
- imap_processing/tests/ultra/unit/test_cullingmask.py +87 -0
- imap_processing/tests/ultra/unit/test_de.py +61 -60
- imap_processing/tests/ultra/unit/test_ultra_l1a.py +3 -3
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +51 -77
- imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +5 -5
- imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py +114 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +86 -26
- imap_processing/tests/ultra/unit/test_ultra_l1c.py +1 -1
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +3 -3
- imap_processing/ultra/constants.py +11 -1
- imap_processing/ultra/l1a/ultra_l1a.py +2 -2
- imap_processing/ultra/l1b/badtimes.py +22 -5
- imap_processing/ultra/l1b/cullingmask.py +31 -5
- imap_processing/ultra/l1b/de.py +32 -37
- imap_processing/ultra/l1b/extendedspin.py +44 -20
- imap_processing/ultra/l1b/ultra_l1b.py +21 -22
- imap_processing/ultra/l1b/ultra_l1b_culling.py +190 -0
- imap_processing/ultra/l1b/ultra_l1b_extended.py +81 -30
- imap_processing/ultra/l1c/histogram.py +6 -2
- imap_processing/ultra/l1c/pset.py +6 -2
- imap_processing/ultra/l1c/ultra_l1c.py +2 -3
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +4 -3
- imap_processing/ultra/utils/ultra_l1_utils.py +70 -14
- imap_processing/utils.py +2 -2
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/METADATA +7 -2
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/RECORD +235 -152
- imap_processing/tests/codice/data/eu_unit_lookup_table.csv +0 -101
- imap_processing/tests/codice/data/idle_export_eu.COD_NHK_20230822_122700 2.csv +0 -100
- imap_processing/tests/codice/data/idle_export_raw.COD_NHK_20230822_122700.csv +0 -100
- imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
- imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
- imap_processing/tests/hit/test_data/sci_sample1.ccsds +0 -0
- imap_processing/tests/ultra/unit/test_spatial_utils.py +0 -125
- imap_processing/ultra/utils/spatial_utils.py +0 -221
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_APP_NHK.csv +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_CNT.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/20231030_H45_SCI_DE.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_NHK_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_cnt_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/H90_sci_de_20241104.bin +0 -0
- /imap_processing/tests/hi/{test_data → data}/l0/README.txt +0 -0
- /imap_processing/tests/idex/{imap_idex_l0_raw_20231214_v001.pkts → test_data/imap_idex_l0_raw_20231214_v001.pkts} +0 -0
- /imap_processing/tests/idex/{impact_14_tof_high_data.txt → test_data/impact_14_tof_high_data.txt} +0 -0
- /imap_processing/tests/mag/{imap_mag_l1a_norm-magi_20251017_v001.cdf → validation/imap_mag_l1a_norm-magi_20251017_v001.cdf} +0 -0
- /imap_processing/tests/mag/{mag_l0_test_data.pkts → validation/mag_l0_test_data.pkts} +0 -0
- /imap_processing/tests/mag/{mag_l0_test_output.csv → validation/mag_l0_test_output.csv} +0 -0
- /imap_processing/tests/mag/{mag_l1_test_data.pkts → validation/mag_l1_test_data.pkts} +0 -0
- /imap_processing/tests/mag/{mag_l1a_test_output.csv → validation/mag_l1a_test_output.csv} +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.9.0.dist-info → imap_processing-0.11.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"""Test creation of solid angle map and other spatial utils."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import numpy.testing as npt
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from imap_processing.ena_maps.utils import spatial_utils
|
|
8
|
+
|
|
9
|
+
# Parameterize with spacings (degrees here):
|
|
10
|
+
valid_spacings = [0.25, 0.5, 1, 5, 10, 20]
|
|
11
|
+
invalid_spacings = [0, -1, 11]
|
|
12
|
+
invalid_spacings_match_str = [
|
|
13
|
+
"Spacing must be positive valued, non-zero.",
|
|
14
|
+
"Spacing must be positive valued, non-zero.",
|
|
15
|
+
"Spacing must divide evenly into pi radians.",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_build_spatial_bins():
|
|
20
|
+
"""Tests build_spatial_bins function."""
|
|
21
|
+
az_bin_edges, el_bin_edges, az_bin_midpoints, el_bin_midpoints = (
|
|
22
|
+
spatial_utils.build_spatial_bins(
|
|
23
|
+
az_spacing_deg=0.5,
|
|
24
|
+
el_spacing_deg=0.5,
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
assert az_bin_edges[0] == 0
|
|
29
|
+
assert az_bin_edges[-1] == 2 * np.pi
|
|
30
|
+
assert len(az_bin_edges) == 721
|
|
31
|
+
|
|
32
|
+
assert el_bin_edges[0] == -np.pi / 2
|
|
33
|
+
assert el_bin_edges[-1] == np.pi / 2
|
|
34
|
+
assert len(el_bin_edges) == 361
|
|
35
|
+
|
|
36
|
+
assert len(az_bin_midpoints) == 720
|
|
37
|
+
np.testing.assert_allclose(az_bin_midpoints[0], np.deg2rad(0.25), atol=1e-4)
|
|
38
|
+
np.testing.assert_allclose(az_bin_midpoints[-1], np.deg2rad(359.75), atol=1e-4)
|
|
39
|
+
|
|
40
|
+
assert len(el_bin_midpoints) == 360
|
|
41
|
+
np.testing.assert_allclose(el_bin_midpoints[0], np.deg2rad(-89.75), atol=1e-4)
|
|
42
|
+
np.testing.assert_allclose(el_bin_midpoints[-1], np.deg2rad(89.75), atol=1e-4)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.mark.parametrize("spacing", valid_spacings)
|
|
46
|
+
def test_build_solid_angle_map_integration(spacing):
|
|
47
|
+
"""Test build_solid_angle_map function integrates to 4 pi steradians."""
|
|
48
|
+
solid_angle_map_steradians = spatial_utils.build_solid_angle_map(
|
|
49
|
+
spacing_deg=spacing
|
|
50
|
+
)
|
|
51
|
+
np.testing.assert_allclose(
|
|
52
|
+
np.sum(solid_angle_map_steradians), 4 * np.pi, atol=0, rtol=1e-9
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.mark.parametrize("spacing", valid_spacings)
|
|
57
|
+
def test_build_solid_angle_map_equal_at_equal_el(spacing):
|
|
58
|
+
"""Test build_solid_angle_map function produces equal solid angle at equal el."""
|
|
59
|
+
solid_angle_map = spatial_utils.build_solid_angle_map(
|
|
60
|
+
spacing_deg=spacing,
|
|
61
|
+
)
|
|
62
|
+
el_grid = spatial_utils.AzElSkyGrid(
|
|
63
|
+
spacing_deg=spacing,
|
|
64
|
+
reversed_elevation=False,
|
|
65
|
+
).el_grid
|
|
66
|
+
for unique_el in np.unique(el_grid):
|
|
67
|
+
solid_angles = solid_angle_map[el_grid == unique_el]
|
|
68
|
+
np.testing.assert_allclose(solid_angles, solid_angles[0])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@pytest.mark.parametrize(
|
|
72
|
+
"spacing, match_str", zip(invalid_spacings, invalid_spacings_match_str)
|
|
73
|
+
)
|
|
74
|
+
def test_build_solid_angle_map_invalid_spacing(spacing, match_str):
|
|
75
|
+
"""Test build_solid_angle_map function raises error for invalid spacing."""
|
|
76
|
+
with pytest.raises(ValueError, match=match_str):
|
|
77
|
+
_ = spatial_utils.build_solid_angle_map(
|
|
78
|
+
spacing_deg=spacing,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@pytest.mark.parametrize("order", ["C", "F"])
|
|
83
|
+
def test_rewrap_even_spaced_az_el_grid_1d(order):
|
|
84
|
+
"""Test rewrap_even_spaced_az_el_grid function, without extra axis."""
|
|
85
|
+
orig_shape = (360 * 12, 180 * 12)
|
|
86
|
+
orig_grid = np.fromfunction(lambda i, j: i**2 + j, orig_shape, dtype=int)
|
|
87
|
+
raveled_values = orig_grid.ravel(order=order)
|
|
88
|
+
rewrapped_grid_infer_shape = spatial_utils.rewrap_even_spaced_az_el_grid(
|
|
89
|
+
raveled_values,
|
|
90
|
+
order=order,
|
|
91
|
+
)
|
|
92
|
+
rewrapped_grid_known_shape = spatial_utils.rewrap_even_spaced_az_el_grid(
|
|
93
|
+
raveled_values,
|
|
94
|
+
shape=orig_shape,
|
|
95
|
+
order=order,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
assert np.array_equal(rewrapped_grid_infer_shape, orig_grid)
|
|
99
|
+
assert np.array_equal(rewrapped_grid_known_shape, orig_grid)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@pytest.mark.parametrize("order", ["C", "F"])
|
|
103
|
+
def test_rewrap_even_spaced_az_el_grid_2d(order):
|
|
104
|
+
"""Test rewrap_even_spaced_az_el_grid function, with extra axis."""
|
|
105
|
+
orig_shape = (360 * 12, 180 * 12, 5)
|
|
106
|
+
orig_grid = np.fromfunction(lambda i, j, k: i**2 + j + k, orig_shape, dtype=int)
|
|
107
|
+
raveled_values = orig_grid.reshape(-1, 5, order=order)
|
|
108
|
+
rewrapped_grid_infer_shape = spatial_utils.rewrap_even_spaced_az_el_grid(
|
|
109
|
+
raveled_values,
|
|
110
|
+
order=order,
|
|
111
|
+
)
|
|
112
|
+
rewrapped_grid_known_shape = spatial_utils.rewrap_even_spaced_az_el_grid(
|
|
113
|
+
raveled_values,
|
|
114
|
+
shape=orig_shape,
|
|
115
|
+
order=order,
|
|
116
|
+
)
|
|
117
|
+
assert raveled_values.shape == (360 * 12 * 180 * 12, 5)
|
|
118
|
+
assert np.array_equal(rewrapped_grid_infer_shape, orig_grid)
|
|
119
|
+
assert np.array_equal(rewrapped_grid_known_shape, orig_grid)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class TestAzElSkyGrid:
|
|
123
|
+
@pytest.mark.parametrize("spacing", valid_spacings)
|
|
124
|
+
def test_instantiate_and_values(self, spacing):
|
|
125
|
+
grid = spatial_utils.AzElSkyGrid(
|
|
126
|
+
spacing_deg=spacing,
|
|
127
|
+
reversed_elevation=False,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Size checks
|
|
131
|
+
assert grid.az_bin_midpoints.size == int(360 / spacing) == grid.grid_shape[0]
|
|
132
|
+
assert grid.el_bin_midpoints.size == int(180 / spacing) == grid.grid_shape[1]
|
|
133
|
+
assert grid.az_grid.shape == grid.el_grid.shape == grid.grid_shape
|
|
134
|
+
|
|
135
|
+
# Check grid values in radians
|
|
136
|
+
expected_azimuth_bin_midpoints_deg = np.arange(
|
|
137
|
+
(spacing / 2), 360 + (spacing / 2), spacing
|
|
138
|
+
)
|
|
139
|
+
expected_elevation_bin_midpoints_deg = np.arange(
|
|
140
|
+
-90 + (spacing / 2), 90 + (spacing / 2), spacing
|
|
141
|
+
)
|
|
142
|
+
npt.assert_allclose(
|
|
143
|
+
grid.az_bin_midpoints,
|
|
144
|
+
np.deg2rad(expected_azimuth_bin_midpoints_deg),
|
|
145
|
+
atol=1e-11,
|
|
146
|
+
)
|
|
147
|
+
npt.assert_allclose(
|
|
148
|
+
grid.el_bin_midpoints,
|
|
149
|
+
np.deg2rad(expected_elevation_bin_midpoints_deg),
|
|
150
|
+
atol=1e-11,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Check bin edges in degrees, radians
|
|
154
|
+
expected_az_bin_edges_deg = np.arange(0, 360 + spacing, spacing)
|
|
155
|
+
expected_el_bin_edges_deg = np.arange(-90, 90 + spacing, spacing)
|
|
156
|
+
npt.assert_allclose(
|
|
157
|
+
grid.az_bin_edges, np.deg2rad(expected_az_bin_edges_deg), atol=1e-11
|
|
158
|
+
)
|
|
159
|
+
npt.assert_allclose(
|
|
160
|
+
grid.el_bin_edges, np.deg2rad(expected_el_bin_edges_deg), atol=1e-11
|
|
161
|
+
)
|
|
@@ -7,6 +7,7 @@ from imap_processing.glows.l0 import decom_glows
|
|
|
7
7
|
from imap_processing.glows.l1a.glows_l1a import glows_l1a, process_de_l0
|
|
8
8
|
from imap_processing.glows.l1a.glows_l1a_data import HistogramL1A
|
|
9
9
|
from imap_processing.glows.l1b.glows_l1b import glows_l1b
|
|
10
|
+
from imap_processing.glows.l2.glows_l2 import glows_l2
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@pytest.fixture()
|
|
@@ -45,4 +46,9 @@ def l1a_dataset(packet_path):
|
|
|
45
46
|
|
|
46
47
|
@pytest.fixture()
|
|
47
48
|
def l1b_hist_dataset(l1a_dataset):
|
|
48
|
-
return glows_l1b(l1a_dataset[
|
|
49
|
+
return glows_l1b(l1a_dataset[1], "v001")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@pytest.fixture()
|
|
53
|
+
def l2_hist_dataset(l1b_datasets):
|
|
54
|
+
return glows_l2(l1b_datasets, "v001")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import dataclasses
|
|
2
2
|
from functools import reduce
|
|
3
|
-
from pathlib import Path
|
|
4
3
|
|
|
5
4
|
import numpy as np
|
|
6
5
|
import pytest
|
|
@@ -16,13 +15,10 @@ from imap_processing.glows.l1a.glows_l1a_data import HistogramL1A
|
|
|
16
15
|
from imap_processing.glows.utils.constants import TimeTuple
|
|
17
16
|
|
|
18
17
|
|
|
19
|
-
@pytest.fixture(
|
|
20
|
-
def l1a_data():
|
|
18
|
+
@pytest.fixture()
|
|
19
|
+
def l1a_data(packet_path):
|
|
21
20
|
"""Read test data from file"""
|
|
22
|
-
|
|
23
|
-
packet_path = (
|
|
24
|
-
current_directory / "validation_data" / "glows_test_packet_20110921_v01.pkts"
|
|
25
|
-
)
|
|
21
|
+
|
|
26
22
|
histogram_l0, de_l0 = decom_glows.decom_packets(packet_path)
|
|
27
23
|
|
|
28
24
|
histogram_l1a = [HistogramL1A(hist) for hist in histogram_l0]
|
|
@@ -8,12 +8,14 @@ import pandas as pd
|
|
|
8
8
|
import pytest
|
|
9
9
|
|
|
10
10
|
from imap_processing.glows import __version__
|
|
11
|
+
from imap_processing.glows.l1a.glows_l1a import glows_l1a
|
|
11
12
|
from imap_processing.glows.l1a.glows_l1a_data import (
|
|
12
13
|
DirectEventL1A,
|
|
13
14
|
HistogramL1A,
|
|
14
15
|
StatusData,
|
|
15
16
|
)
|
|
16
17
|
from imap_processing.glows.utils.constants import DirectEvent, GlowsConstants, TimeTuple
|
|
18
|
+
from imap_processing.spice.time import met_to_ttj2000ns
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
@pytest.fixture()
|
|
@@ -38,6 +40,22 @@ def test_histogram_list(histogram_test_data, decom_test_data):
|
|
|
38
40
|
assert sum(histogram_test_data.histogram) == histl0.EVENTS
|
|
39
41
|
|
|
40
42
|
|
|
43
|
+
def test_histogram_obs_day(packet_path):
|
|
44
|
+
l1a = glows_l1a(packet_path, "v001")
|
|
45
|
+
|
|
46
|
+
assert len(l1a) == 3
|
|
47
|
+
|
|
48
|
+
assert "hist" in l1a[0].attrs["Logical_source"]
|
|
49
|
+
assert "hist" in l1a[1].attrs["Logical_source"]
|
|
50
|
+
|
|
51
|
+
# Numbers pulled from the validation data.
|
|
52
|
+
# this test assumes that the "is_night" flag switching from true to false is the
|
|
53
|
+
# start of the observation day.
|
|
54
|
+
|
|
55
|
+
assert np.array_equal(l1a[0]["imap_start_time"].data[0], 54232215.0)
|
|
56
|
+
assert np.array_equal(l1a[1]["imap_start_time"].data[0], 54232455.0)
|
|
57
|
+
|
|
58
|
+
|
|
41
59
|
def test_histogram_attributes(histogram_test_data):
|
|
42
60
|
"""Test other data in histogram packet"""
|
|
43
61
|
|
|
@@ -488,7 +506,8 @@ def test_expected_de_results(l1a_test_data):
|
|
|
488
506
|
|
|
489
507
|
|
|
490
508
|
def test_expected_hist_results(l1a_dataset):
|
|
491
|
-
|
|
509
|
+
end_time = l1a_dataset[0]["epoch"].data[-1]
|
|
510
|
+
|
|
492
511
|
validation_data = (
|
|
493
512
|
Path(__file__).parent / "validation_data" / "glows_l1a_hist_validation.json"
|
|
494
513
|
)
|
|
@@ -521,15 +540,24 @@ def test_expected_hist_results(l1a_dataset):
|
|
|
521
540
|
"pulse_length_variance",
|
|
522
541
|
]
|
|
523
542
|
|
|
524
|
-
for
|
|
543
|
+
for data in out["output"]:
|
|
544
|
+
epoch_val = met_to_ttj2000ns(
|
|
545
|
+
TimeTuple(
|
|
546
|
+
data["imap_start_time"]["seconds"],
|
|
547
|
+
data["imap_start_time"]["subseconds"],
|
|
548
|
+
).to_seconds()
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
# Validation data spans the two obs days, so this selects the correct output
|
|
552
|
+
dataset_index = 1 if epoch_val > end_time else 0
|
|
553
|
+
datapoint = l1a_dataset[dataset_index].sel(epoch=epoch_val)
|
|
554
|
+
|
|
525
555
|
for field in time_fields.keys():
|
|
526
556
|
expected_time = (
|
|
527
557
|
data[field]["seconds"]
|
|
528
558
|
+ data[field]["subseconds"] / GlowsConstants.SUBSECOND_LIMIT
|
|
529
559
|
)
|
|
530
|
-
assert np.array_equal(
|
|
531
|
-
expected_time, hist.isel(epoch=index)[time_fields[field]].data
|
|
532
|
-
)
|
|
560
|
+
assert np.array_equal(expected_time, datapoint[time_fields[field]].data)
|
|
533
561
|
|
|
534
562
|
for field in compare_fields:
|
|
535
|
-
assert np.array_equal(data[field],
|
|
563
|
+
assert np.array_equal(data[field], datapoint[field].data)
|
|
@@ -5,7 +5,12 @@ import numpy as np
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
7
|
from imap_processing.glows.l1b.glows_l1b import glows_l1b
|
|
8
|
-
from imap_processing.glows.l1b.glows_l1b_data import
|
|
8
|
+
from imap_processing.glows.l1b.glows_l1b_data import (
|
|
9
|
+
AncillaryParameters,
|
|
10
|
+
DirectEventL1B,
|
|
11
|
+
HistogramL1B,
|
|
12
|
+
)
|
|
13
|
+
from imap_processing.spice.time import met_to_ttj2000ns
|
|
9
14
|
|
|
10
15
|
|
|
11
16
|
def test_glows_l1b_ancillary_file():
|
|
@@ -75,11 +80,8 @@ def test_glows_l1b_de():
|
|
|
75
80
|
|
|
76
81
|
|
|
77
82
|
def test_validation_data_histogram(l1a_dataset):
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
l1b_day_one = glows_l1b(hist_day_one, "v001")
|
|
82
|
-
l1b_day_two = glows_l1b(hist_day_two, "v001")
|
|
83
|
+
l1b = [glows_l1b(l1a_dataset[0], "v001"), glows_l1b(l1a_dataset[1], "v001")]
|
|
84
|
+
end_time = l1b[0]["epoch"].data[-1]
|
|
83
85
|
|
|
84
86
|
validation_data = (
|
|
85
87
|
Path(__file__).parent
|
|
@@ -122,26 +124,23 @@ def test_validation_data_histogram(l1a_dataset):
|
|
|
122
124
|
# "spacecraft_velocity_std_dev": "spacecraft_velocity_std_dev",
|
|
123
125
|
}
|
|
124
126
|
|
|
125
|
-
for
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
l1b_index = index - l1b_day_one.epoch.size
|
|
132
|
-
l1b = l1b_day_two
|
|
127
|
+
for validation_output in out["output"]:
|
|
128
|
+
epoch_val = met_to_ttj2000ns(validation_output["imap_start_time"])
|
|
129
|
+
|
|
130
|
+
# Validation data spans the two obs days, so this selects the correct output
|
|
131
|
+
dataset_index = 1 if epoch_val > end_time else 0
|
|
132
|
+
datapoint = l1b[dataset_index].sel(epoch=epoch_val)
|
|
133
133
|
|
|
134
134
|
assert np.equal(
|
|
135
135
|
validation_output["imap_start_time"],
|
|
136
|
-
|
|
136
|
+
datapoint.imap_start_time.data,
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
for key in validation_output:
|
|
140
140
|
if key not in expected_matching_columns.keys():
|
|
141
141
|
continue
|
|
142
|
-
|
|
143
142
|
np.testing.assert_array_almost_equal(
|
|
144
|
-
|
|
143
|
+
datapoint[expected_matching_columns[key]].data,
|
|
145
144
|
validation_output[key],
|
|
146
145
|
decimal=1,
|
|
147
146
|
)
|
|
@@ -185,3 +184,16 @@ def test_validation_data_de(l1a_dataset):
|
|
|
185
184
|
np.testing.assert_array_almost_equal(
|
|
186
185
|
l1b[key].isel(epoch=index).data, validation_output[key], decimal=1
|
|
187
186
|
)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@pytest.mark.parametrize(
|
|
190
|
+
"flags, expected",
|
|
191
|
+
[
|
|
192
|
+
(0, np.zeros(10)),
|
|
193
|
+
(64, np.array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0])),
|
|
194
|
+
(65, np.array([1, 0, 0, 0, 0, 0, 1, 0, 0, 0])),
|
|
195
|
+
],
|
|
196
|
+
)
|
|
197
|
+
def test_deserialize_flags(flags, expected):
|
|
198
|
+
output = HistogramL1B.deserialize_flags(flags)
|
|
199
|
+
assert np.array_equal(output, expected)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pytest
|
|
3
|
+
import xarray as xr
|
|
4
|
+
|
|
5
|
+
from imap_processing.glows.l2.glows_l2 import (
|
|
6
|
+
generate_l2,
|
|
7
|
+
glows_l2,
|
|
8
|
+
return_good_times,
|
|
9
|
+
)
|
|
10
|
+
from imap_processing.glows.l2.glows_l2_data import DailyLightcurve
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@pytest.fixture()
|
|
14
|
+
def l1b_hists():
|
|
15
|
+
epoch = xr.DataArray(np.arange(4), name="epoch", dims=["epoch"])
|
|
16
|
+
bins = xr.DataArray(np.arange(5), name="bins", dims=["bins"])
|
|
17
|
+
hist = xr.DataArray(
|
|
18
|
+
np.ones((4, 5)), dims=["epoch", "bins"], coords={"epoch": epoch, "bins": bins}
|
|
19
|
+
)
|
|
20
|
+
hist[1, 0] = -1
|
|
21
|
+
hist[2, 0] = -1
|
|
22
|
+
hist[1, 1] = -1
|
|
23
|
+
hist[2, 3] = -1
|
|
24
|
+
|
|
25
|
+
input = xr.Dataset(coords={"epoch": epoch, "bins": bins})
|
|
26
|
+
input["histogram"] = hist
|
|
27
|
+
|
|
28
|
+
return input
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_glows_l2(l1b_hist_dataset):
|
|
32
|
+
l2 = glows_l2(l1b_hist_dataset, "v001")[0]
|
|
33
|
+
assert l2.attrs["Logical_source"] == "imap_glows_l2_hist"
|
|
34
|
+
|
|
35
|
+
assert np.allclose(l2["filter_temperature_average"].values, [57.6], rtol=0.1)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.mark.skip(reason="Spin table not yet complete")
|
|
39
|
+
def test_split_by_observational_day(l1b_hist_dataset):
|
|
40
|
+
# TODO: Complete test when spin table is complete
|
|
41
|
+
raise NotImplementedError
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_filter_good_times():
|
|
45
|
+
active_flags = np.ones((17,))
|
|
46
|
+
active_flags[16] = 0
|
|
47
|
+
test_flags = np.ones((4, 17))
|
|
48
|
+
test_flags[1, 0] = 0
|
|
49
|
+
test_flags[3, 16] = 0
|
|
50
|
+
flags = xr.DataArray(test_flags, dims=["epoch", "flags"])
|
|
51
|
+
|
|
52
|
+
good_times = return_good_times(flags, active_flags)
|
|
53
|
+
expected_good_times = [0, 2, 3]
|
|
54
|
+
|
|
55
|
+
assert np.array_equal(good_times, expected_good_times)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_generate_l2(l1b_hist_dataset):
|
|
59
|
+
l2 = generate_l2(l1b_hist_dataset)
|
|
60
|
+
|
|
61
|
+
expected_values = {
|
|
62
|
+
"filter_temperature_average": [57.59],
|
|
63
|
+
"filter_temperature_std_dev": [0.21],
|
|
64
|
+
"hv_voltage_average": [1715.4],
|
|
65
|
+
"hv_voltage_std_dev": [0.0],
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
assert np.isclose(
|
|
69
|
+
l2.filter_temperature_average,
|
|
70
|
+
expected_values["filter_temperature_average"],
|
|
71
|
+
0.01,
|
|
72
|
+
)
|
|
73
|
+
assert np.isclose(
|
|
74
|
+
l2.filter_temperature_std_dev,
|
|
75
|
+
expected_values["filter_temperature_std_dev"],
|
|
76
|
+
0.01,
|
|
77
|
+
)
|
|
78
|
+
assert np.isclose(
|
|
79
|
+
l2.hv_voltage_average, expected_values["hv_voltage_average"], 0.01
|
|
80
|
+
)
|
|
81
|
+
assert np.isclose(
|
|
82
|
+
l2.hv_voltage_std_dev, expected_values["hv_voltage_std_dev"], 0.01
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_exposure_times(l1b_hists):
|
|
87
|
+
exposure_time = xr.DataArray([10, 10, 20, 10])
|
|
88
|
+
expected_times = np.array([20, 40, 50, 30, 50])
|
|
89
|
+
|
|
90
|
+
times = DailyLightcurve.calculate_exposure_times(l1b_hists, exposure_time)
|
|
91
|
+
|
|
92
|
+
assert np.array_equal(times, expected_times)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_bin_exclusions(l1b_hists):
|
|
96
|
+
# TODO test excluding bins as well
|
|
97
|
+
|
|
98
|
+
raw_hists = DailyLightcurve.calculate_histogram_sums(l1b_hists["histogram"].data)
|
|
99
|
+
expected_values = [2, 3, 4, 3, 4]
|
|
100
|
+
|
|
101
|
+
assert np.array_equal(raw_hists, expected_values)
|
|
@@ -5,7 +5,7 @@ import pytest
|
|
|
5
5
|
|
|
6
6
|
@pytest.fixture(scope="session")
|
|
7
7
|
def hi_test_data_path(imap_tests_path):
|
|
8
|
-
return imap_tests_path / "hi" / "
|
|
8
|
+
return imap_tests_path / "hi" / "data"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@pytest.fixture(scope="session")
|
|
@@ -14,8 +14,8 @@ def hi_l0_test_data_path(hi_test_data_path):
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@pytest.fixture(scope="session")
|
|
17
|
-
def
|
|
18
|
-
return hi_test_data_path / "
|
|
17
|
+
def hi_l1_test_data_path(hi_test_data_path):
|
|
18
|
+
return hi_test_data_path / "l1"
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def create_metaevent(esa_step, met_subseconds, met_seconds):
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Calibration Product DE Filter Configuration File
|
|
2
|
+
# Valid start date: 2024-01-01 (from filename)
|
|
3
|
+
# This file will be used in processing until a new calibration file is uploaded
|
|
4
|
+
# to the SDC with either a higher version number or new date in the filename.
|
|
5
|
+
# For details on how the SDC selects ancillary files for processing, see:
|
|
6
|
+
# https://imap-processing.readthedocs.io/en/latest/data-access/calibration-files.html
|
|
7
|
+
#
|
|
8
|
+
# When creating PSET products, the following table will be used to filter the list
|
|
9
|
+
# of DEs into the into calibration product categories at each ESA energy step. Only
|
|
10
|
+
# DEs with coincidence type contained in the `coincidence_type_list` and time-of-flight
|
|
11
|
+
# values that are in the inclusive range specified by the low and high entries for each
|
|
12
|
+
# energy step are included in the angular pset bins.
|
|
13
|
+
cal_prod_num,esa_energy_step,coincidence_type_list,tof_ab_low,tof_ab_high,tof_ac1_low,tof_ac1_high,tof_bc1_low,tof_bc1_high,tof_c1c2_low,tof_c1c2_high
|
|
14
|
+
0,1,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
15
|
+
0,2,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
16
|
+
0,3,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
17
|
+
0,4,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
18
|
+
0,5,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
19
|
+
0,6,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
20
|
+
0,7,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
21
|
+
0,8,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
22
|
+
0,9,ABC1C2|ABC1|AC1C2,15,55,0,70,-50,10,5,25
|
|
23
|
+
1,1,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
24
|
+
1,2,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
25
|
+
1,3,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
26
|
+
1,4,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
27
|
+
1,5,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
28
|
+
1,6,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
29
|
+
1,7,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
30
|
+
1,8,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
31
|
+
1,9,BC1C2|AB|AC1,15,55,0,70,-50,10,5,25
|
|
@@ -32,17 +32,18 @@ def test_hi_l1b_hk(hi_l0_test_data_path):
|
|
|
32
32
|
assert l1b_dataset.attrs["Logical_source"] == "imap_hi_l1b_90sensor-hk"
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
@pytest.mark.external_test_data()
|
|
35
36
|
@pytest.mark.external_kernel()
|
|
36
37
|
@pytest.mark.use_test_metakernel("imap_ena_sim_metakernel.template")
|
|
37
38
|
def test_hi_l1b_de(
|
|
38
|
-
|
|
39
|
+
hi_l1_test_data_path, spice_test_data_path, use_fake_spin_data_for_time
|
|
39
40
|
):
|
|
40
41
|
"""Test coverage for imap_processing.hi.hi_l1b.hi_l1b() with
|
|
41
42
|
direct events L1A as input"""
|
|
42
43
|
# Start MET time of spin for simulated input data is 482372988
|
|
43
|
-
use_fake_spin_data_for_time(
|
|
44
|
+
use_fake_spin_data_for_time(482372987.999)
|
|
44
45
|
l1a_test_file_path = (
|
|
45
|
-
|
|
46
|
+
hi_l1_test_data_path / "imap_hi_l1a_45sensor-de_20250415_v999.cdf"
|
|
46
47
|
)
|
|
47
48
|
# Process using test data
|
|
48
49
|
data_version = "001"
|
|
@@ -50,7 +51,7 @@ def test_hi_l1b_de(
|
|
|
50
51
|
|
|
51
52
|
l1b_dataset = hi_l1b(l1a_dataset, data_version=data_version)
|
|
52
53
|
assert l1b_dataset.attrs["Logical_source"] == "imap_hi_l1b_45sensor-de"
|
|
53
|
-
assert len(l1b_dataset.data_vars) ==
|
|
54
|
+
assert len(l1b_dataset.data_vars) == 15
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
@pytest.fixture()
|
|
@@ -95,11 +96,11 @@ def synthetic_trigger_id_and_tof_data():
|
|
|
95
96
|
)
|
|
96
97
|
data = [arr[good_inds] for arr in data]
|
|
97
98
|
data_vars = {
|
|
98
|
-
n: xr.DataArray(arr, dims=["
|
|
99
|
+
n: xr.DataArray(arr, dims=["event_met"]) for n, arr in zip(var_names, data)
|
|
99
100
|
}
|
|
100
101
|
synthetic_l1a_ds = xr.Dataset(
|
|
101
102
|
coords={
|
|
102
|
-
"
|
|
103
|
+
"event_met": xr.DataArray(
|
|
103
104
|
np.arange(data_vars["trigger_id"].size), name="epoch", dims=["epoch"]
|
|
104
105
|
)
|
|
105
106
|
},
|
|
@@ -226,15 +227,19 @@ def test_compute_hae_coordinates(mock_instrument_pointing, sensor_number):
|
|
|
226
227
|
# Make a fake dataset with epoch and Logical_source
|
|
227
228
|
fake_dataset = xr.Dataset(
|
|
228
229
|
attrs={"Logical_source": f"imap_hi_l1a_{sensor_number}sensor-de"},
|
|
229
|
-
coords={
|
|
230
|
+
coords={
|
|
231
|
+
"event_met": xr.DataArray(
|
|
232
|
+
np.arange(200), name="event_met", dims=["event_met"]
|
|
233
|
+
)
|
|
234
|
+
},
|
|
230
235
|
)
|
|
231
236
|
|
|
232
237
|
new_vars = compute_hae_coordinates(fake_dataset)
|
|
233
238
|
assert "hae_latitude" in new_vars
|
|
234
|
-
assert new_vars["hae_latitude"].shape == fake_dataset.
|
|
239
|
+
assert new_vars["hae_latitude"].shape == fake_dataset.event_met.shape
|
|
235
240
|
np.testing.assert_allclose(new_vars["hae_latitude"].values, sensor_number)
|
|
236
241
|
assert "hae_longitude" in new_vars
|
|
237
|
-
assert new_vars["hae_longitude"].shape == fake_dataset.
|
|
242
|
+
assert new_vars["hae_longitude"].shape == fake_dataset.event_met.shape
|
|
238
243
|
np.testing.assert_allclose(new_vars["hae_longitude"].values, sensor_number)
|
|
239
244
|
|
|
240
245
|
|