imap-processing 0.6.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.
- imap_processing/__init__.py +34 -0
- imap_processing/_version.py +3 -0
- imap_processing/ccsds/__init__.py +0 -0
- imap_processing/ccsds/ccsds_data.py +55 -0
- imap_processing/ccsds/excel_to_xtce.py +477 -0
- imap_processing/cdf/__init__.py +0 -0
- imap_processing/cdf/cdf_attribute_manager.py +322 -0
- imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +212 -0
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +1358 -0
- imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml +391 -0
- imap_processing/cdf/config/imap_constant_attrs.yaml +33 -0
- imap_processing/cdf/config/imap_default_global_cdf_attrs.yaml +17 -0
- imap_processing/cdf/config/imap_glows_global_cdf_attrs.yaml +41 -0
- imap_processing/cdf/config/imap_glows_l1a_variable_attrs.yaml +499 -0
- imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +334 -0
- imap_processing/cdf/config/imap_hi_global_cdf_attrs.yaml +51 -0
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +435 -0
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +27 -0
- imap_processing/cdf/config/imap_hit_l1a_variable_attrs.yaml +493 -0
- imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml +564 -0
- imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +24 -0
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +426 -0
- imap_processing/cdf/config/imap_lo_global_cdf_attrs.yaml +90 -0
- imap_processing/cdf/config/imap_lo_l1a_variable_attrs.yaml +487 -0
- imap_processing/cdf/config/imap_lo_l1b_variable_attrs.yaml +121 -0
- imap_processing/cdf/config/imap_lo_l1c_variable_attrs.yaml +179 -0
- imap_processing/cdf/config/imap_mag_global_cdf_attrs.yaml +97 -0
- imap_processing/cdf/config/imap_mag_l1_variable_attrs.yaml +201 -0
- imap_processing/cdf/config/imap_swapi_global_cdf_attrs.yaml +33 -0
- imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +137 -0
- imap_processing/cdf/config/imap_swe_global_cdf_attrs.yaml +24 -0
- imap_processing/cdf/config/imap_swe_l1a_variable_attrs.yaml +234 -0
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +273 -0
- imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml +100 -0
- imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +52 -0
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +297 -0
- imap_processing/cdf/config/imap_ultra_l1c_variable_attrs.yaml +121 -0
- imap_processing/cdf/config/shared/default_global_cdf_attrs_schema.yaml +246 -0
- imap_processing/cdf/config/shared/default_variable_cdf_attrs_schema.yaml +466 -0
- imap_processing/cdf/imap_cdf_manager.py +64 -0
- imap_processing/cdf/utils.py +147 -0
- imap_processing/cli.py +863 -0
- imap_processing/codice/__init__.py +1 -0
- imap_processing/codice/codice_l0.py +54 -0
- imap_processing/codice/codice_l1a.py +558 -0
- imap_processing/codice/codice_l1b.py +194 -0
- imap_processing/codice/constants.py +986 -0
- imap_processing/codice/data/esa_sweep_values.csv +257 -0
- imap_processing/codice/data/lo_stepping_values.csv +129 -0
- imap_processing/codice/decompress.py +142 -0
- imap_processing/codice/packet_definitions/P_COD_NHK.xml +618 -0
- imap_processing/codice/packet_definitions/codice_packet_definition.xml +5073 -0
- imap_processing/codice/utils.py +95 -0
- imap_processing/decom.py +40 -0
- imap_processing/glows/__init__.py +1 -0
- imap_processing/glows/ancillary/l1b_conversion_table_v001.json +42 -0
- imap_processing/glows/l0/__init__.py +0 -0
- imap_processing/glows/l0/decom_glows.py +91 -0
- imap_processing/glows/l0/glows_l0_data.py +194 -0
- imap_processing/glows/l1a/glows_l1a.py +424 -0
- imap_processing/glows/l1a/glows_l1a_data.py +555 -0
- imap_processing/glows/l1b/glows_l1b.py +270 -0
- imap_processing/glows/l1b/glows_l1b_data.py +583 -0
- imap_processing/glows/packet_definitions/GLX_COMBINED.xml +254 -0
- imap_processing/glows/packet_definitions/P_GLX_TMSCDE.xml +97 -0
- imap_processing/glows/packet_definitions/P_GLX_TMSCHIST.xml +215 -0
- imap_processing/glows/utils/__init__.py +0 -0
- imap_processing/glows/utils/constants.py +105 -0
- imap_processing/hi/__init__.py +1 -0
- imap_processing/hi/l0/__init__.py +0 -0
- imap_processing/hi/l0/decom_hi.py +24 -0
- imap_processing/hi/l1a/__init__.py +0 -0
- imap_processing/hi/l1a/hi_l1a.py +73 -0
- imap_processing/hi/l1a/histogram.py +142 -0
- imap_processing/hi/l1a/housekeeping.py +27 -0
- imap_processing/hi/l1a/science_direct_event.py +341 -0
- imap_processing/hi/l1b/__init__.py +0 -0
- imap_processing/hi/l1b/hi_eng_unit_convert_table.csv +154 -0
- imap_processing/hi/l1b/hi_l1b.py +127 -0
- imap_processing/hi/l1c/__init__.py +0 -0
- imap_processing/hi/l1c/hi_l1c.py +228 -0
- imap_processing/hi/packet_definitions/__init__.py +0 -0
- imap_processing/hi/packet_definitions/hi_packet_definition.xml +482 -0
- imap_processing/hi/utils.py +27 -0
- imap_processing/hit/__init__.py +1 -0
- imap_processing/hit/l0/__init__.py +0 -0
- imap_processing/hit/l0/data_classes/housekeeping.py +240 -0
- imap_processing/hit/l0/data_classes/science_packet.py +259 -0
- imap_processing/hit/l0/decom_hit.py +467 -0
- imap_processing/hit/l0/utils/hit_base.py +57 -0
- imap_processing/hit/l1a/__init__.py +0 -0
- imap_processing/hit/l1a/hit_l1a.py +254 -0
- imap_processing/hit/l1b/hit_l1b.py +179 -0
- imap_processing/hit/packet_definitions/hit_packet_definitions.xml +1276 -0
- imap_processing/ialirt/__init__.py +0 -0
- imap_processing/ialirt/l0/__init__.py +0 -0
- imap_processing/ialirt/l0/process_hit.py +220 -0
- imap_processing/ialirt/packet_definitions/__init__.py +0 -0
- imap_processing/ialirt/packet_definitions/ialirt.xml +778 -0
- imap_processing/ialirt/packet_definitions/ialirt_hit.xml +186 -0
- imap_processing/idex/__init__.py +2 -0
- imap_processing/idex/idex_constants.py +27 -0
- imap_processing/idex/idex_l0.py +31 -0
- imap_processing/idex/idex_l1a.py +631 -0
- imap_processing/idex/packet_definitions/idex_packet_definition.xml +3162 -0
- imap_processing/lo/__init__.py +1 -0
- imap_processing/lo/l0/__init__.py +0 -0
- imap_processing/lo/l0/data_classes/science_direct_events.py +215 -0
- imap_processing/lo/l0/data_classes/star_sensor.py +98 -0
- imap_processing/lo/l0/decompression_tables/12_to_16_bit.csv +4097 -0
- imap_processing/lo/l0/decompression_tables/8_to_12_bit.csv +257 -0
- imap_processing/lo/l0/decompression_tables/8_to_16_bit.csv +257 -0
- imap_processing/lo/l0/decompression_tables/decompression_tables.py +75 -0
- imap_processing/lo/l0/lo_apid.py +15 -0
- imap_processing/lo/l0/lo_science.py +150 -0
- imap_processing/lo/l0/utils/binary_string.py +59 -0
- imap_processing/lo/l0/utils/bit_decompression.py +62 -0
- imap_processing/lo/l0/utils/lo_base.py +57 -0
- imap_processing/lo/l1a/__init__.py +0 -0
- imap_processing/lo/l1a/lo_l1a.py +157 -0
- imap_processing/lo/l1b/lo_l1b.py +160 -0
- imap_processing/lo/l1c/lo_l1c.py +180 -0
- imap_processing/lo/packet_definitions/lo_xtce.xml +3541 -0
- imap_processing/mag/__init__.py +2 -0
- imap_processing/mag/constants.py +108 -0
- imap_processing/mag/l0/decom_mag.py +170 -0
- imap_processing/mag/l0/mag_l0_data.py +118 -0
- imap_processing/mag/l1a/mag_l1a.py +317 -0
- imap_processing/mag/l1a/mag_l1a_data.py +1007 -0
- imap_processing/mag/l1b/__init__.py +0 -0
- imap_processing/mag/l1b/imap_calibration_mag_20240229_v01.cdf +0 -0
- imap_processing/mag/l1b/mag_l1b.py +125 -0
- imap_processing/mag/l1c/mag_l1c.py +57 -0
- imap_processing/mag/packet_definitions/MAG_SCI_COMBINED.xml +235 -0
- imap_processing/quality_flags.py +91 -0
- imap_processing/spice/__init__.py +1 -0
- imap_processing/spice/geometry.py +322 -0
- imap_processing/spice/kernels.py +459 -0
- imap_processing/spice/time.py +72 -0
- imap_processing/swapi/__init__.py +1 -0
- imap_processing/swapi/l1/__init__.py +0 -0
- imap_processing/swapi/l1/swapi_l1.py +685 -0
- imap_processing/swapi/l2/__init__.py +0 -0
- imap_processing/swapi/l2/swapi_l2.py +107 -0
- imap_processing/swapi/packet_definitions/__init__.py +0 -0
- imap_processing/swapi/packet_definitions/swapi_packet_definition.xml +708 -0
- imap_processing/swapi/swapi_utils.py +25 -0
- imap_processing/swe/__init__.py +1 -0
- imap_processing/swe/l1a/__init__.py +0 -0
- imap_processing/swe/l1a/swe_l1a.py +48 -0
- imap_processing/swe/l1a/swe_science.py +223 -0
- imap_processing/swe/l1b/engineering_unit_convert_table.csv +65 -0
- imap_processing/swe/l1b/swe_esa_lookup_table.csv +1441 -0
- imap_processing/swe/l1b/swe_l1b.py +49 -0
- imap_processing/swe/l1b/swe_l1b_science.py +557 -0
- imap_processing/swe/packet_definitions/__init__.py +0 -0
- imap_processing/swe/packet_definitions/swe_packet_definition.xml +303 -0
- imap_processing/swe/utils/__init__.py +0 -0
- imap_processing/swe/utils/swe_utils.py +9 -0
- imap_processing/tests/__init__.py +0 -0
- imap_processing/tests/ccsds/test_data/expected_output.xml +171 -0
- imap_processing/tests/ccsds/test_excel_to_xtce.py +285 -0
- imap_processing/tests/cdf/__init__.py +0 -0
- imap_processing/tests/cdf/imap_default_global_cdf_attrs.yaml +8 -0
- imap_processing/tests/cdf/shared/default_global_cdf_attrs_schema.yaml +246 -0
- imap_processing/tests/cdf/shared/default_variable_cdf_attrs_schema.yaml +466 -0
- imap_processing/tests/cdf/test_cdf_attribute_manager.py +353 -0
- imap_processing/tests/cdf/test_data/imap_default_global_test_cdf_attrs.yaml +7 -0
- imap_processing/tests/cdf/test_data/imap_instrument1_global_cdf_attrs.yaml +14 -0
- imap_processing/tests/cdf/test_data/imap_instrument1_level1_variable_attrs.yaml +23 -0
- imap_processing/tests/cdf/test_data/imap_instrument2_global_cdf_attrs.yaml +23 -0
- imap_processing/tests/cdf/test_data/imap_instrument2_level2_variable_attrs.yaml +30 -0
- imap_processing/tests/cdf/test_data/imap_test_global.yaml +26 -0
- imap_processing/tests/cdf/test_data/imap_test_variable.yaml +41 -0
- imap_processing/tests/cdf/test_imap_cdf_manager.py +62 -0
- imap_processing/tests/cdf/test_utils.py +109 -0
- imap_processing/tests/codice/__init__.py +0 -0
- imap_processing/tests/codice/conftest.py +56 -0
- imap_processing/tests/codice/data/eu_unit_lookup_table.csv +101 -0
- imap_processing/tests/codice/data/idle_export_eu.COD_NHK_20230822_122700 2.csv +100 -0
- imap_processing/tests/codice/data/idle_export_raw.COD_NHK_20230822_122700.csv +100 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-counters-aggregated_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-counters-singles_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-omni_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-pha_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-sectored_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hskp_20100101_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-counters-aggregated_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-counters-singles_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-angular_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-priority_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-species_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-pha_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-angular_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-priority_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-species_20240429_v001.pkts +0 -0
- 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/codice/test_codice_l0.py +144 -0
- imap_processing/tests/codice/test_codice_l1a.py +187 -0
- imap_processing/tests/codice/test_codice_l1b.py +60 -0
- imap_processing/tests/codice/test_decompress.py +50 -0
- imap_processing/tests/conftest.py +372 -0
- imap_processing/tests/glows/direct_events_validation_data_l1a.csv +5704 -0
- imap_processing/tests/glows/glows_test_packet_20110921_v01.pkts +0 -0
- imap_processing/tests/glows/test_glows_decom.py +133 -0
- imap_processing/tests/glows/test_glows_l1a_cdf.py +85 -0
- imap_processing/tests/glows/test_glows_l1a_data.py +510 -0
- imap_processing/tests/glows/test_glows_l1b.py +348 -0
- imap_processing/tests/glows/test_glows_l1b_data.py +70 -0
- imap_processing/tests/hi/__init__.py +0 -0
- imap_processing/tests/hi/conftest.py +133 -0
- imap_processing/tests/hi/test_data/l0/20231030_H45_APP_NHK.bin +0 -0
- imap_processing/tests/hi/test_data/l0/20231030_H45_APP_NHK.csv +201 -0
- imap_processing/tests/hi/test_data/l0/20231030_H45_SCI_CNT.bin +0 -0
- imap_processing/tests/hi/test_data/l0/20231030_H45_SCI_DE.bin +0 -0
- imap_processing/tests/hi/test_data/l0/README.txt +54 -0
- imap_processing/tests/hi/test_decom.py +55 -0
- imap_processing/tests/hi/test_hi_l1b.py +31 -0
- imap_processing/tests/hi/test_hi_l1c.py +69 -0
- imap_processing/tests/hi/test_l1a.py +96 -0
- imap_processing/tests/hi/test_l1a_sci_de.py +72 -0
- imap_processing/tests/hi/test_utils.py +15 -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/__init__.py +0 -0
- imap_processing/tests/hit/test_data/imap_hit_l0_hk_20100105_v001.pkts +0 -0
- imap_processing/tests/hit/test_data/sci_sample.ccsds +0 -0
- imap_processing/tests/hit/test_hit_decom.py +230 -0
- imap_processing/tests/hit/test_hit_l1a.py +224 -0
- imap_processing/tests/hit/test_hit_l1b.py +52 -0
- imap_processing/tests/hit/validation_data/hskp_sample_raw.csv +88 -0
- imap_processing/tests/ialirt/__init__.py +0 -0
- imap_processing/tests/ialirt/test_data/l0/IALiRT Raw Packet Telemetry.txt +33 -0
- imap_processing/tests/ialirt/test_data/l0/hit_ialirt_sample.ccsds +0 -0
- imap_processing/tests/ialirt/test_data/l0/hit_ialirt_sample.csv +1001 -0
- imap_processing/tests/ialirt/unit/__init__.py +0 -0
- imap_processing/tests/ialirt/unit/test_decom_ialirt.py +94 -0
- imap_processing/tests/ialirt/unit/test_process_hit.py +226 -0
- imap_processing/tests/idex/__init__.py +0 -0
- imap_processing/tests/idex/conftest.py +22 -0
- imap_processing/tests/idex/imap_idex_l0_raw_20230725_v001.pkts +0 -0
- imap_processing/tests/idex/impact_14_tof_high_data.txt +8189 -0
- imap_processing/tests/idex/test_idex_l0.py +45 -0
- imap_processing/tests/idex/test_idex_l1a.py +91 -0
- imap_processing/tests/lo/__init__.py +0 -0
- imap_processing/tests/lo/test_binary_string.py +21 -0
- imap_processing/tests/lo/test_bit_decompression.py +39 -0
- imap_processing/tests/lo/test_cdfs/imap_lo_l0_raw_20240627_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/lo/test_cdfs/imap_lo_l1b_de_20100101_v001.cdf +0 -0
- imap_processing/tests/lo/test_lo_l1a.py +66 -0
- imap_processing/tests/lo/test_lo_l1b.py +74 -0
- imap_processing/tests/lo/test_lo_l1c.py +66 -0
- imap_processing/tests/lo/test_science_counts.py +41 -0
- imap_processing/tests/lo/test_science_direct_events.py +209 -0
- imap_processing/tests/lo/test_star_sensor.py +35 -0
- imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf +0 -0
- imap_processing/tests/mag/mag_l0_test_data.pkts +0 -0
- imap_processing/tests/mag/mag_l0_test_output.csv +37 -0
- imap_processing/tests/mag/mag_l1_test_data.pkts +0 -0
- imap_processing/tests/mag/mag_l1a_test_output.csv +97 -0
- imap_processing/tests/mag/test_mag_decom.py +117 -0
- imap_processing/tests/mag/test_mag_l1a.py +856 -0
- imap_processing/tests/mag/test_mag_l1b.py +77 -0
- imap_processing/tests/mag/test_mag_l1c.py +40 -0
- imap_processing/tests/spice/__init__.py +0 -0
- imap_processing/tests/spice/test_data/imap_ena_sim_metakernel.template +4 -0
- imap_processing/tests/spice/test_data/imap_science_0001.tf +171 -0
- imap_processing/tests/spice/test_data/imap_sclk_0000.tsc +156 -0
- imap_processing/tests/spice/test_data/imap_sim_ck_2hr_2secsampling_with_nutation.bc +0 -0
- imap_processing/tests/spice/test_data/imap_simple_metakernel.template +3 -0
- imap_processing/tests/spice/test_data/imap_spk_demo.bsp +0 -0
- imap_processing/tests/spice/test_data/imap_wkcp.tf +1806 -0
- imap_processing/tests/spice/test_data/naif0012.tls +150 -0
- imap_processing/tests/spice/test_data/sim_1yr_imap_attitude.bc +0 -0
- imap_processing/tests/spice/test_data/sim_1yr_imap_pointing_frame.bc +0 -0
- imap_processing/tests/spice/test_geometry.py +214 -0
- imap_processing/tests/spice/test_kernels.py +272 -0
- imap_processing/tests/spice/test_time.py +35 -0
- imap_processing/tests/swapi/__init__.py +0 -0
- imap_processing/tests/swapi/conftest.py +16 -0
- imap_processing/tests/swapi/l0_data/__init__.py +0 -0
- imap_processing/tests/swapi/l0_data/imap_swapi_l0_raw_20231012_v001.pkts +0 -0
- imap_processing/tests/swapi/l0_validation_data/__init__.py +0 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_eu.SWP_AUT_20231012_125245.csv +124 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_eu.SWP_HK_20231012_125245.csv +98 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_eu.SWP_MG_20231012_125245.csv +9 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_eu.SWP_SCI_20231012_125245.csv +72 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_raw.SWP_AUT_20231012_125245.csv +124 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_raw.SWP_HK_20231012_125245.csv +98 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_raw.SWP_MG_20231012_125245.csv +9 -0
- imap_processing/tests/swapi/l0_validation_data/idle_export_raw.SWP_SCI_20231012_125245.csv +72 -0
- imap_processing/tests/swapi/test_swapi_decom.py +135 -0
- imap_processing/tests/swapi/test_swapi_l1.py +354 -0
- imap_processing/tests/swapi/test_swapi_l2.py +21 -0
- imap_processing/tests/swe/__init__.py +0 -0
- imap_processing/tests/swe/conftest.py +35 -0
- imap_processing/tests/swe/decompressed/20230927173238_4th_quarter_decompressed.csv +181 -0
- imap_processing/tests/swe/decompressed/20230927173253_1st_quarter_decompressed.csv +181 -0
- imap_processing/tests/swe/decompressed/20230927173308_2nd_quarter_decompressed.csv +181 -0
- imap_processing/tests/swe/decompressed/20230927173323_3rd_quarter_decompressed.csv +181 -0
- imap_processing/tests/swe/l0_data/2024051010_SWE_SCIENCE_packet.bin +0 -0
- imap_processing/tests/swe/l0_validation_data/idle_export_eu.SWE_SCIENCE_20240510_092742.csv +544 -0
- imap_processing/tests/swe/l0_validation_data/idle_export_raw.SWE_SCIENCE_20240510_092742.csv +363 -0
- imap_processing/tests/swe/test_swe_l1a.py +12 -0
- imap_processing/tests/swe/test_swe_l1a_science.py +129 -0
- imap_processing/tests/swe/test_swe_l1b.py +61 -0
- imap_processing/tests/swe/test_swe_l1b_science.py +65 -0
- imap_processing/tests/test_cli.py +229 -0
- imap_processing/tests/test_decom.py +66 -0
- imap_processing/tests/test_quality_flags.py +71 -0
- imap_processing/tests/test_utils.py +107 -0
- imap_processing/tests/ultra/__init__.py +0 -0
- imap_processing/tests/ultra/test_data/l0/FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50_theta-0.00_20240207T102740.CCSDS +0 -0
- imap_processing/tests/ultra/test_data/l0/FM45_7P_Phi0.0_BeamCal_LinearScan_phi0.04_theta-0.01_20230821T121304.CCSDS +0 -0
- imap_processing/tests/ultra/test_data/l0/FM45_TV_Cycle6_Hot_Ops_Front212_20240124T063837.CCSDS +0 -0
- imap_processing/tests/ultra/test_data/l0/Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.CCSDS +0 -0
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_auxdata_Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.csv +24 -0
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_enaphxtofhangimg_FM45_TV_Cycle6_Hot_Ops_Front212_20240124T063837.csv +105 -0
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultraimgrates_Ultra45_EM_SwRI_Cal_Run7_ThetaScan_20220530T225054.csv +24 -0
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimg_withFSWcalcs_FM45_40P_Phi28p5_BeamCal_LinearScan_phi2850_theta-000_20240207T102740.csv +3314 -0
- imap_processing/tests/ultra/test_data/l0/ultra45_raw_sc_ultrarawimgevent_FM45_7P_Phi00_BeamCal_LinearScan_phi004_theta-001_20230821T121304.csv +702 -0
- imap_processing/tests/ultra/unit/__init__.py +0 -0
- imap_processing/tests/ultra/unit/conftest.py +210 -0
- imap_processing/tests/ultra/unit/test_decom_apid_880.py +98 -0
- imap_processing/tests/ultra/unit/test_decom_apid_881.py +50 -0
- imap_processing/tests/ultra/unit/test_decom_apid_883.py +44 -0
- imap_processing/tests/ultra/unit/test_decom_apid_896.py +104 -0
- imap_processing/tests/ultra/unit/test_lookup_utils.py +68 -0
- imap_processing/tests/ultra/unit/test_ultra_l1a.py +338 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +122 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +57 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +342 -0
- imap_processing/tests/ultra/unit/test_ultra_l1c.py +104 -0
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +35 -0
- imap_processing/ultra/__init__.py +1 -0
- imap_processing/ultra/constants.py +60 -0
- imap_processing/ultra/l0/__init__.py +0 -0
- imap_processing/ultra/l0/decom_tools.py +281 -0
- imap_processing/ultra/l0/decom_ultra.py +278 -0
- imap_processing/ultra/l0/ultra_utils.py +326 -0
- imap_processing/ultra/l1a/__init__.py +0 -0
- imap_processing/ultra/l1a/ultra_l1a.py +319 -0
- imap_processing/ultra/l1b/badtimes.py +26 -0
- imap_processing/ultra/l1b/cullingmask.py +26 -0
- imap_processing/ultra/l1b/de.py +59 -0
- imap_processing/ultra/l1b/extendedspin.py +45 -0
- imap_processing/ultra/l1b/lookup_utils.py +165 -0
- imap_processing/ultra/l1b/ultra_l1b.py +65 -0
- imap_processing/ultra/l1b/ultra_l1b_annotated.py +54 -0
- imap_processing/ultra/l1b/ultra_l1b_extended.py +764 -0
- imap_processing/ultra/l1c/histogram.py +36 -0
- imap_processing/ultra/l1c/pset.py +36 -0
- imap_processing/ultra/l1c/ultra_l1c.py +52 -0
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +54 -0
- imap_processing/ultra/lookup_tables/EgyNorm.mem.csv +32769 -0
- imap_processing/ultra/lookup_tables/FM45_Startup1_ULTRA_IMGPARAMS_20240719.csv +2 -0
- imap_processing/ultra/lookup_tables/ultra45_back-pos-luts.csv +4097 -0
- imap_processing/ultra/lookup_tables/ultra45_tdc_norm.csv +2050 -0
- imap_processing/ultra/lookup_tables/ultra90_back-pos-luts.csv +4097 -0
- imap_processing/ultra/lookup_tables/ultra90_tdc_norm.csv +2050 -0
- imap_processing/ultra/lookup_tables/yadjust.csv +257 -0
- imap_processing/ultra/packet_definitions/ULTRA_SCI_COMBINED.xml +547 -0
- imap_processing/ultra/packet_definitions/__init__.py +0 -0
- imap_processing/ultra/utils/__init__.py +0 -0
- imap_processing/ultra/utils/ultra_l1_utils.py +50 -0
- imap_processing/utils.py +413 -0
- imap_processing-0.6.0.dist-info/LICENSE +21 -0
- imap_processing-0.6.0.dist-info/METADATA +107 -0
- imap_processing-0.6.0.dist-info/RECORD +398 -0
- imap_processing-0.6.0.dist-info/WHEEL +4 -0
- imap_processing-0.6.0.dist-info/entry_points.txt +4 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"""IMAP-Hi direct event processing."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import xarray as xr
|
|
5
|
+
|
|
6
|
+
from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
|
|
7
|
+
from imap_processing.spice.time import met_to_j2000ns
|
|
8
|
+
|
|
9
|
+
# TODO: read LOOKED_UP_DURATION_OF_TICK from
|
|
10
|
+
# instrument status summary later. This value
|
|
11
|
+
# is rarely change but want to be able to change
|
|
12
|
+
# it if needed. It stores information about how
|
|
13
|
+
# fast the time was ticking. It is in microseconds.
|
|
14
|
+
LOOKED_UP_DURATION_OF_TICK = 3999
|
|
15
|
+
|
|
16
|
+
SECOND_TO_NS = 1e9
|
|
17
|
+
MILLISECOND_TO_NS = 1e6
|
|
18
|
+
MICROSECOND_TO_NS = 1e3
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def parse_direct_event(event_data: str) -> dict:
|
|
22
|
+
"""
|
|
23
|
+
Parse event data.
|
|
24
|
+
|
|
25
|
+
IMAP-Hi direct event data information is stored in
|
|
26
|
+
48-bits as follow:
|
|
27
|
+
|
|
28
|
+
| Read first two bits (start_bitmask_data) to find
|
|
29
|
+
| out which type of event it is. start_bitmask_data value mapping:
|
|
30
|
+
|
|
|
31
|
+
| 1 - A
|
|
32
|
+
| 2 - B
|
|
33
|
+
| 3 - C
|
|
34
|
+
| 0 - META
|
|
35
|
+
| If it's a metaevent:
|
|
36
|
+
|
|
|
37
|
+
| Read 48-bits into 2, 4, 10, 32 bits. Each of these breaks
|
|
38
|
+
| down as:
|
|
39
|
+
|
|
|
40
|
+
| start_bitmask_data - 2 bits (tA=1, tB=2, tC1=3, META=0)
|
|
41
|
+
| ESA step - 4 bits
|
|
42
|
+
| integer millisecond of MET(subseconds) - 10 bits
|
|
43
|
+
| integer MET(seconds) - 32 bits
|
|
44
|
+
|
|
|
45
|
+
| If it's not a metaevent:
|
|
46
|
+
| Read 48-bits into 2, 10, 10, 10, 16 bits. Each of these breaks
|
|
47
|
+
| down as:
|
|
48
|
+
|
|
|
49
|
+
| start_bitmask_data - 2 bits (tA=1, tB=2, tC1=3, META=0)
|
|
50
|
+
| tof_1 - 10 bit counter
|
|
51
|
+
| tof_2 - 10 bit counter
|
|
52
|
+
| tof_3 - 10 bit counter
|
|
53
|
+
| de_tag - 16 bits
|
|
54
|
+
|
|
55
|
+
There are at most total of 665 of 48-bits in each data packet.
|
|
56
|
+
This data packet is of variable length. If there is one event, then
|
|
57
|
+
DE_TOF will contain 48-bits. If there are 665 events, then
|
|
58
|
+
DE_TOF will contain 665 x 48-bits. If there is no event, then
|
|
59
|
+
DE_TOF will contain 0-bits.
|
|
60
|
+
|
|
61
|
+
Per ESA, there should be two data packets. First one will begin with
|
|
62
|
+
metaevent followed by direct events data. Second one will begin with
|
|
63
|
+
direct event data only. If there is no event record for certain ESA step,
|
|
64
|
+
then as mentioned above, first packet will contain metaevent in DE_TOF
|
|
65
|
+
information and second packet will contain 0-bits in DE_TOF. In general,
|
|
66
|
+
every two packets will look like this.
|
|
67
|
+
|
|
68
|
+
| first packet = [
|
|
69
|
+
| (start_bitmask_data, ESA step, int millisecond of MET, int MET),
|
|
70
|
+
| (start_bitmask_data, tof_1, tof_2, tof_3, de_tag),
|
|
71
|
+
| .....
|
|
72
|
+
| ]
|
|
73
|
+
| second packet = [
|
|
74
|
+
| (start_bitmask_data, tof_1, tof_2, tof_3, de_tag),
|
|
75
|
+
| .....
|
|
76
|
+
| ]
|
|
77
|
+
|
|
78
|
+
In direct event data, if no hit is registered, the tof_x field in
|
|
79
|
+
the DE to a value of negative one. However, since the field is described as a
|
|
80
|
+
"10-bit unsigned counter," it cannot actually store negative numbers.
|
|
81
|
+
Instead, the value negative is represented by the maximum value that can
|
|
82
|
+
be stored in a 10-bit unsigned integer, which is 0x3FF (in hexadecimal)
|
|
83
|
+
or 1023 in decimal. This value is used as a special marker to
|
|
84
|
+
indicate that no hit was registered. Ideally, the system should
|
|
85
|
+
not be able to register a hit with a value of 1023 for all
|
|
86
|
+
tof_1, tof_2, tof_3, because this is in case of an error. But,
|
|
87
|
+
IMAP-Hi like to process it still to investigate the data.
|
|
88
|
+
Example of what it will look like if no hit was registered.
|
|
89
|
+
|
|
90
|
+
| (start_bitmask_data, 1023, 1023, 1023, de_tag)
|
|
91
|
+
| start_bitmask_data will be 1 or 2 or 3.
|
|
92
|
+
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
event_data : str
|
|
96
|
+
48-bits Event data.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
dict
|
|
101
|
+
Parsed event data.
|
|
102
|
+
"""
|
|
103
|
+
event_type = int(event_data[:2], 2)
|
|
104
|
+
metaevent = 0
|
|
105
|
+
if event_type == metaevent:
|
|
106
|
+
# parse metaevent
|
|
107
|
+
esa_step = event_data[2:6]
|
|
108
|
+
subseconds = event_data[6:16]
|
|
109
|
+
seconds = event_data[16:]
|
|
110
|
+
|
|
111
|
+
# return parsed metaevent data
|
|
112
|
+
return {
|
|
113
|
+
"start_bitmask_data": event_type,
|
|
114
|
+
"esa_step": int(esa_step, 2),
|
|
115
|
+
"subseconds": int(subseconds, 2),
|
|
116
|
+
"seconds": int(seconds, 2),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# parse direct event
|
|
120
|
+
trigger_id = event_data[:2]
|
|
121
|
+
tof_1 = event_data[2:12]
|
|
122
|
+
tof_2 = event_data[12:22]
|
|
123
|
+
tof_3 = event_data[22:32]
|
|
124
|
+
de_tag = event_data[32:]
|
|
125
|
+
|
|
126
|
+
# return parsed direct event data
|
|
127
|
+
return {
|
|
128
|
+
"start_bitmask_data": int(trigger_id, 2),
|
|
129
|
+
"tof_1": int(tof_1, 2),
|
|
130
|
+
"tof_2": int(tof_2, 2),
|
|
131
|
+
"tof_3": int(tof_3, 2),
|
|
132
|
+
"de_tag": int(de_tag, 2),
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def break_into_bits_size(binary_data: str) -> list:
|
|
137
|
+
"""
|
|
138
|
+
Break binary stream data into 48-bits.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
binary_data : str
|
|
143
|
+
Binary data.
|
|
144
|
+
|
|
145
|
+
Returns
|
|
146
|
+
-------
|
|
147
|
+
list
|
|
148
|
+
List of 48-bits.
|
|
149
|
+
"""
|
|
150
|
+
# TODO: ask Paul what to do if the length of
|
|
151
|
+
# binary_data is not a multiple of 48
|
|
152
|
+
field_bit_length = 48
|
|
153
|
+
return [
|
|
154
|
+
binary_data[i : i + field_bit_length]
|
|
155
|
+
for i in range(0, len(binary_data), field_bit_length)
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def create_dataset(de_data_list: list, packet_met_time: list) -> xr.Dataset:
|
|
160
|
+
"""
|
|
161
|
+
Create xarray dataset.
|
|
162
|
+
|
|
163
|
+
Parameters
|
|
164
|
+
----------
|
|
165
|
+
de_data_list : list
|
|
166
|
+
Parsed direct event data list.
|
|
167
|
+
packet_met_time : list
|
|
168
|
+
List of packet MET time.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
dataset : xarray.Dataset
|
|
173
|
+
Xarray dataset.
|
|
174
|
+
"""
|
|
175
|
+
# These are the variables that we will store in the dataset
|
|
176
|
+
data_dict: dict = {
|
|
177
|
+
"epoch": list(),
|
|
178
|
+
"event_met": list(),
|
|
179
|
+
"ccsds_met": list(),
|
|
180
|
+
"meta_event_met": list(),
|
|
181
|
+
"esa_stepping_num": list(),
|
|
182
|
+
"trigger_id": list(),
|
|
183
|
+
"tof_1": list(),
|
|
184
|
+
"tof_2": list(),
|
|
185
|
+
"tof_3": list(),
|
|
186
|
+
"de_tag": list(),
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
# How to handle if first event is not metaevent? This
|
|
190
|
+
# means that current data file started with direct event.
|
|
191
|
+
# Per Paul, log a warning and discard all direct events
|
|
192
|
+
# until we see next metaevent because it could mean
|
|
193
|
+
# that the instrument was turned off during repoint.
|
|
194
|
+
|
|
195
|
+
# Find the index of the first occurrence of the metaevent
|
|
196
|
+
first_metaevent_index = next(
|
|
197
|
+
(i for i, d in enumerate(de_data_list) if d.get("start_bitmask_data") == 0),
|
|
198
|
+
None,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
if first_metaevent_index is None:
|
|
202
|
+
return None
|
|
203
|
+
elif first_metaevent_index != 0:
|
|
204
|
+
# Discard all direct events until we see next metaevent
|
|
205
|
+
# TODO: log a warning
|
|
206
|
+
de_data_list = de_data_list[first_metaevent_index:]
|
|
207
|
+
packet_met_time = packet_met_time[first_metaevent_index:]
|
|
208
|
+
|
|
209
|
+
for index, event in enumerate(de_data_list):
|
|
210
|
+
if event["start_bitmask_data"] == 0:
|
|
211
|
+
# metaevent is a way to store information
|
|
212
|
+
# about bigger portion of time information. Eg.
|
|
213
|
+
# metaevent stores information about, let's say
|
|
214
|
+
# "20240319T09:30:01.000". Then direct event time
|
|
215
|
+
# tag stores information of time ticks since
|
|
216
|
+
# that time. Then we use those two to combine and
|
|
217
|
+
# get exact time information of each event.
|
|
218
|
+
|
|
219
|
+
# set time and esa step values to
|
|
220
|
+
# be used for direct event followed by
|
|
221
|
+
# this metaevent
|
|
222
|
+
int_subseconds = event["subseconds"]
|
|
223
|
+
int_seconds = event["seconds"]
|
|
224
|
+
current_esa_step = event["esa_step"]
|
|
225
|
+
|
|
226
|
+
metaevent_time_in_ns = (
|
|
227
|
+
int_seconds * SECOND_TO_NS + int_subseconds * MILLISECOND_TO_NS
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
# Add half a tick once per algorithm document(
|
|
231
|
+
# section 2.2.5 and second last bullet point)
|
|
232
|
+
# and Paul Janzen.
|
|
233
|
+
half_tick = LOOKED_UP_DURATION_OF_TICK / 2
|
|
234
|
+
# convert microseconds to nanosecond to
|
|
235
|
+
# match other time format
|
|
236
|
+
half_tick_ns = half_tick * MICROSECOND_TO_NS
|
|
237
|
+
metaevent_time_in_ns += half_tick_ns
|
|
238
|
+
continue
|
|
239
|
+
|
|
240
|
+
data_dict["meta_event_met"].append(metaevent_time_in_ns)
|
|
241
|
+
# calculate direct event time using time information from metaevent
|
|
242
|
+
# and de_tag. epoch in this dataset uses this time of the event
|
|
243
|
+
de_met_in_ns = (
|
|
244
|
+
metaevent_time_in_ns
|
|
245
|
+
+ event["de_tag"] * LOOKED_UP_DURATION_OF_TICK * MICROSECOND_TO_NS
|
|
246
|
+
)
|
|
247
|
+
data_dict["event_met"].append(de_met_in_ns)
|
|
248
|
+
data_dict["epoch"].append(met_to_j2000ns(de_met_in_ns / 1e9))
|
|
249
|
+
data_dict["esa_stepping_num"].append(current_esa_step)
|
|
250
|
+
# start_bitmask_data is 1, 2, 3 for detector A, B, C
|
|
251
|
+
# respectively. This is used to identify which detector
|
|
252
|
+
# was hit first for this current direct event.
|
|
253
|
+
data_dict["trigger_id"].append(event["start_bitmask_data"])
|
|
254
|
+
data_dict["tof_1"].append(event["tof_1"])
|
|
255
|
+
data_dict["tof_2"].append(event["tof_2"])
|
|
256
|
+
data_dict["tof_3"].append(event["tof_3"])
|
|
257
|
+
# IMAP-Hi like to keep de_tag value for diagnostic purposes
|
|
258
|
+
data_dict["de_tag"].append(event["de_tag"])
|
|
259
|
+
# add packet time to ccsds_met list
|
|
260
|
+
data_dict["ccsds_met"].append(packet_met_time[index])
|
|
261
|
+
|
|
262
|
+
# Load the CDF attributes
|
|
263
|
+
attr_mgr = ImapCdfAttributes()
|
|
264
|
+
attr_mgr.add_instrument_global_attrs("hi")
|
|
265
|
+
attr_mgr.load_variable_attributes("imap_hi_variable_attrs.yaml")
|
|
266
|
+
# uncomment this once Maxine's PR is merged
|
|
267
|
+
# attr_mgr.add_global_attribute("Data_version", data_version)
|
|
268
|
+
|
|
269
|
+
epoch_attrs = attr_mgr.get_variable_attributes("epoch")
|
|
270
|
+
epoch_attrs["CATDESC"] = (
|
|
271
|
+
"Direct Event time, number of nanoseconds since J2000 with leap "
|
|
272
|
+
"seconds included"
|
|
273
|
+
)
|
|
274
|
+
epoch_time = xr.DataArray(
|
|
275
|
+
data_dict.pop("epoch"),
|
|
276
|
+
name="epoch",
|
|
277
|
+
dims=["epoch"],
|
|
278
|
+
attrs=epoch_attrs,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
de_global_attrs = attr_mgr.get_global_attributes("imap_hi_l1a_de_attrs")
|
|
282
|
+
dataset = xr.Dataset(
|
|
283
|
+
coords={"epoch": epoch_time},
|
|
284
|
+
attrs=de_global_attrs,
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
for var_name, data in data_dict.items():
|
|
288
|
+
attrs = attr_mgr.get_variable_attributes(
|
|
289
|
+
f"hi_de_{var_name}", check_schema=False
|
|
290
|
+
).copy()
|
|
291
|
+
dtype = attrs.pop("dtype")
|
|
292
|
+
dataset[var_name] = xr.DataArray(
|
|
293
|
+
np.array(data, dtype=np.dtype(dtype)),
|
|
294
|
+
dims="epoch",
|
|
295
|
+
attrs=attrs,
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
# TODO: figure out how to store information about
|
|
299
|
+
# input data(one or more) it used to produce this dataset
|
|
300
|
+
return dataset
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def science_direct_event(packets_data: xr.Dataset) -> xr.Dataset:
|
|
304
|
+
"""
|
|
305
|
+
Unpack IMAP-Hi direct event data.
|
|
306
|
+
|
|
307
|
+
Processing step:
|
|
308
|
+
|
|
309
|
+
| 1. Break binary stream data into unit of 48-bits
|
|
310
|
+
| 2. Parse direct event data
|
|
311
|
+
| 5. Save the data into xarray dataset.
|
|
312
|
+
|
|
313
|
+
Parameters
|
|
314
|
+
----------
|
|
315
|
+
packets_data : xarray.Dataset
|
|
316
|
+
Packets extracted into a dataset.
|
|
317
|
+
|
|
318
|
+
Returns
|
|
319
|
+
-------
|
|
320
|
+
dataset : xarray.Dataset
|
|
321
|
+
Xarray dataset.
|
|
322
|
+
"""
|
|
323
|
+
de_data_list = []
|
|
324
|
+
packet_met_time = []
|
|
325
|
+
|
|
326
|
+
# Because DE_TOF is a variable length data,
|
|
327
|
+
# I am using extend to add another list to the
|
|
328
|
+
# end of the list. This way, I don't need to flatten
|
|
329
|
+
# the list later.
|
|
330
|
+
for i, data in enumerate(packets_data["de_tof"].data):
|
|
331
|
+
# break binary stream data into unit of 48-bits
|
|
332
|
+
event_48bits_list = break_into_bits_size(data)
|
|
333
|
+
# parse 48-bits into meaningful data such as metaevent or direct event
|
|
334
|
+
de_data_list.extend([parse_direct_event(event) for event in event_48bits_list])
|
|
335
|
+
# add packet time to packet_met_time
|
|
336
|
+
packet_met_time.extend(
|
|
337
|
+
[packets_data["ccsds_met"].data[i]] * len(event_48bits_list)
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
# create dataset
|
|
341
|
+
return create_dataset(de_data_list, packet_met_time)
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Exported from the following files: TLM_H45_20240513.xlsx, TLM_H90_20240513.xlsx
|
|
2
|
+
packetName,mnemonic,convertAs,segNumber,lowValue,highValue,c0,c1,c2,c3,c4,c5,c6,c7,unit
|
|
3
|
+
H45_BOOT_HK,MDM25P_14_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
4
|
+
H45_BOOT_HK,MDM25P_15_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
5
|
+
H45_BOOT_HK,MDM25P_16_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
6
|
+
H45_BOOT_HK,LVPS_12V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
7
|
+
H45_BOOT_HK,LVPS_5V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
8
|
+
H45_BOOT_HK,LVPS_3P3V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
9
|
+
H45_BOOT_HK,LVPS_3P3V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
10
|
+
H45_BOOT_HK,LVPS_5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
11
|
+
H45_BOOT_HK,LVPS_N5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
12
|
+
H45_BOOT_HK,LVPS_12V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
13
|
+
H45_BOOT_HK,LVPS_N12V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
14
|
+
H45_BOOT_HK,LVPS_3P3V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
15
|
+
H45_BOOT_HK,LVPS_5V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
16
|
+
H45_BOOT_HK,LVPS_N5V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
17
|
+
H45_BOOT_HK,LVPS_12V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
18
|
+
H45_BOOT_HK,LVPS_N12V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
19
|
+
H45_BOOT_HK,CDH_1P5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
20
|
+
H45_BOOT_HK,CDH_1P8V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
21
|
+
H45_BOOT_HK,CDH_3P3V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
22
|
+
H45_BOOT_HK,CDH_12V,UNSEGMENTED_POLY,1,0,0,0,0.005897117,0,0,0,0,0,0,DN
|
|
23
|
+
H45_BOOT_HK,CDH_N12V,UNSEGMENTED_POLY,1,0,0,0,-0.005840685,0,0,0,0,0,0,DN
|
|
24
|
+
H45_BOOT_HK,CDH_5V,UNSEGMENTED_POLY,1,0,0,0,0.002412457,0,0,0,0,0,0,DN
|
|
25
|
+
H45_BOOT_HK,CDH_5V_ADC,UNSEGMENTED_POLY,1,0,0,0,0.002412457,0,0,0,0,0,0,DN
|
|
26
|
+
H45_BOOT_HK,CDH_PROCESSOR_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
27
|
+
H45_BOOT_HK,CDH_1P8V_LDO_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
28
|
+
H45_BOOT_HK,CDH_1P5V_LDO_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
29
|
+
H45_BOOT_HK,CDH_SDRAM_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
30
|
+
H45_DIAG_RTS,SHCOARSE,UNSEGMENTED_POLY,1,0,0,0,1,0,0,0,0,0,0,SEC
|
|
31
|
+
H45_APP_NHK,HV1_BULK1_MON,UNSEGMENTED_POLY,1,0,0,0,2.564102564,0,0,0,0,0,0,V
|
|
32
|
+
H45_APP_NHK,INNER_ESA_HI,UNSEGMENTED_POLY,1,0,0,0,-2.884615385,0,0,0,0,0,0,V
|
|
33
|
+
H45_APP_NHK,INNER_ESA_LO,UNSEGMENTED_POLY,1,0,0,0,-0.288461538,0,0,0,0,0,0,V
|
|
34
|
+
H45_APP_NHK,CEM_BK_A,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
35
|
+
H45_APP_NHK,HV2_12V_RTN_MON,UNSEGMENTED_POLY,1,0,0,0,0.952380952,0,0,0,0,0,0,V
|
|
36
|
+
H45_APP_NHK,HV2_BULK2_MON,UNSEGMENTED_POLY,1,0,0,0,-3.205128205,0,0,0,0,0,0,V
|
|
37
|
+
H45_APP_NHK,OUTER_ESA,UNSEGMENTED_POLY,1,0,0,0,1.602564103,0,0,0,0,0,0,V
|
|
38
|
+
H45_APP_NHK,MCP_B,UNSEGMENTED_POLY,1,0,0,0,-0.641025641,0,0,0,0,0,0,V
|
|
39
|
+
H45_APP_NHK,MCP_F,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
40
|
+
H45_APP_NHK,TOF,UNSEGMENTED_POLY,1,0,0,0,-2.564102564,0,0,0,0,0,0,V
|
|
41
|
+
H45_APP_NHK,CEM_BK_B,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
42
|
+
H45_APP_NHK,POS_DEFL,UNSEGMENTED_POLY,1,0,0,0,2.243589744,0,0,0,0,0,0,V
|
|
43
|
+
H45_APP_NHK,NEG_DEFL,UNSEGMENTED_POLY,1,0,0,0,-2.243589744,0,0,0,0,0,0,V
|
|
44
|
+
H45_APP_NHK,CEM_F,UNSEGMENTED_POLY,1,0,0,0,-1.602564103,0,0,0,0,0,0,V
|
|
45
|
+
H45_APP_NHK,HV2_TEMP_IN,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
46
|
+
H45_APP_NHK,HV2_TEMP_REF,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
47
|
+
H45_APP_NHK,CEM_A_IMON,UNSEGMENTED_POLY,1,0,0,0,1.60236E-08,0,0,0,0,0,0,A
|
|
48
|
+
H45_APP_NHK,CEM_B_IMON,UNSEGMENTED_POLY,1,0,0,0,1.60236E-08,0,0,0,0,0,0,A
|
|
49
|
+
H45_APP_NHK,MCP_IMON,UNSEGMENTED_POLY,1,0,0,0,3.84567E-08,0,0,0,0,0,0,A
|
|
50
|
+
H45_APP_NHK,CDH_TEMP_MON1,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
51
|
+
H45_APP_NHK,CDH_TEMP_MON2,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
52
|
+
H45_APP_NHK,CDH_TEMP_MON3,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
53
|
+
H45_APP_NHK,CDH_TEMP_MON4,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
54
|
+
H45_APP_NHK,LO_TEMP_MON,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
55
|
+
H45_APP_NHK,HVPS_TEMP_MON,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
56
|
+
H45_APP_NHK,LVPS_TEMP1,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
57
|
+
H45_APP_NHK,LVPS_TEMP2,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
58
|
+
H45_APP_NHK,LVPS_TEMP3,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
59
|
+
H45_APP_NHK,FEE_TEMP1,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
60
|
+
H45_APP_NHK,SNS_TEMP2,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
61
|
+
H45_APP_NHK,SNS_TEMP3,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
62
|
+
H45_APP_NHK,LVPS_3_3V_VMON,UNSEGMENTED_POLY,1,0,0,0,0.001611,0,0,0,0,0,0,V
|
|
63
|
+
H45_APP_NHK,LVPS_5V_P_VMON,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
64
|
+
H45_APP_NHK,LVPS_5V_N_VMON,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
65
|
+
H45_APP_NHK,LVPS_12V_P_VMON,UNSEGMENTED_POLY,1,0,0,0,0.005859,0,0,0,0,0,0,V
|
|
66
|
+
H45_APP_NHK,LVPS_12V_N_VMON,UNSEGMENTED_POLY,1,0,0,0,0.005859,0,0,0,0,0,0,V
|
|
67
|
+
H45_APP_NHK,LVPS_3_3V_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000916,0,0,0,0,0,0,A
|
|
68
|
+
H45_APP_NHK,LVPS_5V_P_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000461,0,0,0,0,0,0,A
|
|
69
|
+
H45_APP_NHK,LVPS_5V_N_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000461,0,0,0,0,0,0,A
|
|
70
|
+
H45_APP_NHK,LVPS_12V_P_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000704,0,0,0,0,0,0,A
|
|
71
|
+
H45_APP_NHK,LVPS_12V_N_IMON,UNSEGMENTED_POLY,1,0,0,0,-0.000704,0,0,0,0,0,0,A
|
|
72
|
+
H45_APP_NHK,CDH_P1_5V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
73
|
+
H45_APP_NHK,CDH_P1_8V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
74
|
+
H45_APP_NHK,CDH_P3_3V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
75
|
+
H45_APP_NHK,CDH_P12V,UNSEGMENTED_POLY,1,0,0,0,0.005897,0,0,0,0,0,0,V
|
|
76
|
+
H45_APP_NHK,CDH_N12V,UNSEGMENTED_POLY,1,0,0,0,0.005841,0,0,0,0,0,0,V
|
|
77
|
+
H45_APP_NHK,CDH_P5V,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
78
|
+
H45_APP_NHK,CDH_ANA_REF,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
79
|
+
H90_BOOT_HK,MDM25P_14_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
80
|
+
H90_BOOT_HK,MDM25P_15_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
81
|
+
H90_BOOT_HK,MDM25P_16_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
82
|
+
H90_BOOT_HK,LVPS_12V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
83
|
+
H90_BOOT_HK,LVPS_5V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
84
|
+
H90_BOOT_HK,LVPS_3P3V_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.144461908,0,0,0,0,0,0,DN
|
|
85
|
+
H90_BOOT_HK,LVPS_3P3V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
86
|
+
H90_BOOT_HK,LVPS_5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
87
|
+
H90_BOOT_HK,LVPS_N5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
88
|
+
H90_BOOT_HK,LVPS_12V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
89
|
+
H90_BOOT_HK,LVPS_N12V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
90
|
+
H90_BOOT_HK,LVPS_3P3V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
91
|
+
H90_BOOT_HK,LVPS_5V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
92
|
+
H90_BOOT_HK,LVPS_N5V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
93
|
+
H90_BOOT_HK,LVPS_12V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
94
|
+
H90_BOOT_HK,LVPS_N12V_I,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
95
|
+
H90_BOOT_HK,CDH_1P5V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
96
|
+
H90_BOOT_HK,CDH_1P8V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
97
|
+
H90_BOOT_HK,CDH_3P3V,UNSEGMENTED_POLY,1,0,0,0,0.001220703,0,0,0,0,0,0,DN
|
|
98
|
+
H90_BOOT_HK,CDH_12V,UNSEGMENTED_POLY,1,0,0,0,0.005897117,0,0,0,0,0,0,DN
|
|
99
|
+
H90_BOOT_HK,CDH_N12V,UNSEGMENTED_POLY,1,0,0,0,-0.005840685,0,0,0,0,0,0,DN
|
|
100
|
+
H90_BOOT_HK,CDH_5V,UNSEGMENTED_POLY,1,0,0,0,0.002412457,0,0,0,0,0,0,DN
|
|
101
|
+
H90_BOOT_HK,CDH_5V_ADC,UNSEGMENTED_POLY,1,0,0,0,0.002412457,0,0,0,0,0,0,DN
|
|
102
|
+
H90_BOOT_HK,CDH_PROCESSOR_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
103
|
+
H90_BOOT_HK,CDH_1P8V_LDO_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
104
|
+
H90_BOOT_HK,CDH_1P5V_LDO_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
105
|
+
H90_BOOT_HK,CDH_SDRAM_T,UNSEGMENTED_POLY,1,0,0,-273.2,0.122070313,0,0,0,0,0,0,DN
|
|
106
|
+
H90_DIAG_RTS,SHCOARSE,UNSEGMENTED_POLY,1,0,0,0,1,0,0,0,0,0,0,SEC
|
|
107
|
+
H90_APP_NHK,HV1_BULK1_MON,UNSEGMENTED_POLY,1,0,0,0,2.564102564,0,0,0,0,0,0,V
|
|
108
|
+
H90_APP_NHK,INNER_ESA_HI,UNSEGMENTED_POLY,1,0,0,0,-2.884615385,0,0,0,0,0,0,V
|
|
109
|
+
H90_APP_NHK,INNER_ESA_LO,UNSEGMENTED_POLY,1,0,0,0,-0.288461538,0,0,0,0,0,0,V
|
|
110
|
+
H90_APP_NHK,CEM_BK_A,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
111
|
+
H90_APP_NHK,HV2_12V_RTN_MON,UNSEGMENTED_POLY,1,0,0,0,0.952380952,0,0,0,0,0,0,V
|
|
112
|
+
H90_APP_NHK,HV2_BULK2_MON,UNSEGMENTED_POLY,1,0,0,0,-3.205128205,0,0,0,0,0,0,V
|
|
113
|
+
H90_APP_NHK,OUTER_ESA,UNSEGMENTED_POLY,1,0,0,0,1.602564103,0,0,0,0,0,0,V
|
|
114
|
+
H90_APP_NHK,MCP_B,UNSEGMENTED_POLY,1,0,0,0,-0.641025641,0,0,0,0,0,0,V
|
|
115
|
+
H90_APP_NHK,MCP_F,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
116
|
+
H90_APP_NHK,TOF,UNSEGMENTED_POLY,1,0,0,0,-2.564102564,0,0,0,0,0,0,V
|
|
117
|
+
H90_APP_NHK,CEM_BK_B,UNSEGMENTED_POLY,1,0,0,0,-1.282051282,0,0,0,0,0,0,V
|
|
118
|
+
H90_APP_NHK,POS_DEFL,UNSEGMENTED_POLY,1,0,0,0,2.243589744,0,0,0,0,0,0,V
|
|
119
|
+
H90_APP_NHK,NEG_DEFL,UNSEGMENTED_POLY,1,0,0,0,-2.243589744,0,0,0,0,0,0,V
|
|
120
|
+
H90_APP_NHK,CEM_F,UNSEGMENTED_POLY,1,0,0,0,-1.602564103,0,0,0,0,0,0,V
|
|
121
|
+
H90_APP_NHK,HV2_TEMP_IN,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
122
|
+
H90_APP_NHK,HV2_TEMP_REF,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
123
|
+
H90_APP_NHK,CEM_A_IMON,UNSEGMENTED_POLY,1,0,0,0,1.60236E-08,0,0,0,0,0,0,A
|
|
124
|
+
H90_APP_NHK,CEM_B_IMON,UNSEGMENTED_POLY,1,0,0,0,1.60236E-08,0,0,0,0,0,0,A
|
|
125
|
+
H90_APP_NHK,MCP_IMON,UNSEGMENTED_POLY,1,0,0,0,3.84567E-08,0,0,0,0,0,0,A
|
|
126
|
+
H90_APP_NHK,CDH_TEMP_MON1,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
127
|
+
H90_APP_NHK,CDH_TEMP_MON2,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
128
|
+
H90_APP_NHK,CDH_TEMP_MON3,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
129
|
+
H90_APP_NHK,CDH_TEMP_MON4,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
130
|
+
H90_APP_NHK,LO_TEMP_MON,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
131
|
+
H90_APP_NHK,HVPS_TEMP_MON,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
132
|
+
H90_APP_NHK,LVPS_TEMP1,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
133
|
+
H90_APP_NHK,LVPS_TEMP2,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
134
|
+
H90_APP_NHK,LVPS_TEMP3,UNSEGMENTED_POLY,1,0,0,-274.41,0.1448,0,0,0,0,0,0,C
|
|
135
|
+
H90_APP_NHK,FEE_TEMP1,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
136
|
+
H90_APP_NHK,SNS_TEMP2,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
137
|
+
H90_APP_NHK,SNS_TEMP3,UNSEGMENTED_POLY,1,0,0,-58.397,0.10143,-0.000026929,2.8828E-09,0,0,0,0,C
|
|
138
|
+
H90_APP_NHK,LVPS_3_3V_VMON,UNSEGMENTED_POLY,1,0,0,0,0.001611,0,0,0,0,0,0,V
|
|
139
|
+
H90_APP_NHK,LVPS_5V_P_VMON,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
140
|
+
H90_APP_NHK,LVPS_5V_N_VMON,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
141
|
+
H90_APP_NHK,LVPS_12V_P_VMON,UNSEGMENTED_POLY,1,0,0,0,0.005859,0,0,0,0,0,0,V
|
|
142
|
+
H90_APP_NHK,LVPS_12V_N_VMON,UNSEGMENTED_POLY,1,0,0,0,0.005859,0,0,0,0,0,0,V
|
|
143
|
+
H90_APP_NHK,LVPS_3_3V_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000916,0,0,0,0,0,0,A
|
|
144
|
+
H90_APP_NHK,LVPS_5V_P_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000461,0,0,0,0,0,0,A
|
|
145
|
+
H90_APP_NHK,LVPS_5V_N_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000461,0,0,0,0,0,0,A
|
|
146
|
+
H90_APP_NHK,LVPS_12V_P_IMON,UNSEGMENTED_POLY,1,0,0,0,0.000704,0,0,0,0,0,0,A
|
|
147
|
+
H90_APP_NHK,LVPS_12V_N_IMON,UNSEGMENTED_POLY,1,0,0,0,-0.000704,0,0,0,0,0,0,A
|
|
148
|
+
H90_APP_NHK,CDH_P1_5V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
149
|
+
H90_APP_NHK,CDH_P1_8V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
150
|
+
H90_APP_NHK,CDH_P3_3V,UNSEGMENTED_POLY,1,0,0,0,0.001221,0,0,0,0,0,0,V
|
|
151
|
+
H90_APP_NHK,CDH_P12V,UNSEGMENTED_POLY,1,0,0,0,0.005897,0,0,0,0,0,0,V
|
|
152
|
+
H90_APP_NHK,CDH_N12V,UNSEGMENTED_POLY,1,0,0,0,0.005841,0,0,0,0,0,0,V
|
|
153
|
+
H90_APP_NHK,CDH_P5V,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
154
|
+
H90_APP_NHK,CDH_ANA_REF,UNSEGMENTED_POLY,1,0,0,0,0.002441,0,0,0,0,0,0,V
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""IMAP-HI L1B processing module."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import xarray as xr
|
|
7
|
+
|
|
8
|
+
from imap_processing import imap_module_directory
|
|
9
|
+
from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
|
|
10
|
+
from imap_processing.hi.utils import HIAPID
|
|
11
|
+
from imap_processing.utils import convert_raw_to_eu
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
ATTR_MGR = ImapCdfAttributes()
|
|
15
|
+
ATTR_MGR.add_instrument_global_attrs("hi")
|
|
16
|
+
ATTR_MGR.load_variable_attributes("imap_hi_variable_attrs.yaml")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def hi_l1b(l1a_dataset: xr.Dataset, data_version: str) -> xr.Dataset:
|
|
20
|
+
"""
|
|
21
|
+
High level IMAP-HI L1B processing function.
|
|
22
|
+
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
l1a_dataset : xarray.Dataset
|
|
26
|
+
L1A dataset to process.
|
|
27
|
+
data_version : str
|
|
28
|
+
Version of the data product being created.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
l1b_dataset : xarray.Dataset
|
|
33
|
+
Processed xarray dataset.
|
|
34
|
+
"""
|
|
35
|
+
logger.info(
|
|
36
|
+
f"Running Hi L1B processing on dataset: {l1a_dataset.attrs['Logical_source']}"
|
|
37
|
+
)
|
|
38
|
+
logical_source_parts = l1a_dataset.attrs["Logical_source"].split("_")
|
|
39
|
+
# TODO: apid is not currently stored in all L1A data but should be.
|
|
40
|
+
# Use apid to determine what L1B processing function to call
|
|
41
|
+
|
|
42
|
+
# Housekeeping processing
|
|
43
|
+
if logical_source_parts[-1].endswith("hk"):
|
|
44
|
+
# if packet_enum in (HIAPID.H45_APP_NHK, HIAPID.H90_APP_NHK):
|
|
45
|
+
packet_enum = HIAPID(l1a_dataset["pkt_apid"].data[0])
|
|
46
|
+
conversion_table_path = str(
|
|
47
|
+
imap_module_directory / "hi" / "l1b" / "hi_eng_unit_convert_table.csv"
|
|
48
|
+
)
|
|
49
|
+
l1b_dataset = convert_raw_to_eu(
|
|
50
|
+
l1a_dataset,
|
|
51
|
+
conversion_table_path=conversion_table_path,
|
|
52
|
+
packet_name=packet_enum.name,
|
|
53
|
+
comment="#", # type: ignore[arg-type]
|
|
54
|
+
# Todo error, Argument "comment" to "convert_raw_to_eu" has incompatible
|
|
55
|
+
# type "str"; expected "dict[Any, Any]"
|
|
56
|
+
converters={"mnemonic": str.lower},
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
l1b_dataset.attrs.update(ATTR_MGR.get_global_attributes("imap_hi_l1b_hk_attrs"))
|
|
60
|
+
elif logical_source_parts[-1].endswith("de"):
|
|
61
|
+
l1b_dataset = annotate_direct_events(l1a_dataset)
|
|
62
|
+
else:
|
|
63
|
+
raise NotImplementedError(
|
|
64
|
+
f"No Hi L1B processing defined for file type: "
|
|
65
|
+
f"{l1a_dataset.attrs['Logical_source']}"
|
|
66
|
+
)
|
|
67
|
+
# Update global attributes
|
|
68
|
+
# TODO: write a function that extracts the sensor from Logical_source
|
|
69
|
+
# some functionality can be found in imap_data_access.file_validation but
|
|
70
|
+
# only works on full file names
|
|
71
|
+
sensor_str = logical_source_parts[-1].split("-")[0]
|
|
72
|
+
l1b_dataset.attrs["Logical_source"] = l1b_dataset.attrs["Logical_source"].format(
|
|
73
|
+
sensor=sensor_str
|
|
74
|
+
)
|
|
75
|
+
# TODO: revisit this
|
|
76
|
+
l1b_dataset.attrs["Data_version"] = data_version
|
|
77
|
+
return l1b_dataset
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def annotate_direct_events(l1a_dataset: xr.Dataset) -> xr.Dataset:
|
|
81
|
+
"""
|
|
82
|
+
Perform Hi L1B processing on direct event data.
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
l1a_dataset : xarray.Dataset
|
|
87
|
+
L1A direct event data.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
l1b_dataset : xarray.Dataset
|
|
92
|
+
L1B direct event data.
|
|
93
|
+
"""
|
|
94
|
+
n_epoch = l1a_dataset["epoch"].size
|
|
95
|
+
new_data_vars = dict()
|
|
96
|
+
for var in [
|
|
97
|
+
"coincidence_type",
|
|
98
|
+
"esa_step",
|
|
99
|
+
"delta_t_ab",
|
|
100
|
+
"delta_t_ac1",
|
|
101
|
+
"delta_t_bc1",
|
|
102
|
+
"delta_t_c1c2",
|
|
103
|
+
"spin_phase",
|
|
104
|
+
"hae_latitude",
|
|
105
|
+
"hae_longitude",
|
|
106
|
+
"quality_flag",
|
|
107
|
+
"nominal_bin",
|
|
108
|
+
]:
|
|
109
|
+
attrs = ATTR_MGR.get_variable_attributes(
|
|
110
|
+
f"hi_de_{var}", check_schema=False
|
|
111
|
+
).copy()
|
|
112
|
+
dtype = attrs.pop("dtype")
|
|
113
|
+
if attrs["FILLVAL"] == "NaN":
|
|
114
|
+
attrs["FILLVAL"] = np.nan
|
|
115
|
+
new_data_vars[var] = xr.DataArray(
|
|
116
|
+
data=np.full(n_epoch, attrs["FILLVAL"], dtype=np.dtype(dtype)),
|
|
117
|
+
dims=["epoch"],
|
|
118
|
+
attrs=attrs,
|
|
119
|
+
)
|
|
120
|
+
l1b_dataset = l1a_dataset.assign(new_data_vars)
|
|
121
|
+
l1b_dataset = l1b_dataset.drop_vars(
|
|
122
|
+
["tof_1", "tof_2", "tof_3", "de_tag", "ccsds_met", "meta_event_met"]
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
de_global_attrs = ATTR_MGR.get_global_attributes("imap_hi_l1b_de_attrs")
|
|
126
|
+
l1b_dataset.attrs.update(**de_global_attrs)
|
|
127
|
+
return l1b_dataset
|
|
File without changes
|