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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"""Module to create pointing sets."""
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import cdflib
|
|
3
|
+
import astropy_healpix.healpy as hp
|
|
6
4
|
import numpy as np
|
|
5
|
+
import pandas
|
|
7
6
|
from numpy.typing import NDArray
|
|
8
7
|
|
|
9
8
|
from imap_processing.ena_maps.utils.spatial_utils import build_spatial_bins
|
|
@@ -18,7 +17,7 @@ from imap_processing.ultra.constants import UltraConstants
|
|
|
18
17
|
# TODO: add species binning.
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
def build_energy_bins() -> tuple[list[tuple[float, float]], np.ndarray]:
|
|
20
|
+
def build_energy_bins() -> tuple[list[tuple[float, float]], np.ndarray, np.ndarray]:
|
|
22
21
|
"""
|
|
23
22
|
Build energy bin boundaries.
|
|
24
23
|
|
|
@@ -28,6 +27,8 @@ def build_energy_bins() -> tuple[list[tuple[float, float]], np.ndarray]:
|
|
|
28
27
|
Energy bins.
|
|
29
28
|
energy_midpoints : np.ndarray
|
|
30
29
|
Array of energy bin midpoints.
|
|
30
|
+
energy_bin_geometric_means : np.ndarray
|
|
31
|
+
Array of geometric means of energy bins.
|
|
31
32
|
"""
|
|
32
33
|
# Calculate energy step
|
|
33
34
|
energy_step = (1 + UltraConstants.ALPHA / 2) / (1 - UltraConstants.ALPHA / 2)
|
|
@@ -44,19 +45,20 @@ def build_energy_bins() -> tuple[list[tuple[float, float]], np.ndarray]:
|
|
|
44
45
|
(float(energy_bin_edges[i]), float(energy_bin_edges[i + 1]))
|
|
45
46
|
for i in range(len(energy_bin_edges) - 1)
|
|
46
47
|
]
|
|
48
|
+
energy_bin_geometric_means = np.sqrt(energy_bin_edges[:-1] * energy_bin_edges[1:])
|
|
47
49
|
|
|
48
|
-
return intervals, energy_midpoints
|
|
50
|
+
return intervals, energy_midpoints, energy_bin_geometric_means
|
|
49
51
|
|
|
50
52
|
|
|
51
|
-
def
|
|
53
|
+
def get_spacecraft_histogram(
|
|
52
54
|
vhat: tuple[np.ndarray, np.ndarray, np.ndarray],
|
|
53
55
|
energy: np.ndarray,
|
|
54
|
-
az_bin_edges: np.ndarray,
|
|
55
|
-
el_bin_edges: np.ndarray,
|
|
56
56
|
energy_bin_edges: list[tuple[float, float]],
|
|
57
|
-
|
|
57
|
+
nside: int = 128,
|
|
58
|
+
nested: bool = False,
|
|
59
|
+
) -> tuple[NDArray, NDArray, NDArray, NDArray]:
|
|
58
60
|
"""
|
|
59
|
-
Compute a 3D histogram of the particle data.
|
|
61
|
+
Compute a 3D histogram of the particle data using HEALPix binning.
|
|
60
62
|
|
|
61
63
|
Parameters
|
|
62
64
|
----------
|
|
@@ -64,71 +66,110 @@ def get_histogram(
|
|
|
64
66
|
The x,y,z-components of the unit velocity vector.
|
|
65
67
|
energy : np.ndarray
|
|
66
68
|
The particle energy.
|
|
67
|
-
az_bin_edges : np.ndarray
|
|
68
|
-
Array of azimuth bin boundary values.
|
|
69
|
-
el_bin_edges : np.ndarray
|
|
70
|
-
Array of elevation bin boundary values.
|
|
71
69
|
energy_bin_edges : list[tuple[float, float]]
|
|
72
70
|
Array of energy bin edges.
|
|
71
|
+
nside : int, optional
|
|
72
|
+
The nside parameter of the Healpix tessellation.
|
|
73
|
+
Default is 32.
|
|
74
|
+
nested : bool, optional
|
|
75
|
+
Whether the Healpix tessellation is nested. Default is False.
|
|
73
76
|
|
|
74
77
|
Returns
|
|
75
78
|
-------
|
|
76
79
|
hist : np.ndarray
|
|
77
|
-
A 3D histogram array.
|
|
80
|
+
A 3D histogram array with shape (n_pix, n_energy_bins).
|
|
81
|
+
latitude : np.ndarray
|
|
82
|
+
Array of latitude values.
|
|
83
|
+
longitude : np.ndarray
|
|
84
|
+
Array of longitude values.
|
|
85
|
+
n_pix : int
|
|
86
|
+
Number of healpix pixels.
|
|
78
87
|
|
|
79
88
|
Notes
|
|
80
89
|
-----
|
|
81
|
-
The histogram will
|
|
90
|
+
The histogram will work properly for overlapping energy bins, i.e.
|
|
82
91
|
the same energy value can fall into multiple bins if the intervals overlap.
|
|
92
|
+
|
|
93
|
+
azimuthal angle [0, 360], elevation angle [-90, 90]
|
|
83
94
|
"""
|
|
84
|
-
|
|
95
|
+
# vhat = direction in which particle is traveling
|
|
96
|
+
# Make negative to see where it came from
|
|
97
|
+
spherical_coords = cartesian_to_spherical(-np.array(vhat), degrees=True)
|
|
85
98
|
az, el = (
|
|
86
99
|
spherical_coords[..., 1],
|
|
87
100
|
spherical_coords[..., 2],
|
|
88
101
|
)
|
|
89
102
|
|
|
90
|
-
#
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
103
|
+
# Compute number of HEALPix pixels that cover the sphere
|
|
104
|
+
n_pix = hp.nside2npix(nside)
|
|
105
|
+
|
|
106
|
+
# Calculate the corresponding longitude (az) latitude (el)
|
|
107
|
+
# center coordinates
|
|
108
|
+
longitude, latitude = hp.pix2ang(nside, np.arange(n_pix), lonlat=True)
|
|
109
|
+
|
|
110
|
+
# Get HEALPix pixel indices for each event
|
|
111
|
+
# HEALPix expects latitude in [-90, 90] so we don't need to change elevation
|
|
112
|
+
hpix_idx = hp.ang2pix(nside, az, el, nest=nested, lonlat=True)
|
|
113
|
+
|
|
114
|
+
# Initialize histogram: (n_energy_bins, n_HEALPix pixels)
|
|
115
|
+
hist = np.zeros((len(energy_bin_edges), n_pix))
|
|
94
116
|
|
|
117
|
+
# Bin data in energy & HEALPix space
|
|
95
118
|
for i, (e_min, e_max) in enumerate(energy_bin_edges):
|
|
96
|
-
# Filter data for current energy bin.
|
|
97
119
|
mask = (energy >= e_min) & (energy < e_max)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
bins=[az_bin_edges, el_bin_edges, [e_min, e_max]],
|
|
101
|
-
)
|
|
102
|
-
# Assign 2D histogram to current energy bin.
|
|
103
|
-
hist_total[:, :, i] = hist[:, :, 0]
|
|
120
|
+
# Only count the events that fall within the energy bin
|
|
121
|
+
hist[i, :] += np.bincount(hpix_idx[mask], minlength=n_pix).astype(np.float64)
|
|
104
122
|
|
|
105
|
-
return
|
|
123
|
+
return hist, latitude, longitude, n_pix
|
|
106
124
|
|
|
107
125
|
|
|
108
|
-
def
|
|
109
|
-
|
|
126
|
+
def get_background_rates(
|
|
127
|
+
nside: int = 128,
|
|
110
128
|
) -> NDArray:
|
|
111
129
|
"""
|
|
112
|
-
|
|
130
|
+
Calculate background rates.
|
|
113
131
|
|
|
114
132
|
Parameters
|
|
115
133
|
----------
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
n_spins : int
|
|
119
|
-
Number of spins per pointing.
|
|
120
|
-
sensor : str
|
|
121
|
-
Sensor (45 or 90).
|
|
134
|
+
nside : int, optional
|
|
135
|
+
The nside parameter of the Healpix tessellation (default is 128).
|
|
122
136
|
|
|
123
137
|
Returns
|
|
124
138
|
-------
|
|
125
|
-
|
|
126
|
-
|
|
139
|
+
background_rates : np.ndarray
|
|
140
|
+
Array of background rates.
|
|
141
|
+
|
|
142
|
+
Notes
|
|
143
|
+
-----
|
|
144
|
+
This is a placeholder.
|
|
127
145
|
"""
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
n_pix = hp.nside2npix(nside)
|
|
147
|
+
return np.zeros(n_pix)
|
|
130
148
|
|
|
131
|
-
|
|
149
|
+
|
|
150
|
+
def get_spacecraft_exposure_times(constant_exposure: pandas.DataFrame) -> NDArray:
|
|
151
|
+
"""
|
|
152
|
+
Compute exposure times for HEALPix pixels.
|
|
153
|
+
|
|
154
|
+
Parameters
|
|
155
|
+
----------
|
|
156
|
+
constant_exposure : pandas.DataFrame
|
|
157
|
+
Exposure data.
|
|
158
|
+
|
|
159
|
+
Returns
|
|
160
|
+
-------
|
|
161
|
+
exposure_pointing : np.ndarray
|
|
162
|
+
Total exposure times of pixels in a
|
|
163
|
+
Healpix tessellation of the sky
|
|
164
|
+
in the pointing (dps) frame.
|
|
165
|
+
"""
|
|
166
|
+
# TODO: use the universal spin table and
|
|
167
|
+
# universal pointing table here to determine actual number of spins
|
|
168
|
+
exposure_pointing = (
|
|
169
|
+
constant_exposure["Exposure Time"] * 5760
|
|
170
|
+
) # 5760 spins per pointing (for now)
|
|
171
|
+
|
|
172
|
+
return exposure_pointing
|
|
132
173
|
|
|
133
174
|
|
|
134
175
|
def get_helio_exposure_times(
|
|
@@ -154,10 +195,10 @@ def get_helio_exposure_times(
|
|
|
154
195
|
-----
|
|
155
196
|
These calculations are performed once per pointing.
|
|
156
197
|
"""
|
|
157
|
-
# Get bins and midpoints,
|
|
158
|
-
_, energy_midpoints = build_energy_bins()
|
|
198
|
+
# Get bins and midpoints, with angles in degrees.
|
|
199
|
+
_, energy_midpoints, _ = build_energy_bins()
|
|
159
200
|
az_bin_edges, el_bin_edges, az_bin_midpoints, el_bin_midpoints = (
|
|
160
|
-
|
|
201
|
+
build_spatial_bins()
|
|
161
202
|
)
|
|
162
203
|
|
|
163
204
|
# Initialize the exposure grid.
|
|
@@ -171,7 +212,7 @@ def get_helio_exposure_times(
|
|
|
171
212
|
|
|
172
213
|
# Radial distance.
|
|
173
214
|
r = np.ones(el_grid.shape)
|
|
174
|
-
spherical_coords = np.stack((r,
|
|
215
|
+
spherical_coords = np.stack((r, az_grid, el_grid), axis=-1)
|
|
175
216
|
cartesian_coords = spherical_to_cartesian(spherical_coords)
|
|
176
217
|
cartesian = cartesian_coords.reshape(-1, 3, order="F").T
|
|
177
218
|
|
|
@@ -222,27 +263,37 @@ def get_helio_exposure_times(
|
|
|
222
263
|
return exposure_3d
|
|
223
264
|
|
|
224
265
|
|
|
225
|
-
def
|
|
226
|
-
|
|
227
|
-
|
|
266
|
+
def get_spacecraft_sensitivity(
|
|
267
|
+
efficiencies: pandas.DataFrame,
|
|
268
|
+
geometric_function: pandas.DataFrame,
|
|
269
|
+
) -> pandas.DataFrame:
|
|
228
270
|
"""
|
|
229
|
-
Compute
|
|
271
|
+
Compute sensitivity.
|
|
230
272
|
|
|
231
273
|
Parameters
|
|
232
274
|
----------
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
sensor : str
|
|
238
|
-
Sensor (45 or 90).
|
|
275
|
+
efficiencies : pandas.DataFrame
|
|
276
|
+
Efficiencies at different energy levels.
|
|
277
|
+
geometric_function : pandas.DataFrame
|
|
278
|
+
Geometric function.
|
|
239
279
|
|
|
240
280
|
Returns
|
|
241
281
|
-------
|
|
242
|
-
|
|
243
|
-
|
|
282
|
+
pointing_sensitivity : pandas.DataFrame
|
|
283
|
+
Sensitivity with dimensions (HEALPIX pixel_number, energy).
|
|
244
284
|
"""
|
|
245
|
-
|
|
246
|
-
|
|
285
|
+
# Exclude "Right Ascension (deg)" and "Declination (deg)" from the multiplication
|
|
286
|
+
energy_columns = efficiencies.columns.difference(
|
|
287
|
+
["Right Ascension (deg)", "Declination (deg)"]
|
|
288
|
+
)
|
|
289
|
+
sensitivity = efficiencies[energy_columns].mul(
|
|
290
|
+
geometric_function["Response (cm2-sr)"].values, axis=0
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
# Add "Right Ascension (deg)" and "Declination (deg)" to the result
|
|
294
|
+
sensitivity.insert(
|
|
295
|
+
0, "Right Ascension (deg)", efficiencies["Right Ascension (deg)"]
|
|
296
|
+
)
|
|
297
|
+
sensitivity.insert(1, "Declination (deg)", efficiencies["Declination (deg)"])
|
|
247
298
|
|
|
248
299
|
return sensitivity
|
|
Binary file
|
|
@@ -32,13 +32,24 @@ def create_dataset(
|
|
|
32
32
|
cdf_manager.add_instrument_variable_attrs("ultra", level)
|
|
33
33
|
cdf_manager.add_global_attribute("Data_version", data_version)
|
|
34
34
|
|
|
35
|
+
# L1b extended spin, badtimes, and cullingmask data products
|
|
35
36
|
if "spin_number" in data_dict.keys():
|
|
36
37
|
coords = {
|
|
37
38
|
"spin_number": data_dict["spin_number"],
|
|
38
39
|
"energy_bin_geometric_mean": data_dict["energy_bin_geometric_mean"],
|
|
40
|
+
# Start time aligns with the universal spin table
|
|
41
|
+
"epoch": data_dict["spin_start_time"],
|
|
39
42
|
}
|
|
40
43
|
default_dimension = "spin_number"
|
|
41
|
-
|
|
44
|
+
# L1c pset data products
|
|
45
|
+
elif "healpix" in data_dict:
|
|
46
|
+
coords = {
|
|
47
|
+
"healpix": data_dict["healpix"],
|
|
48
|
+
"energy_bin_geometric_mean": data_dict["energy_bin_geometric_mean"],
|
|
49
|
+
"epoch": data_dict["epoch"],
|
|
50
|
+
}
|
|
51
|
+
default_dimension = "healpix"
|
|
52
|
+
# L1b de data product
|
|
42
53
|
else:
|
|
43
54
|
epoch_time = xr.DataArray(
|
|
44
55
|
data_dict["epoch"],
|
|
@@ -76,7 +87,8 @@ def create_dataset(
|
|
|
76
87
|
}
|
|
77
88
|
|
|
78
89
|
for key in data_dict.keys():
|
|
79
|
-
|
|
90
|
+
# Skip keys that are coordinates.
|
|
91
|
+
if key in ["epoch", "spin_number", "energy_bin_geometric_mean", "healpix"]:
|
|
80
92
|
continue
|
|
81
93
|
elif key in velocity_keys:
|
|
82
94
|
dataset[key] = xr.DataArray(
|
|
@@ -96,6 +108,12 @@ def create_dataset(
|
|
|
96
108
|
dims=["energy_bin_geometric_mean", "spin_number"],
|
|
97
109
|
attrs=cdf_manager.get_variable_attributes(key),
|
|
98
110
|
)
|
|
111
|
+
elif key == "counts":
|
|
112
|
+
dataset[key] = xr.DataArray(
|
|
113
|
+
data_dict[key],
|
|
114
|
+
dims=["energy_bin_geometric_mean", "healpix"],
|
|
115
|
+
attrs=cdf_manager.get_variable_attributes(key),
|
|
116
|
+
)
|
|
99
117
|
else:
|
|
100
118
|
dataset[key] = xr.DataArray(
|
|
101
119
|
data_dict[key],
|
imap_processing/utils.py
CHANGED
|
@@ -79,6 +79,19 @@ def convert_raw_to_eu(
|
|
|
79
79
|
informational columns: ('packetName', 'mnemonic', 'convertAs') and
|
|
80
80
|
conversion columns named 'c0', 'c1', 'c2', etc. Conversion columns
|
|
81
81
|
specify the array of polynomial coefficients used for the conversion.
|
|
82
|
+
If the column 'convertAs' is 'SEGMENTED_POLY' then there must be columns
|
|
83
|
+
'dn_range_start' and 'dn_range_stop' that specifies the raw DN range and the
|
|
84
|
+
coefficients that should be used for the conversion.
|
|
85
|
+
|
|
86
|
+
E.g.:
|
|
87
|
+
|
|
88
|
+
mnemonic convertAs … dn_range_start dn_range_stop c0 c1…
|
|
89
|
+
-------------------------------------------------------------------------
|
|
90
|
+
temperature | SEGMENTED_POLY | 0 | 2063 | 0.1 | 0.2
|
|
91
|
+
temperature | SEGMENTED_POLY | 2064 | 3853 | 0 | 0.1
|
|
92
|
+
temperature | SEGMENTED_POLY | 3854 | 4094 | 0.6 | 0.3
|
|
93
|
+
sensor_v | UNSEGMENTED_POLY | | | 0.04 | .110
|
|
94
|
+
|
|
82
95
|
Comment lines are allowed in the csv file specified by starting with
|
|
83
96
|
the '#' character.
|
|
84
97
|
packet_name : str
|
|
@@ -86,7 +99,8 @@ def convert_raw_to_eu(
|
|
|
86
99
|
**read_csv_kwargs : dict
|
|
87
100
|
In order to allow for some flexibility in the format of the csv
|
|
88
101
|
conversion table, any additional keywords passed to this function are
|
|
89
|
-
passed in the call to `pandas.read_csv()`.
|
|
102
|
+
passed in the call to `pandas.read_csv()`.
|
|
103
|
+
See pandas documentation
|
|
90
104
|
for a list of keywords and their functionality:
|
|
91
105
|
https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html.
|
|
92
106
|
|
|
@@ -95,47 +109,73 @@ def convert_raw_to_eu(
|
|
|
95
109
|
dataset : xr.Dataset
|
|
96
110
|
Raw data converted to engineering unit as needed.
|
|
97
111
|
"""
|
|
98
|
-
# Make sure there is column called "index" with unique
|
|
99
|
-
# value such as 0, 1, 2, 3, ...
|
|
100
112
|
eu_conversion_df = pd.read_csv(
|
|
101
113
|
conversion_table_path,
|
|
102
114
|
**read_csv_kwargs,
|
|
103
115
|
)
|
|
104
116
|
|
|
105
|
-
#
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
# Iterate through every variable in the dataset and check if there is an entry for
|
|
118
|
+
# That variable in the conversion table.
|
|
119
|
+
for var in dataset.variables:
|
|
120
|
+
packet_df = eu_conversion_df.loc[
|
|
121
|
+
(eu_conversion_df["packetName"] == packet_name)
|
|
122
|
+
&
|
|
123
|
+
# Filter for mnemonic case-insensitive
|
|
124
|
+
(eu_conversion_df["mnemonic"].str.lower() == var.lower())
|
|
125
|
+
].reset_index(drop=True)
|
|
126
|
+
|
|
127
|
+
if packet_df.empty:
|
|
128
|
+
continue
|
|
129
|
+
|
|
130
|
+
if np.all(packet_df["convertAs"] == "UNSEGMENTED_POLY"):
|
|
131
|
+
if len(packet_df.index) > 1:
|
|
132
|
+
raise ValueError(
|
|
133
|
+
"For unsegmented polynomial conversions, there should "
|
|
134
|
+
"only be one row per mnemonic and packet name."
|
|
135
|
+
)
|
|
136
|
+
row = packet_df.iloc[0]
|
|
111
137
|
# On this line, we are getting the coefficients from the
|
|
112
138
|
# table and then reverse them because the np.polyval is
|
|
113
139
|
# expecting coefficient in descending order
|
|
114
140
|
# coeff columns must have names 'c0', 'c1', 'c2', ...
|
|
115
141
|
coeff_values = row.filter(regex=r"c\d").values[::-1]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
# Convert the raw value to engineering unit
|
|
143
|
+
dataset[var].data = np.polyval(coeff_values, dataset[var].data)
|
|
144
|
+
|
|
145
|
+
elif np.all(packet_df["convertAs"] == "SEGMENTED_POLY"):
|
|
146
|
+
data = dataset[var].data
|
|
147
|
+
# Check if any of the raw DN values fall outside the ranges
|
|
148
|
+
bad_mask = np.logical_or(
|
|
149
|
+
data < packet_df["dn_range_start"].min(),
|
|
150
|
+
data > packet_df["dn_range_stop"].max(),
|
|
151
|
+
)
|
|
152
|
+
if np.any(data[bad_mask]):
|
|
153
|
+
raise ValueError(
|
|
154
|
+
"Raw DN values found outside of the expected range"
|
|
155
|
+
f"for mnemonic: {var}"
|
|
126
156
|
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
157
|
+
# Create conditions and corresponding functions for np.piecewise
|
|
158
|
+
conditions = [
|
|
159
|
+
(data >= row["dn_range_start"]) & (data <= row["dn_range_stop"])
|
|
160
|
+
for _, row in packet_df.iterrows()
|
|
161
|
+
]
|
|
162
|
+
functions = [
|
|
163
|
+
lambda x, r=row: np.polyval(r.filter(regex=r"c\d").values[::-1], x)
|
|
164
|
+
for _, row in packet_df.iterrows()
|
|
165
|
+
]
|
|
166
|
+
# Convert the raw value to engineering unit
|
|
167
|
+
dataset[var].data = np.piecewise(data, conditions, functions)
|
|
168
|
+
|
|
133
169
|
else:
|
|
134
170
|
raise ValueError(
|
|
135
|
-
|
|
136
|
-
|
|
171
|
+
"Column 'convertAs' must all be UNSEGMENTED_POLY or "
|
|
172
|
+
"SEGMENTED_POLY for a packet name and mnemonic"
|
|
137
173
|
)
|
|
138
174
|
|
|
175
|
+
# Modify units attribute
|
|
176
|
+
if "unit" in packet_df:
|
|
177
|
+
dataset[var].attrs.update({"UNITS": packet_df.iloc[0]["unit"]})
|
|
178
|
+
|
|
139
179
|
return dataset
|
|
140
180
|
|
|
141
181
|
|
|
@@ -339,5 +379,5 @@ def convert_to_binary_string(data: bytes) -> str:
|
|
|
339
379
|
binary_data : str
|
|
340
380
|
The binary data as a string.
|
|
341
381
|
"""
|
|
342
|
-
binary_str_data = f"{int.from_bytes(data, byteorder='big'):0{len(data)*8}b}"
|
|
382
|
+
binary_str_data = f"{int.from_bytes(data, byteorder='big'):0{len(data) * 8}b}"
|
|
343
383
|
return binary_str_data
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: imap-processing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: IMAP Science Operations Center Processing
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: IMAP,SDC,SOC,Science Operations
|
|
7
7
|
Author: IMAP SDC Developers
|
|
8
8
|
Author-email: imap-sdc@lists.lasp.colorado.edu
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10,<4
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -16,7 +16,6 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
16
16
|
Classifier: Operating System :: POSIX
|
|
17
17
|
Classifier: Operating System :: Unix
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -25,11 +24,15 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
25
24
|
Classifier: Topic :: Software Development
|
|
26
25
|
Provides-Extra: dev
|
|
27
26
|
Provides-Extra: doc
|
|
27
|
+
Provides-Extra: map-visualization
|
|
28
28
|
Provides-Extra: test
|
|
29
29
|
Provides-Extra: tools
|
|
30
|
+
Requires-Dist: astropy-healpix (>=1.0)
|
|
30
31
|
Requires-Dist: cdflib (>=1.3.1,<2.0.0)
|
|
32
|
+
Requires-Dist: healpy (>=1.18.0,<2.0.0) ; extra == "map-visualization"
|
|
31
33
|
Requires-Dist: imap-data-access (>=0.10.1)
|
|
32
34
|
Requires-Dist: mypy (==1.10.1) ; extra == "dev"
|
|
35
|
+
Requires-Dist: netcdf4 (>=1.7.2,<2.0.0) ; extra == "test"
|
|
33
36
|
Requires-Dist: numpy (<=3)
|
|
34
37
|
Requires-Dist: numpydoc (>=1.5.0,<2.0.0) ; extra == "doc"
|
|
35
38
|
Requires-Dist: openpyxl (>=3.0.7) ; extra == "test" or extra == "tools"
|
|
@@ -38,15 +41,15 @@ Requires-Dist: pre-commit (>=3.3.3,<4.0.0) ; extra == "dev"
|
|
|
38
41
|
Requires-Dist: pydata-sphinx-theme ; extra == "doc"
|
|
39
42
|
Requires-Dist: pytest (>=6.2.5) ; extra == "test"
|
|
40
43
|
Requires-Dist: pytest-cov (>=4.0.0,<5.0.0) ; extra == "test"
|
|
41
|
-
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
42
44
|
Requires-Dist: requests (>=2.32.3,<3.0.0) ; extra == "test"
|
|
43
45
|
Requires-Dist: ruff (==0.2.1) ; extra == "dev"
|
|
44
46
|
Requires-Dist: sammi-cdf (>=1.0,<2.0)
|
|
47
|
+
Requires-Dist: scipy (>=1.13,<2.0)
|
|
45
48
|
Requires-Dist: space_packet_parser (>=5.0.1,<6.0.0)
|
|
46
49
|
Requires-Dist: sphinx ; extra == "doc"
|
|
47
50
|
Requires-Dist: sphinxcontrib-openapi (>=0.8.3,<0.9.0) ; extra == "doc"
|
|
48
51
|
Requires-Dist: spiceypy (>=6.0.0)
|
|
49
|
-
Requires-Dist: xarray (>=
|
|
52
|
+
Requires-Dist: xarray (>=2024.10.0)
|
|
50
53
|
Description-Content-Type: text/markdown
|
|
51
54
|
|
|
52
55
|
# IMAP (Interstellar Mapping and Acceleration Probe)
|