imap-processing 0.11.0__py3-none-any.whl → 0.12.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/__init__.py +10 -11
- imap_processing/_version.py +2 -2
- imap_processing/ccsds/excel_to_xtce.py +65 -16
- imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +6 -28
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +365 -42
- imap_processing/cdf/config/imap_glows_global_cdf_attrs.yaml +0 -5
- imap_processing/cdf/config/imap_hi_global_cdf_attrs.yaml +10 -11
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +17 -19
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +26 -13
- imap_processing/cdf/config/imap_hit_l1a_variable_attrs.yaml +106 -116
- imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml +120 -145
- imap_processing/cdf/config/imap_hit_l2_variable_attrs.yaml +14 -0
- imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +6 -9
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +1 -1
- imap_processing/cdf/config/imap_lo_global_cdf_attrs.yaml +0 -12
- imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +1 -1
- imap_processing/cdf/config/imap_mag_global_cdf_attrs.yaml +9 -21
- imap_processing/cdf/config/imap_mag_l1a_variable_attrs.yaml +361 -0
- imap_processing/cdf/config/imap_mag_l1b_variable_attrs.yaml +160 -0
- imap_processing/cdf/config/imap_mag_l1c_variable_attrs.yaml +160 -0
- imap_processing/cdf/config/imap_spacecraft_global_cdf_attrs.yaml +18 -0
- imap_processing/cdf/config/imap_spacecraft_variable_attrs.yaml +40 -0
- imap_processing/cdf/config/imap_swapi_global_cdf_attrs.yaml +1 -5
- imap_processing/cdf/config/imap_swe_global_cdf_attrs.yaml +12 -4
- imap_processing/cdf/config/imap_swe_l1a_variable_attrs.yaml +16 -2
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +48 -52
- imap_processing/cdf/config/imap_swe_l2_variable_attrs.yaml +71 -47
- imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml +2 -14
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +51 -2
- imap_processing/cdf/config/imap_ultra_l1c_variable_attrs.yaml +29 -14
- imap_processing/cdf/utils.py +13 -7
- imap_processing/cli.py +23 -8
- imap_processing/codice/codice_l1a.py +207 -85
- imap_processing/codice/constants.py +1322 -568
- imap_processing/codice/decompress.py +2 -6
- imap_processing/ena_maps/ena_maps.py +480 -116
- imap_processing/ena_maps/utils/coordinates.py +19 -0
- imap_processing/ena_maps/utils/map_utils.py +14 -17
- imap_processing/ena_maps/utils/spatial_utils.py +45 -47
- imap_processing/hi/l1a/hi_l1a.py +24 -18
- imap_processing/hi/l1a/histogram.py +0 -1
- imap_processing/hi/l1a/science_direct_event.py +6 -8
- imap_processing/hi/l1b/hi_l1b.py +31 -39
- imap_processing/hi/l1c/hi_l1c.py +405 -17
- imap_processing/hi/utils.py +58 -12
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-standard-dt0-factors_20250219_v002.csv +205 -0
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-standard-dt1-factors_20250219_v002.csv +205 -0
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-standard-dt2-factors_20250219_v002.csv +205 -0
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-standard-dt3-factors_20250219_v002.csv +205 -0
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-summed-dt0-factors_20250219_v002.csv +68 -0
- imap_processing/hit/hit_utils.py +173 -1
- imap_processing/hit/l0/constants.py +20 -11
- imap_processing/hit/l0/decom_hit.py +18 -4
- imap_processing/hit/l1a/hit_l1a.py +45 -54
- imap_processing/hit/l1b/constants.py +317 -0
- imap_processing/hit/l1b/hit_l1b.py +367 -18
- imap_processing/hit/l2/constants.py +281 -0
- imap_processing/hit/l2/hit_l2.py +614 -0
- imap_processing/hit/packet_definitions/hit_packet_definitions.xml +1323 -71
- imap_processing/ialirt/l0/mag_l0_ialirt_data.py +155 -0
- imap_processing/ialirt/l0/parse_mag.py +246 -0
- imap_processing/ialirt/l0/process_swe.py +252 -0
- imap_processing/ialirt/packet_definitions/ialirt.xml +7 -3
- imap_processing/ialirt/packet_definitions/ialirt_mag.xml +115 -0
- imap_processing/ialirt/utils/grouping.py +114 -0
- imap_processing/ialirt/utils/time.py +29 -0
- imap_processing/idex/atomic_masses.csv +22 -0
- imap_processing/idex/decode.py +2 -2
- imap_processing/idex/idex_constants.py +25 -0
- imap_processing/idex/idex_l1a.py +6 -7
- imap_processing/idex/idex_l1b.py +4 -31
- imap_processing/idex/idex_l2a.py +789 -0
- imap_processing/idex/idex_variable_unpacking_and_eu_conversion.csv +39 -33
- imap_processing/lo/l0/lo_science.py +6 -0
- imap_processing/lo/l1a/lo_l1a.py +0 -1
- imap_processing/lo/l1b/lo_l1b.py +177 -25
- imap_processing/mag/constants.py +8 -0
- imap_processing/mag/imap_mag_sdc-configuration_v001.yaml +6 -0
- imap_processing/mag/l0/decom_mag.py +10 -3
- imap_processing/mag/l1a/mag_l1a.py +22 -11
- imap_processing/mag/l1a/mag_l1a_data.py +28 -3
- imap_processing/mag/l1b/mag_l1b.py +190 -48
- imap_processing/mag/l1c/interpolation_methods.py +211 -0
- imap_processing/mag/l1c/mag_l1c.py +447 -9
- imap_processing/quality_flags.py +1 -0
- imap_processing/spacecraft/packet_definitions/scid_x252.xml +538 -0
- imap_processing/spacecraft/quaternions.py +123 -0
- imap_processing/spice/geometry.py +16 -19
- imap_processing/spice/repoint.py +120 -0
- imap_processing/swapi/l1/swapi_l1.py +4 -0
- imap_processing/swapi/l2/swapi_l2.py +0 -1
- imap_processing/swe/l1a/swe_l1a.py +47 -8
- imap_processing/swe/l1a/swe_science.py +5 -2
- imap_processing/swe/l1b/swe_l1b_science.py +103 -56
- imap_processing/swe/l2/swe_l2.py +60 -65
- imap_processing/swe/packet_definitions/swe_packet_definition.xml +1121 -1
- imap_processing/swe/utils/swe_constants.py +63 -0
- imap_processing/swe/utils/swe_utils.py +85 -28
- imap_processing/tests/ccsds/test_data/expected_output.xml +40 -1
- imap_processing/tests/ccsds/test_excel_to_xtce.py +23 -20
- imap_processing/tests/cdf/test_data/imap_instrument2_global_cdf_attrs.yaml +0 -2
- imap_processing/tests/codice/conftest.py +1 -1
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-counters-aggregated_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-counters-singles_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-ialirt_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-omni_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-pha_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-priorities_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-sectored_20241110193700_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-ialirt_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-pha_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_l1a.py +110 -46
- imap_processing/tests/codice/test_decompress.py +4 -4
- imap_processing/tests/conftest.py +166 -10
- imap_processing/tests/ena_maps/conftest.py +51 -0
- imap_processing/tests/ena_maps/test_ena_maps.py +638 -109
- imap_processing/tests/ena_maps/test_map_utils.py +66 -43
- imap_processing/tests/ena_maps/test_spatial_utils.py +16 -20
- imap_processing/tests/hi/data/l0/H45_diag_fee_20250208.bin +0 -0
- imap_processing/tests/hi/data/l0/H45_diag_fee_20250208_verify.csv +205 -0
- imap_processing/tests/hi/test_hi_l1b.py +12 -15
- imap_processing/tests/hi/test_hi_l1c.py +234 -6
- imap_processing/tests/hi/test_l1a.py +30 -0
- imap_processing/tests/hi/test_science_direct_event.py +1 -1
- imap_processing/tests/hi/test_utils.py +24 -2
- imap_processing/tests/hit/helpers/l1_validation.py +39 -39
- imap_processing/tests/hit/test_data/hskp_sample.ccsds +0 -0
- imap_processing/tests/hit/test_data/imap_hit_l0_raw_20100105_v001.pkts +0 -0
- imap_processing/tests/hit/test_decom_hit.py +4 -0
- imap_processing/tests/hit/test_hit_l1a.py +24 -28
- imap_processing/tests/hit/test_hit_l1b.py +304 -40
- imap_processing/tests/hit/test_hit_l2.py +454 -0
- imap_processing/tests/hit/test_hit_utils.py +112 -2
- imap_processing/tests/hit/validation_data/hskp_sample_eu_3_6_2025.csv +89 -0
- imap_processing/tests/hit/validation_data/hskp_sample_raw.csv +89 -88
- imap_processing/tests/ialirt/test_data/l0/461971383-404.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971384-405.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971385-406.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971386-407.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971387-408.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971388-409.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971389-410.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971390-411.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/461971391-412.bin +0 -0
- imap_processing/tests/ialirt/test_data/l0/sample_decoded_i-alirt_data.csv +383 -0
- imap_processing/tests/ialirt/unit/test_grouping.py +81 -0
- imap_processing/tests/ialirt/unit/test_parse_mag.py +168 -0
- imap_processing/tests/ialirt/unit/test_process_swe.py +208 -3
- imap_processing/tests/ialirt/unit/test_time.py +16 -0
- imap_processing/tests/idex/conftest.py +62 -6
- imap_processing/tests/idex/test_data/imap_idex_l0_raw_20231218_v001.pkts +0 -0
- imap_processing/tests/idex/test_data/impact_14_tof_high_data.txt +4508 -4508
- imap_processing/tests/idex/test_idex_l1a.py +48 -4
- imap_processing/tests/idex/test_idex_l1b.py +3 -3
- imap_processing/tests/idex/test_idex_l2a.py +383 -0
- imap_processing/tests/lo/test_cdfs/imap_lo_l1a_de_20241022_v002.cdf +0 -0
- imap_processing/tests/lo/test_cdfs/imap_lo_l1a_spin_20241022_v002.cdf +0 -0
- imap_processing/tests/lo/test_lo_l1b.py +148 -4
- imap_processing/tests/lo/test_lo_science.py +1 -0
- imap_processing/tests/mag/conftest.py +69 -0
- imap_processing/tests/mag/test_mag_decom.py +1 -1
- imap_processing/tests/mag/test_mag_l1a.py +38 -0
- imap_processing/tests/mag/test_mag_l1b.py +34 -53
- imap_processing/tests/mag/test_mag_l1c.py +251 -20
- imap_processing/tests/mag/test_mag_validation.py +109 -25
- imap_processing/tests/mag/validation/L1b/T009/MAGScience-normal-(2,2)-8s-20250204-16h39.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-magi-out.csv +16 -16
- imap_processing/tests/mag/validation/L1b/T009/mag-l1a-l1b-t009-mago-out.csv +16 -16
- imap_processing/tests/mag/validation/L1b/T010/MAGScience-normal-(2,2)-8s-20250206-12h05.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/MAGScience-normal-(2,2)-8s-20250204-16h08.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-magi-out.csv +16 -16
- imap_processing/tests/mag/validation/L1b/T011/mag-l1a-l1b-t011-mago-out.csv +16 -16
- imap_processing/tests/mag/validation/L1b/T012/MAGScience-normal-(2,2)-8s-20250204-16h08.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T012/data.bin +0 -0
- imap_processing/tests/mag/validation/L1b/T012/field_like_all_ranges.txt +19200 -0
- imap_processing/tests/mag/validation/L1b/T012/mag-l1a-l1b-t012-cal.cdf +0 -0
- imap_processing/tests/mag/validation/L1b/T012/mag-l1a-l1b-t012-in.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T012/mag-l1a-l1b-t012-magi-out.csv +17 -0
- imap_processing/tests/mag/validation/L1b/T012/mag-l1a-l1b-t012-mago-out.csv +17 -0
- imap_processing/tests/mag/validation/imap_calibration_mag_20240229_v01.cdf +0 -0
- imap_processing/tests/spacecraft/__init__.py +0 -0
- imap_processing/tests/spacecraft/data/SSR_2024_190_20_08_12_0483851794_2_DA_apid0594_1packet.pkts +0 -0
- imap_processing/tests/spacecraft/test_quaternions.py +71 -0
- imap_processing/tests/spice/test_data/fake_repoint_data.csv +5 -0
- imap_processing/tests/spice/test_geometry.py +6 -9
- imap_processing/tests/spice/test_repoint.py +111 -0
- imap_processing/tests/swapi/test_swapi_l1.py +7 -3
- imap_processing/tests/swe/l0_data/2024051010_SWE_HK_packet.bin +0 -0
- imap_processing/tests/swe/l0_data/2024051011_SWE_CEM_RAW_packet.bin +0 -0
- imap_processing/tests/swe/l0_validation_data/idle_export_eu.SWE_APP_HK_20240510_092742.csv +49 -0
- imap_processing/tests/swe/l0_validation_data/idle_export_eu.SWE_CEM_RAW_20240510_092742.csv +593 -0
- imap_processing/tests/swe/test_swe_l1a.py +18 -0
- imap_processing/tests/swe/test_swe_l1a_cem_raw.py +52 -0
- imap_processing/tests/swe/test_swe_l1a_hk.py +68 -0
- imap_processing/tests/swe/test_swe_l1b_science.py +23 -4
- imap_processing/tests/swe/test_swe_l2.py +112 -30
- imap_processing/tests/test_cli.py +2 -2
- imap_processing/tests/test_utils.py +138 -16
- imap_processing/tests/ultra/data/l0/FM45_UltraFM45_Functional_2024-01-22T0105_20240122T010548.CCSDS +0 -0
- imap_processing/tests/ultra/data/l0/ultra45_raw_sc_ultraimgrates_20220530_00.csv +164 -0
- imap_processing/tests/ultra/{test_data → data}/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3243 -3243
- imap_processing/tests/ultra/data/mock_data.py +341 -0
- imap_processing/tests/ultra/unit/conftest.py +69 -26
- imap_processing/tests/ultra/unit/test_badtimes.py +2 -0
- imap_processing/tests/ultra/unit/test_cullingmask.py +4 -0
- imap_processing/tests/ultra/unit/test_de.py +12 -4
- imap_processing/tests/ultra/unit/test_decom_apid_881.py +44 -0
- imap_processing/tests/ultra/unit/test_spacecraft_pset.py +78 -0
- imap_processing/tests/ultra/unit/test_ultra_l1a.py +28 -12
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +34 -6
- imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py +22 -26
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +86 -51
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +94 -52
- imap_processing/ultra/l0/decom_tools.py +6 -5
- imap_processing/ultra/l1a/ultra_l1a.py +28 -56
- imap_processing/ultra/l1b/de.py +72 -28
- imap_processing/ultra/l1b/extendedspin.py +12 -14
- imap_processing/ultra/l1b/ultra_l1b.py +34 -9
- imap_processing/ultra/l1b/ultra_l1b_culling.py +65 -29
- imap_processing/ultra/l1b/ultra_l1b_extended.py +64 -19
- imap_processing/ultra/l1c/spacecraft_pset.py +86 -0
- imap_processing/ultra/l1c/ultra_l1c.py +7 -4
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +112 -61
- imap_processing/ultra/lookup_tables/ultra_90_dps_exposure_compressed.cdf +0 -0
- imap_processing/ultra/utils/ultra_l1_utils.py +20 -2
- imap_processing/utils.py +68 -28
- {imap_processing-0.11.0.dist-info → imap_processing-0.12.0.dist-info}/METADATA +8 -5
- {imap_processing-0.11.0.dist-info → imap_processing-0.12.0.dist-info}/RECORD +250 -199
- imap_processing/cdf/config/imap_mag_l1_variable_attrs.yaml +0 -237
- imap_processing/hi/l1a/housekeeping.py +0 -27
- imap_processing/tests/codice/data/imap_codice_l1a_hi-counters-aggregated_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_hi-counters-singles_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_hi-omni_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_hi-sectored_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_hskp_20100101_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-counters-aggregated_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-counters-singles_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-nsw-angular_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-nsw-priority_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-nsw-species_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-sw-angular_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-sw-priority_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1a_lo-sw-species_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_hi-counters-aggregated_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_hi-counters-singles_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_hi-omni_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_hi-sectored_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_hskp_20100101_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-counters-aggregated_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-counters-singles_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-nsw-angular_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-nsw-priority_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-nsw-species_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-sw-angular_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-sw-priority_20240429_v001.cdf +0 -0
- imap_processing/tests/codice/data/imap_codice_l1b_lo-sw-species_20240429_v001.cdf +0 -0
- imap_processing/tests/hi/data/l1/imap_hi_l1b_45sensor-de_20250415_v999.cdf +0 -0
- imap_processing/tests/hit/PREFLIGHT_raw_record_2023_256_15_59_04_apid1251.pkts +0 -0
- imap_processing/tests/hit/PREFLIGHT_raw_record_2023_256_15_59_04_apid1252.pkts +0 -0
- imap_processing/tests/hit/validation_data/hskp_sample_eu.csv +0 -89
- imap_processing/tests/hit/validation_data/sci_sample_raw1.csv +0 -29
- imap_processing/tests/idex/test_data/imap_idex_l0_raw_20231214_v001.pkts +0 -0
- imap_processing/tests/lo/test_cdfs/imap_lo_l1a_de_20100101_v001.cdf +0 -0
- imap_processing/tests/lo/test_cdfs/imap_lo_l1a_spin_20100101_v001.cdf +0 -0
- imap_processing/tests/ultra/test_data/mock_data.py +0 -161
- imap_processing/ultra/l1c/pset.py +0 -40
- /imap_processing/tests/ultra/{test_data → data}/l0/FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50_theta-0.00_20240207T102740.CCSDS +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/FM45_7P_Phi0.0_BeamCal_LinearScan_phi0.04_theta-0.01_20230821T121304.CCSDS +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/FM45_TV_Cycle6_Hot_Ops_Front212_20240124T063837.CCSDS +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.CCSDS +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/ultra45_raw_sc_auxdata_Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.csv +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/ultra45_raw_sc_enaphxtofhangimg_FM45_TV_Cycle6_Hot_Ops_Front212_20240124T063837.csv +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/ultra45_raw_sc_ultraimgrates_Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.csv +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l0/ultra45_raw_sc_ultrarawimgevent_FM45_7P_Phi00_BeamCal_LinearScan_phi004_theta-001_20230821T121304.csv +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l1/dps_exposure_helio_45_E1.cdf +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l1/dps_exposure_helio_45_E12.cdf +0 -0
- /imap_processing/tests/ultra/{test_data → data}/l1/dps_exposure_helio_45_E24.cdf +0 -0
- {imap_processing-0.11.0.dist-info → imap_processing-0.12.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.11.0.dist-info → imap_processing-0.12.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.11.0.dist-info → imap_processing-0.12.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Module containing constants used in the SWE processing pipeline."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
N_ESA_STEPS = 24
|
|
6
|
+
N_ANGLE_SECTORS = 30
|
|
7
|
+
N_CEMS = 7
|
|
8
|
+
N_QUARTER_CYCLES = 4
|
|
9
|
+
N_ANGLE_BINS = 30
|
|
10
|
+
|
|
11
|
+
MICROSECONDS_IN_SECOND = 1e6
|
|
12
|
+
|
|
13
|
+
# TODO: add these to instrument status summary
|
|
14
|
+
ENERGY_CONVERSION_FACTOR = 4.75
|
|
15
|
+
# 7 CEMs geometric factors in cm^2 sr eV/eV units.
|
|
16
|
+
GEOMETRIC_FACTORS = np.array(
|
|
17
|
+
[
|
|
18
|
+
435e-6,
|
|
19
|
+
599e-6,
|
|
20
|
+
808e-6,
|
|
21
|
+
781e-6,
|
|
22
|
+
876e-6,
|
|
23
|
+
548e-6,
|
|
24
|
+
432e-6,
|
|
25
|
+
]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
ELECTRON_MASS = 9.10938356e-31 # kg
|
|
29
|
+
|
|
30
|
+
# See doc string of calculate_phase_space_density() for more details.
|
|
31
|
+
VELOCITY_CONVERSION_FACTOR = 1.237e31
|
|
32
|
+
# See doc string of calculate_flux() for more details.
|
|
33
|
+
FLUX_CONVERSION_FACTOR = 6.187e30
|
|
34
|
+
|
|
35
|
+
CEM_DETECTORS_ANGLE = np.array([-63, -42, -21, 0, 21, 42, 63])
|
|
36
|
+
|
|
37
|
+
# ESA voltage and index in the final data table
|
|
38
|
+
ESA_VOLTAGE_ROW_INDEX_DICT = {
|
|
39
|
+
0.56: 0,
|
|
40
|
+
0.78: 1,
|
|
41
|
+
1.08: 2,
|
|
42
|
+
1.51: 3,
|
|
43
|
+
2.10: 4,
|
|
44
|
+
2.92: 5,
|
|
45
|
+
4.06: 6,
|
|
46
|
+
5.64: 7,
|
|
47
|
+
7.85: 8,
|
|
48
|
+
10.92: 9,
|
|
49
|
+
15.19: 10,
|
|
50
|
+
21.13: 11,
|
|
51
|
+
29.39: 12,
|
|
52
|
+
40.88: 13,
|
|
53
|
+
56.87: 14,
|
|
54
|
+
79.10: 15,
|
|
55
|
+
110.03: 16,
|
|
56
|
+
153.05: 17,
|
|
57
|
+
212.89: 18,
|
|
58
|
+
296.14: 19,
|
|
59
|
+
411.93: 20,
|
|
60
|
+
572.99: 21,
|
|
61
|
+
797.03: 22,
|
|
62
|
+
1108.66: 23,
|
|
63
|
+
}
|
|
@@ -2,43 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
from enum import IntEnum
|
|
4
4
|
|
|
5
|
+
import numpy as np
|
|
6
|
+
import numpy.typing as npt
|
|
5
7
|
import pandas as pd
|
|
6
8
|
|
|
7
9
|
from imap_processing import imap_module_directory
|
|
8
|
-
|
|
9
|
-
# ESA voltage and index in the final data table
|
|
10
|
-
ESA_VOLTAGE_ROW_INDEX_DICT = {
|
|
11
|
-
0.56: 0,
|
|
12
|
-
0.78: 1,
|
|
13
|
-
1.08: 2,
|
|
14
|
-
1.51: 3,
|
|
15
|
-
2.10: 4,
|
|
16
|
-
2.92: 5,
|
|
17
|
-
4.06: 6,
|
|
18
|
-
5.64: 7,
|
|
19
|
-
7.85: 8,
|
|
20
|
-
10.92: 9,
|
|
21
|
-
15.19: 10,
|
|
22
|
-
21.13: 11,
|
|
23
|
-
29.39: 12,
|
|
24
|
-
40.88: 13,
|
|
25
|
-
56.87: 14,
|
|
26
|
-
79.10: 15,
|
|
27
|
-
110.03: 16,
|
|
28
|
-
153.05: 17,
|
|
29
|
-
212.89: 18,
|
|
30
|
-
296.14: 19,
|
|
31
|
-
411.93: 20,
|
|
32
|
-
572.99: 21,
|
|
33
|
-
797.03: 22,
|
|
34
|
-
1108.66: 23,
|
|
35
|
-
}
|
|
10
|
+
from imap_processing.swe.utils import swe_constants
|
|
36
11
|
|
|
37
12
|
|
|
38
13
|
class SWEAPID(IntEnum):
|
|
39
14
|
"""Create ENUM for apid."""
|
|
40
15
|
|
|
41
16
|
SWE_SCIENCE = 1344
|
|
17
|
+
SWE_APP_HK = 1330
|
|
18
|
+
SWE_CEM_RAW = 1334
|
|
42
19
|
|
|
43
20
|
|
|
44
21
|
def read_lookup_table() -> pd.DataFrame:
|
|
@@ -54,3 +31,83 @@ def read_lookup_table() -> pd.DataFrame:
|
|
|
54
31
|
lookup_table_path = imap_module_directory / "swe/l1b/swe_esa_lookup_table.csv"
|
|
55
32
|
esa_table = pd.read_csv(lookup_table_path)
|
|
56
33
|
return esa_table
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def combine_acquisition_time(
|
|
37
|
+
acq_start_coarse: np.ndarray, acq_start_fine: np.ndarray
|
|
38
|
+
) -> npt.NDArray:
|
|
39
|
+
"""
|
|
40
|
+
Combine acquisition time of each quarter cycle measurement.
|
|
41
|
+
|
|
42
|
+
Each quarter cycle data should have same acquisition start time coarse
|
|
43
|
+
and fine value. We will use that as base time to calculate each
|
|
44
|
+
acquisition time for each count data.
|
|
45
|
+
base_quarter_cycle_acq_time = acq_start_coarse +
|
|
46
|
+
| acq_start_fine / 1000000
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
acq_start_coarse : np.ndarray
|
|
51
|
+
Acq start coarse. It is in seconds.
|
|
52
|
+
acq_start_fine : np.ndarray
|
|
53
|
+
Acq start fine. It is in microseconds.
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
np.ndarray
|
|
58
|
+
Acquisition time in seconds.
|
|
59
|
+
"""
|
|
60
|
+
epoch_center_time = acq_start_coarse + (
|
|
61
|
+
acq_start_fine / swe_constants.MICROSECONDS_IN_SECOND
|
|
62
|
+
)
|
|
63
|
+
return epoch_center_time
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def calculate_data_acquisition_time(
|
|
67
|
+
acq_start_time: np.ndarray,
|
|
68
|
+
esa_step_number: int,
|
|
69
|
+
acq_duration: int,
|
|
70
|
+
settle_duration: int,
|
|
71
|
+
) -> npt.NDArray:
|
|
72
|
+
"""
|
|
73
|
+
Calculate center acquisition time of each science data point.
|
|
74
|
+
|
|
75
|
+
Center acquisition time (in seconds) of each count data
|
|
76
|
+
point at each energy and at angle step will be
|
|
77
|
+
calculated using this formula:
|
|
78
|
+
| each_count_acq_time = acq_start_time +
|
|
79
|
+
| (step * ( acq_duration + settle_duration) / 1000000 )
|
|
80
|
+
where 'step' goes from 0 to 179, acq_start_time is in seconds and
|
|
81
|
+
settle_duration and acq_duration are in microseconds.
|
|
82
|
+
|
|
83
|
+
To calculate center time of data acquisition time, we will add
|
|
84
|
+
| each_count_acq_time + (acq_duration / 1000000) / 2
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
acq_start_time : np.ndarray
|
|
89
|
+
Start acquisition time in seconds.
|
|
90
|
+
esa_step_number : int
|
|
91
|
+
Energy step.
|
|
92
|
+
acq_duration : int
|
|
93
|
+
Acquisition duration in microseconds.
|
|
94
|
+
settle_duration : int
|
|
95
|
+
Settle duration in microseconds.
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
esa_step_number_acq_time : np.ndarray
|
|
100
|
+
ESA step number acquisition center time in seconds.
|
|
101
|
+
"""
|
|
102
|
+
# Calculate time for each ESA step
|
|
103
|
+
esa_step_number_acq_time = (
|
|
104
|
+
acq_start_time
|
|
105
|
+
+ (
|
|
106
|
+
esa_step_number
|
|
107
|
+
* (acq_duration + settle_duration)
|
|
108
|
+
/ swe_constants.MICROSECONDS_IN_SECOND
|
|
109
|
+
)
|
|
110
|
+
+ (acq_duration / swe_constants.MICROSECONDS_IN_SECOND) / 2
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return esa_step_number_acq_time
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<xtce:SizeInBits>
|
|
49
49
|
<xtce:DynamicValue>
|
|
50
50
|
<xtce:ParameterInstanceRef parameterRef="PKT_LEN" />
|
|
51
|
-
<xtce:LinearAdjustment slope="8" intercept="-
|
|
51
|
+
<xtce:LinearAdjustment slope="8" intercept="-79" />
|
|
52
52
|
</xtce:DynamicValue>
|
|
53
53
|
</xtce:SizeInBits>
|
|
54
54
|
</xtce:BinaryDataEncoding>
|
|
@@ -67,6 +67,41 @@
|
|
|
67
67
|
<xtce:Enumeration value="2" label="NONE" />
|
|
68
68
|
</xtce:EnumerationList>
|
|
69
69
|
</xtce:EnumeratedParameterType>
|
|
70
|
+
<xtce:IntegerParameterType name="TEST_PACKET.VAR_SEGMENTED" signed="false">
|
|
71
|
+
<xtce:IntegerDataEncoding sizeInBits="8" encoding="unsigned">
|
|
72
|
+
<xtce:ContextCalibratorList>
|
|
73
|
+
<xtce:ContextCalibrator>
|
|
74
|
+
<xtce:ContextMatch>
|
|
75
|
+
<xtce:ComparisonList>
|
|
76
|
+
<xtce:Comparison comparisonOperator=">=" value="0" parameterRef="TEST_PACKET.VAR_SEGMENTED" useCalibratedValue="false" />
|
|
77
|
+
<xtce:Comparison comparisonOperator="<=" value="19" parameterRef="TEST_PACKET.VAR_SEGMENTED" useCalibratedValue="false" />
|
|
78
|
+
</xtce:ComparisonList>
|
|
79
|
+
</xtce:ContextMatch>
|
|
80
|
+
<xtce:Calibrator>
|
|
81
|
+
<xtce:PolynomialCalibrator>
|
|
82
|
+
<xtce:Term coefficient="1.1" exponent="0" />
|
|
83
|
+
<xtce:Term coefficient="3.3" exponent="1" />
|
|
84
|
+
</xtce:PolynomialCalibrator>
|
|
85
|
+
</xtce:Calibrator>
|
|
86
|
+
</xtce:ContextCalibrator>
|
|
87
|
+
<xtce:ContextCalibrator>
|
|
88
|
+
<xtce:ContextMatch>
|
|
89
|
+
<xtce:ComparisonList>
|
|
90
|
+
<xtce:Comparison comparisonOperator=">=" value="20" parameterRef="TEST_PACKET.VAR_SEGMENTED" useCalibratedValue="false" />
|
|
91
|
+
<xtce:Comparison comparisonOperator="<=" value="40" parameterRef="TEST_PACKET.VAR_SEGMENTED" useCalibratedValue="false" />
|
|
92
|
+
</xtce:ComparisonList>
|
|
93
|
+
</xtce:ContextMatch>
|
|
94
|
+
<xtce:Calibrator>
|
|
95
|
+
<xtce:PolynomialCalibrator>
|
|
96
|
+
<xtce:Term coefficient="2.2" exponent="0" />
|
|
97
|
+
<xtce:Term coefficient="4.4" exponent="1" />
|
|
98
|
+
<xtce:Term coefficient="5.5" exponent="2" />
|
|
99
|
+
</xtce:PolynomialCalibrator>
|
|
100
|
+
</xtce:Calibrator>
|
|
101
|
+
</xtce:ContextCalibrator>
|
|
102
|
+
</xtce:ContextCalibratorList>
|
|
103
|
+
</xtce:IntegerDataEncoding>
|
|
104
|
+
</xtce:IntegerParameterType>
|
|
70
105
|
<xtce:IntegerParameterType name="TEST_PACKET2.SHCOARSE" signed="false">
|
|
71
106
|
<xtce:IntegerDataEncoding sizeInBits="32" encoding="unsigned" />
|
|
72
107
|
</xtce:IntegerParameterType>
|
|
@@ -120,6 +155,9 @@
|
|
|
120
155
|
<xtce:Parameter name="TEST_PACKET.VAR_STATE" parameterTypeRef="TEST_PACKET.VAR_STATE">
|
|
121
156
|
<xtce:LongDescription>State data</xtce:LongDescription>
|
|
122
157
|
</xtce:Parameter>
|
|
158
|
+
<xtce:Parameter name="TEST_PACKET.VAR_SEGMENTED" parameterTypeRef="TEST_PACKET.VAR_SEGMENTED">
|
|
159
|
+
<xtce:LongDescription>Segmented polynomial conversion</xtce:LongDescription>
|
|
160
|
+
</xtce:Parameter>
|
|
123
161
|
<xtce:Parameter name="TEST_PACKET2.SHCOARSE" parameterTypeRef="TEST_PACKET2.SHCOARSE">
|
|
124
162
|
<xtce:LongDescription>Mission elapsed time</xtce:LongDescription>
|
|
125
163
|
</xtce:Parameter>
|
|
@@ -154,6 +192,7 @@
|
|
|
154
192
|
<xtce:ParameterRefEntry parameterRef="TEST_PACKET.VAR_FILL" />
|
|
155
193
|
<xtce:ParameterRefEntry parameterRef="TEST_PACKET.VAR_FLOAT" />
|
|
156
194
|
<xtce:ParameterRefEntry parameterRef="TEST_PACKET.VAR_STATE" />
|
|
195
|
+
<xtce:ParameterRefEntry parameterRef="TEST_PACKET.VAR_SEGMENTED" />
|
|
157
196
|
</xtce:EntryList>
|
|
158
197
|
</xtce:SequenceContainer>
|
|
159
198
|
<xtce:SequenceContainer name="TEST_PACKET2">
|
|
@@ -27,7 +27,7 @@ def xtce_excel_file(tmp_path):
|
|
|
27
27
|
packets = {"packetName": ["TEST_PACKET", "TEST_PACKET2"], "apIdHex": ["0x1", "0xF"]}
|
|
28
28
|
|
|
29
29
|
test_packet1 = {
|
|
30
|
-
"packetName": ["TEST_PACKET"] *
|
|
30
|
+
"packetName": ["TEST_PACKET"] * 16,
|
|
31
31
|
"mnemonic": [
|
|
32
32
|
"PHVERNO",
|
|
33
33
|
"PHTYPE",
|
|
@@ -44,8 +44,9 @@ def xtce_excel_file(tmp_path):
|
|
|
44
44
|
"VAR_FILL",
|
|
45
45
|
"VAR_FLOAT",
|
|
46
46
|
"VAR_STATE",
|
|
47
|
+
"VAR_SEGMENTED",
|
|
47
48
|
],
|
|
48
|
-
"lengthInBits": [3, 1, 1, 11, 2, 14, 16, 32, 2, 4, 5, 10000, 3, 32, 1],
|
|
49
|
+
"lengthInBits": [3, 1, 1, 11, 2, 14, 16, 32, 2, 4, 5, 10000, 3, 32, 1, 8],
|
|
49
50
|
"dataType": [
|
|
50
51
|
"UINT",
|
|
51
52
|
"UINT",
|
|
@@ -62,6 +63,7 @@ def xtce_excel_file(tmp_path):
|
|
|
62
63
|
"FILL",
|
|
63
64
|
"FLOAT",
|
|
64
65
|
"UINT",
|
|
66
|
+
"UINT",
|
|
65
67
|
],
|
|
66
68
|
"convertAs": [
|
|
67
69
|
"NONE",
|
|
@@ -79,6 +81,7 @@ def xtce_excel_file(tmp_path):
|
|
|
79
81
|
"NONE",
|
|
80
82
|
"NONE",
|
|
81
83
|
"STATE",
|
|
84
|
+
"ANALOG",
|
|
82
85
|
],
|
|
83
86
|
"units": [
|
|
84
87
|
"DN",
|
|
@@ -96,6 +99,7 @@ def xtce_excel_file(tmp_path):
|
|
|
96
99
|
"DN",
|
|
97
100
|
"DN",
|
|
98
101
|
"DN",
|
|
102
|
+
"DN",
|
|
99
103
|
],
|
|
100
104
|
"longDescription": [
|
|
101
105
|
"CCSDS Packet Version Number",
|
|
@@ -113,6 +117,7 @@ def xtce_excel_file(tmp_path):
|
|
|
113
117
|
"Fill data",
|
|
114
118
|
"Float data",
|
|
115
119
|
"State data",
|
|
120
|
+
"Segmented polynomial conversion",
|
|
116
121
|
],
|
|
117
122
|
}
|
|
118
123
|
|
|
@@ -178,27 +183,27 @@ def xtce_excel_file(tmp_path):
|
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
analog_conversions = {
|
|
181
|
-
"packetName": ["TEST_PACKET"],
|
|
182
|
-
"mnemonic": ["VAR_UINT"],
|
|
183
|
-
"convertAs": ["UNSEGMENTED_POLY"],
|
|
184
|
-
"segNumber": [1],
|
|
185
|
-
"lowValue": [0],
|
|
186
|
-
"highValue": [100],
|
|
187
|
-
"c0": [1.5],
|
|
188
|
-
"c1": [2.5],
|
|
189
|
-
"c2": [0],
|
|
190
|
-
"c3": [0],
|
|
191
|
-
"c4": [0],
|
|
192
|
-
"c5": [0],
|
|
193
|
-
"c6": [0],
|
|
194
|
-
"c7": [0],
|
|
186
|
+
"packetName": ["TEST_PACKET", "TEST_PACKET", "TEST_PACKET"],
|
|
187
|
+
"mnemonic": ["VAR_UINT", "VAR_SEGMENTED", "VAR_SEGMENTED"],
|
|
188
|
+
"convertAs": ["UNSEGMENTED_POLY", "SEGMENTED_POLY", "SEGMENTED_POLY"],
|
|
189
|
+
"segNumber": [1, 1, 2],
|
|
190
|
+
"lowValue": [0, 0, 20],
|
|
191
|
+
"highValue": [100, 19, 40],
|
|
192
|
+
"c0": [1.5, 1.1, 2.2],
|
|
193
|
+
"c1": [2.5, 3.3, 4.4],
|
|
194
|
+
"c2": [0, 0, 5.5],
|
|
195
|
+
"c3": [0] * 3,
|
|
196
|
+
"c4": [0] * 3,
|
|
197
|
+
"c5": [0] * 3,
|
|
198
|
+
"c6": [0] * 3,
|
|
199
|
+
"c7": [0] * 3,
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
states = {
|
|
198
203
|
"packetName": ["TEST_PACKET"] * 3,
|
|
199
204
|
"mnemonic": ["VAR_STATE"] * 3,
|
|
200
205
|
"value": [0, 1, "0x2"],
|
|
201
|
-
"state": ["OFF", "ON", "NONE"],
|
|
206
|
+
"state": ["OFF ", "ON", "NONE"],
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
# Write the DataFrame to an excel file
|
|
@@ -228,9 +233,7 @@ def xtce_excel_file(tmp_path):
|
|
|
228
233
|
def test_generated_xml(xtce_excel_file):
|
|
229
234
|
"""Make sure we are producing the expected contents within the XML file.
|
|
230
235
|
|
|
231
|
-
To produce a new expected output file the
|
|
232
|
-
imap_xtce imap_processing/tests/ccsds/test_data/excel_to_xtce_test_file.xlsx
|
|
233
|
-
--output imap_processing/tests/ccsds/test_data/expected_output.xml
|
|
236
|
+
To produce a new expected output file, uncomment the line mentioned below.
|
|
234
237
|
"""
|
|
235
238
|
generator = excel_to_xtce.XTCEGenerator(xtce_excel_file)
|
|
236
239
|
output_file = xtce_excel_file.parent / "output.xml"
|
|
@@ -10,14 +10,12 @@ instrument_base: &instrument_base
|
|
|
10
10
|
|
|
11
11
|
imap_swe_l1a_sci:
|
|
12
12
|
<<: *instrument_base
|
|
13
|
-
Data_level: 1A
|
|
14
13
|
Data_type: L1A_SCI>Level-1A Science data
|
|
15
14
|
Logical_source: imap_swe_l1a_sci
|
|
16
15
|
Logical_source_description: SWE Instrument Level-1A Science Data
|
|
17
16
|
|
|
18
17
|
imap_swe_l1b_sci:
|
|
19
18
|
<<: *instrument_base
|
|
20
|
-
Data_level: 1A
|
|
21
19
|
Data_type: L1B_SCI>Level-1B Science data
|
|
22
20
|
Logical_source: imap_swe_l1b_sci
|
|
23
21
|
Logical_source_description: SWE Instrument Level-1B Science Data
|
|
@@ -37,7 +37,7 @@ VALIDATION_DATA = [
|
|
|
37
37
|
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-counters-singles_20241110193700_v0.0.0.cdf",
|
|
38
38
|
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-omni_20241110193700_v0.0.0.cdf",
|
|
39
39
|
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-sectored_20241110193700_v0.0.0.cdf",
|
|
40
|
-
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-
|
|
40
|
+
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-priorities_20241110193700_v0.0.0.cdf",
|
|
41
41
|
TEST_DATA_PATH / "validation" / "imap_codice_l1a_lo-pha_20241110193700_v0.0.0.cdf",
|
|
42
42
|
TEST_DATA_PATH / "validation" / "imap_codice_l1a_hi-pha_20241110193700_v0.0.0.cdf",
|
|
43
43
|
] # fmt: skip
|
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-ialirt_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-omni_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-priorities_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_hi-sectored_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-ialirt_20241110193700_v0.0.0.cdf
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-angular_20241110193700_v0.0.0.cdf
CHANGED
|
Binary file
|
|
Binary file
|
imap_processing/tests/codice/data/validation/imap_codice_l1a_lo-sw-species_20241110193700_v0.0.0.cdf
CHANGED
|
Binary file
|
|
@@ -50,11 +50,11 @@ EXPECTED_ARRAY_SHAPES = [
|
|
|
50
50
|
(77, 1, 128), # lo-nsw-species
|
|
51
51
|
(77, 5, 12, 128), # lo-sw-angular
|
|
52
52
|
(77, 19, 12, 128), # lo-nsw-angular
|
|
53
|
-
(77,
|
|
54
|
-
(77,
|
|
55
|
-
(77, 15, 4
|
|
53
|
+
(77,), # hi-counters-aggregated
|
|
54
|
+
(77, 12), # hi-counters-singles
|
|
55
|
+
(77, 15, 4), # hi-omni
|
|
56
56
|
(77, 8, 12, 12), # hi-sectored
|
|
57
|
-
(), # hi-priority
|
|
57
|
+
(77,), # hi-priority
|
|
58
58
|
(), # lo-pha # TODO: Need to implement
|
|
59
59
|
(), # hi-pha # TODO: Need to implement
|
|
60
60
|
]
|
|
@@ -62,7 +62,7 @@ EXPECTED_ARRAY_SHAPES = [
|
|
|
62
62
|
EXPECTED_NUM_VARIABLES = [
|
|
63
63
|
0, # hi-ialirt # TODO: Need to implement
|
|
64
64
|
0, # lo-ialirt # TODO: Need to implement
|
|
65
|
-
|
|
65
|
+
139, # hskp
|
|
66
66
|
8 + len(constants.LO_COUNTERS_AGGREGATED_VARIABLE_NAMES), # lo-counters-aggregated
|
|
67
67
|
9, # lo-counters-singles
|
|
68
68
|
13, # lo-sw-priority
|
|
@@ -71,15 +71,37 @@ EXPECTED_NUM_VARIABLES = [
|
|
|
71
71
|
16, # lo-nsw-species
|
|
72
72
|
12, # lo-sw-angular
|
|
73
73
|
9, # lo-nsw-angular
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
2 + len(constants.HI_COUNTERS_AGGREGATED_VARIABLE_NAMES), # hi-counters-aggregated
|
|
75
|
+
5, # hi-counters-singles
|
|
76
76
|
10, # hi-omni
|
|
77
77
|
6, # hi-sectored
|
|
78
|
-
|
|
78
|
+
8, # hi-priority
|
|
79
79
|
0, # lo-pha # TODO: Need to implement
|
|
80
80
|
0, # hi-pha # TODO: Need to implement
|
|
81
81
|
]
|
|
82
82
|
|
|
83
|
+
# CoDICE-Hi products that have support variables to test
|
|
84
|
+
CODICE_HI_PRODUCTS = [
|
|
85
|
+
"hi-counters-aggregated",
|
|
86
|
+
"hi-counters-singles",
|
|
87
|
+
"hi-priority",
|
|
88
|
+
"hi-sectored",
|
|
89
|
+
]
|
|
90
|
+
# TODO: Add hi-omni here once I sort out the array shape discrepancy with the
|
|
91
|
+
# validation data
|
|
92
|
+
|
|
93
|
+
# CoDICE-Lo products that have support variables to test
|
|
94
|
+
CODICE_LO_PRODUCTS = [
|
|
95
|
+
"lo-counters-aggregated",
|
|
96
|
+
"lo-counters-singles",
|
|
97
|
+
"lo-sw-priority",
|
|
98
|
+
"lo-nsw-priority",
|
|
99
|
+
"lo-sw-species",
|
|
100
|
+
"lo-nsw-species",
|
|
101
|
+
"lo-sw-angular",
|
|
102
|
+
"lo-nsw-angular",
|
|
103
|
+
]
|
|
104
|
+
|
|
83
105
|
|
|
84
106
|
@pytest.fixture(scope="session")
|
|
85
107
|
def test_l1a_data() -> xr.Dataset:
|
|
@@ -113,7 +135,7 @@ def test_l1a_data_array_shape(test_l1a_data, index):
|
|
|
113
135
|
|
|
114
136
|
# Mark currently broken/unsupported datasets as expected to fail
|
|
115
137
|
# TODO: Remove these once they are supported
|
|
116
|
-
if index in [0, 1,
|
|
138
|
+
if index in [0, 1, 16, 17]:
|
|
117
139
|
pytest.xfail("Data product is currently unsupported")
|
|
118
140
|
|
|
119
141
|
for variable in processed_dataset:
|
|
@@ -157,7 +179,7 @@ def test_l1a_logical_sources(test_l1a_data, index):
|
|
|
157
179
|
|
|
158
180
|
# Mark currently broken/unsupported datasets as expected to fail
|
|
159
181
|
# TODO: Remove these once they are supported
|
|
160
|
-
if index in [0, 1,
|
|
182
|
+
if index in [0, 1, 16, 17]:
|
|
161
183
|
pytest.xfail("Data product is currently unsupported")
|
|
162
184
|
|
|
163
185
|
# Write the dataset to a file to set the logical source attribute
|
|
@@ -185,7 +207,7 @@ def test_l1a_num_data_variables(test_l1a_data, index):
|
|
|
185
207
|
|
|
186
208
|
# Mark currently broken/unsupported datasets as expected to fail
|
|
187
209
|
# TODO: Remove these once they are supported
|
|
188
|
-
if index in [0, 1,
|
|
210
|
+
if index in [0, 1, 16, 17]:
|
|
189
211
|
pytest.xfail("Data product is currently unsupported")
|
|
190
212
|
|
|
191
213
|
assert len(processed_dataset) == EXPECTED_NUM_VARIABLES[index]
|
|
@@ -211,6 +233,10 @@ def test_l1a_validate_data_arrays(test_l1a_data: xr.Dataset, index):
|
|
|
211
233
|
# TODO: Currently only the following products can be validated, expand this
|
|
212
234
|
# to other data products as I can validate them.
|
|
213
235
|
able_to_be_validated = [
|
|
236
|
+
"hi-counters-aggregated",
|
|
237
|
+
"hi-counters-singles",
|
|
238
|
+
"hi-priority",
|
|
239
|
+
"hi-sectored",
|
|
214
240
|
"lo-counters-aggregated",
|
|
215
241
|
"lo-counters-singles",
|
|
216
242
|
"lo-sw-angular",
|
|
@@ -219,7 +245,9 @@ def test_l1a_validate_data_arrays(test_l1a_data: xr.Dataset, index):
|
|
|
219
245
|
"lo-nsw-priority",
|
|
220
246
|
"lo-sw-species",
|
|
221
247
|
"lo-nsw-species",
|
|
248
|
+
"hi-sectored",
|
|
222
249
|
]
|
|
250
|
+
|
|
223
251
|
if descriptor in able_to_be_validated:
|
|
224
252
|
counters = getattr(
|
|
225
253
|
constants, f'{descriptor.upper().replace("-","_")}_VARIABLE_NAMES'
|
|
@@ -228,17 +256,11 @@ def test_l1a_validate_data_arrays(test_l1a_data: xr.Dataset, index):
|
|
|
228
256
|
validation_dataset = load_cdf(VALIDATION_DATA[index])
|
|
229
257
|
|
|
230
258
|
for counter in counters:
|
|
231
|
-
# Ensure the data
|
|
232
|
-
|
|
233
|
-
processed_dataset[counter].data.
|
|
234
|
-
== validation_dataset[counter].data.shape
|
|
259
|
+
# Ensure the data arrays are equal
|
|
260
|
+
np.testing.assert_equal(
|
|
261
|
+
processed_dataset[counter].data, validation_dataset[counter].data
|
|
235
262
|
)
|
|
236
263
|
|
|
237
|
-
# TODO: Once Joey and I figure out some small discrepancies with
|
|
238
|
-
# some data products, we should get matching data array shapes
|
|
239
|
-
# AND values (i.e. run assert_array_equal on the arrays,
|
|
240
|
-
# instead of just checking shape)
|
|
241
|
-
|
|
242
264
|
else:
|
|
243
265
|
pytest.xfail(f"Still need to implement validation for {descriptor}")
|
|
244
266
|
|
|
@@ -253,35 +275,17 @@ def test_l1a_validate_hskp_data(test_l1a_data):
|
|
|
253
275
|
# Load the validation housekeeping data
|
|
254
276
|
validation_hskp_data = load_cdf(validation_hskp_filepath)
|
|
255
277
|
|
|
256
|
-
# These variables are present in the
|
|
257
|
-
# the validation data
|
|
258
|
-
# TODO: Ask Joey if these can be removed from the L1a housekeeping CDFs
|
|
278
|
+
# These variables are not present in the validation dataset
|
|
259
279
|
exclude_variables = [
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
"spare_68",
|
|
280
|
+
"version",
|
|
281
|
+
"type",
|
|
282
|
+
"sec_hdr_flg",
|
|
283
|
+
"pkt_apid",
|
|
284
|
+
"seq_flgs",
|
|
285
|
+
"src_seq_ctr",
|
|
286
|
+
"pkt_len",
|
|
268
287
|
]
|
|
269
288
|
|
|
270
|
-
# These variables are not present in the validation data
|
|
271
|
-
# TODO: Ask joey if this is expected
|
|
272
|
-
exclude_variables.extend(
|
|
273
|
-
[
|
|
274
|
-
"version",
|
|
275
|
-
"type",
|
|
276
|
-
"sec_hdr_flg",
|
|
277
|
-
"pkt_apid",
|
|
278
|
-
"seq_flgs",
|
|
279
|
-
"src_seq_ctr",
|
|
280
|
-
"pkt_len",
|
|
281
|
-
"chksum",
|
|
282
|
-
]
|
|
283
|
-
)
|
|
284
|
-
|
|
285
289
|
for variable in hskp_data:
|
|
286
290
|
if variable not in exclude_variables:
|
|
287
291
|
np.testing.assert_array_equal(
|
|
@@ -289,6 +293,66 @@ def test_l1a_validate_hskp_data(test_l1a_data):
|
|
|
289
293
|
)
|
|
290
294
|
|
|
291
295
|
|
|
296
|
+
@pytest.mark.parametrize("index", range(len(DESCRIPTORS)))
|
|
297
|
+
def test_l1a_validate_support_variables(test_l1a_data, index):
|
|
298
|
+
"""Tests that the support variables for the generated products match the
|
|
299
|
+
validation data
|
|
300
|
+
|
|
301
|
+
Parameters
|
|
302
|
+
----------
|
|
303
|
+
test_l1a_data : list[xarray.Dataset]
|
|
304
|
+
A list of ``xarray`` datasets containing the test data
|
|
305
|
+
index : int
|
|
306
|
+
The index of the list to test
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
# Hopefully I can remove this someday if Joey gives me validation data
|
|
310
|
+
# with updated naming conventions
|
|
311
|
+
variable_name_mapping = {
|
|
312
|
+
"data_quality": "DataQuality",
|
|
313
|
+
"nso_half_spin": "NSOHalfSpin",
|
|
314
|
+
"rgfo_half_spin": "RGFOHalfSpin",
|
|
315
|
+
"spin_period": "SpinPeriod",
|
|
316
|
+
"st_bias_gain_mode": "STBiasGainMode",
|
|
317
|
+
"sw_bias_gain_mode": "SWBiasGainMode",
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
descriptor = DESCRIPTORS[index]
|
|
321
|
+
dataset = test_l1a_data[index]
|
|
322
|
+
validation_dataset = load_cdf(VALIDATION_DATA[index])
|
|
323
|
+
|
|
324
|
+
if descriptor in CODICE_LO_PRODUCTS:
|
|
325
|
+
# Note that for the energy table and acquisition time, the validation
|
|
326
|
+
# data only carries three decimal places whereas the SDC-generated CDFs
|
|
327
|
+
# carry more significant figures
|
|
328
|
+
|
|
329
|
+
# Ensure the energy table values are (nearly) equal
|
|
330
|
+
np.testing.assert_almost_equal(
|
|
331
|
+
dataset.energy_table.data, validation_dataset.EnergyTable.data, decimal=3
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
# Ensure that the acquisition times are (nearly) equal
|
|
335
|
+
np.testing.assert_almost_equal(
|
|
336
|
+
dataset.acquisition_time_per_step.data,
|
|
337
|
+
validation_dataset.AcquisitionTimePerStep.data,
|
|
338
|
+
decimal=3,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
# Ensure that the support variables derived from packet data are equal
|
|
342
|
+
for variable in variable_name_mapping:
|
|
343
|
+
np.testing.assert_equal(
|
|
344
|
+
dataset[variable].data,
|
|
345
|
+
validation_dataset[variable_name_mapping[variable]].data,
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
elif descriptor in CODICE_HI_PRODUCTS:
|
|
349
|
+
for variable in ["spin_period", "data_quality"]:
|
|
350
|
+
np.testing.assert_equal(
|
|
351
|
+
dataset[variable].data,
|
|
352
|
+
validation_dataset[variable_name_mapping[variable]].data,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
|
|
292
356
|
def test_l1a_multiple_packets():
|
|
293
357
|
"""Tests that an input L0 file containing multiple APIDs can be processed."""
|
|
294
358
|
|