imap-processing 0.12.0__py3-none-any.whl → 0.13.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 +1 -0
- imap_processing/_version.py +2 -2
- imap_processing/ccsds/ccsds_data.py +1 -2
- imap_processing/ccsds/excel_to_xtce.py +1 -2
- imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +18 -12
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +569 -0
- imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml +1846 -128
- imap_processing/cdf/config/imap_hit_global_cdf_attrs.yaml +5 -5
- imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +20 -1
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +6 -4
- imap_processing/cdf/config/imap_idex_l1b_variable_attrs.yaml +3 -3
- imap_processing/cdf/config/imap_mag_global_cdf_attrs.yaml +15 -0
- imap_processing/cdf/config/imap_swapi_variable_attrs.yaml +22 -0
- imap_processing/cdf/config/imap_swe_l1b_variable_attrs.yaml +16 -0
- imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml +178 -5
- imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +5045 -41
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +33 -19
- imap_processing/cdf/config/imap_ultra_l1c_variable_attrs.yaml +8 -48
- imap_processing/cdf/utils.py +41 -33
- imap_processing/cli.py +463 -234
- imap_processing/codice/codice_l1a.py +260 -47
- imap_processing/codice/codice_l1b.py +51 -152
- imap_processing/codice/constants.py +38 -1
- imap_processing/ena_maps/ena_maps.py +658 -65
- imap_processing/ena_maps/utils/coordinates.py +1 -1
- imap_processing/ena_maps/utils/spatial_utils.py +10 -5
- imap_processing/glows/l1a/glows_l1a.py +28 -99
- imap_processing/glows/l1a/glows_l1a_data.py +2 -2
- imap_processing/glows/l1b/glows_l1b.py +1 -4
- imap_processing/glows/l1b/glows_l1b_data.py +1 -3
- imap_processing/glows/l2/glows_l2.py +2 -5
- imap_processing/hi/l1a/hi_l1a.py +31 -12
- imap_processing/hi/l1b/hi_l1b.py +80 -43
- imap_processing/hi/l1c/hi_l1c.py +12 -16
- imap_processing/hit/ancillary/imap_hit_l1b-to-l2-sector-dt0-factors_20250219_v002.csv +81 -0
- imap_processing/hit/hit_utils.py +93 -35
- imap_processing/hit/l0/decom_hit.py +3 -1
- imap_processing/hit/l1a/hit_l1a.py +30 -25
- imap_processing/hit/l1b/constants.py +6 -2
- imap_processing/hit/l1b/hit_l1b.py +279 -318
- imap_processing/hit/l2/constants.py +37 -0
- imap_processing/hit/l2/hit_l2.py +373 -264
- imap_processing/ialirt/l0/parse_mag.py +138 -10
- imap_processing/ialirt/l0/process_swapi.py +69 -0
- imap_processing/ialirt/l0/process_swe.py +318 -22
- imap_processing/ialirt/packet_definitions/ialirt.xml +216 -212
- imap_processing/ialirt/packet_definitions/ialirt_codicehi.xml +1 -1
- imap_processing/ialirt/packet_definitions/ialirt_codicelo.xml +1 -1
- imap_processing/ialirt/packet_definitions/ialirt_swapi.xml +14 -14
- imap_processing/ialirt/utils/grouping.py +1 -1
- imap_processing/idex/idex_constants.py +9 -1
- imap_processing/idex/idex_l0.py +22 -8
- imap_processing/idex/idex_l1a.py +75 -44
- imap_processing/idex/idex_l1b.py +9 -8
- imap_processing/idex/idex_l2a.py +79 -45
- imap_processing/idex/idex_l2b.py +120 -0
- imap_processing/idex/idex_variable_unpacking_and_eu_conversion.csv +33 -39
- imap_processing/idex/packet_definitions/idex_housekeeping_packet_definition.xml +9130 -0
- imap_processing/lo/l0/lo_science.py +1 -2
- imap_processing/lo/l1a/lo_l1a.py +1 -4
- imap_processing/lo/l1b/lo_l1b.py +527 -6
- imap_processing/lo/l1b/tof_conversions.py +11 -0
- imap_processing/lo/l1c/lo_l1c.py +1 -4
- imap_processing/mag/constants.py +43 -0
- imap_processing/mag/imap_mag_sdc_configuration_v001.py +8 -0
- imap_processing/mag/l1a/mag_l1a.py +2 -9
- imap_processing/mag/l1a/mag_l1a_data.py +10 -10
- imap_processing/mag/l1b/mag_l1b.py +84 -17
- imap_processing/mag/l1c/interpolation_methods.py +180 -3
- imap_processing/mag/l1c/mag_l1c.py +236 -70
- imap_processing/mag/l2/mag_l2.py +140 -0
- imap_processing/mag/l2/mag_l2_data.py +288 -0
- imap_processing/spacecraft/quaternions.py +1 -3
- imap_processing/spice/geometry.py +3 -3
- imap_processing/spice/kernels.py +0 -276
- imap_processing/spice/pointing_frame.py +257 -0
- imap_processing/spice/repoint.py +48 -19
- imap_processing/spice/spin.py +38 -33
- imap_processing/spice/time.py +24 -0
- imap_processing/swapi/l1/swapi_l1.py +16 -12
- imap_processing/swapi/l2/swapi_l2.py +116 -4
- imap_processing/swapi/swapi_utils.py +32 -0
- imap_processing/swe/l1a/swe_l1a.py +2 -9
- imap_processing/swe/l1a/swe_science.py +8 -11
- imap_processing/swe/l1b/swe_l1b.py +898 -23
- imap_processing/swe/l2/swe_l2.py +21 -77
- imap_processing/swe/utils/swe_constants.py +1 -0
- imap_processing/tests/ccsds/test_excel_to_xtce.py +1 -1
- imap_processing/tests/cdf/test_utils.py +14 -16
- imap_processing/tests/codice/conftest.py +44 -33
- 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_lo-pha_20241110193700_v0.0.0.cdf +0 -0
- imap_processing/tests/codice/test_codice_l1a.py +20 -11
- imap_processing/tests/codice/test_codice_l1b.py +6 -7
- imap_processing/tests/conftest.py +78 -22
- imap_processing/tests/ena_maps/test_ena_maps.py +462 -33
- imap_processing/tests/ena_maps/test_spatial_utils.py +1 -1
- imap_processing/tests/glows/conftest.py +10 -14
- imap_processing/tests/glows/test_glows_decom.py +4 -4
- imap_processing/tests/glows/test_glows_l1a_cdf.py +6 -27
- imap_processing/tests/glows/test_glows_l1a_data.py +6 -8
- imap_processing/tests/glows/test_glows_l1b.py +11 -11
- imap_processing/tests/glows/test_glows_l1b_data.py +5 -5
- imap_processing/tests/glows/test_glows_l2.py +2 -8
- imap_processing/tests/hi/conftest.py +1 -1
- imap_processing/tests/hi/test_hi_l1b.py +10 -12
- imap_processing/tests/hi/test_hi_l1c.py +27 -24
- imap_processing/tests/hi/test_l1a.py +7 -9
- imap_processing/tests/hi/test_science_direct_event.py +2 -2
- imap_processing/tests/hit/helpers/l1_validation.py +44 -43
- imap_processing/tests/hit/test_decom_hit.py +1 -1
- imap_processing/tests/hit/test_hit_l1a.py +9 -9
- imap_processing/tests/hit/test_hit_l1b.py +172 -217
- imap_processing/tests/hit/test_hit_l2.py +380 -118
- imap_processing/tests/hit/test_hit_utils.py +122 -55
- imap_processing/tests/hit/validation_data/hit_l1b_standard_sample2_nsrl_v4_3decimals.csv +62 -62
- imap_processing/tests/hit/validation_data/sci_sample_raw.csv +1 -1
- imap_processing/tests/ialirt/unit/test_decom_ialirt.py +16 -81
- imap_processing/tests/ialirt/unit/test_grouping.py +2 -2
- imap_processing/tests/ialirt/unit/test_parse_mag.py +71 -16
- imap_processing/tests/ialirt/unit/test_process_codicehi.py +3 -3
- imap_processing/tests/ialirt/unit/test_process_codicelo.py +3 -10
- imap_processing/tests/ialirt/unit/test_process_ephemeris.py +4 -4
- imap_processing/tests/ialirt/unit/test_process_hit.py +3 -3
- imap_processing/tests/ialirt/unit/test_process_swapi.py +24 -16
- imap_processing/tests/ialirt/unit/test_process_swe.py +115 -7
- imap_processing/tests/idex/conftest.py +72 -7
- imap_processing/tests/idex/test_data/imap_idex_l0_raw_20241206_v001.pkts +0 -0
- imap_processing/tests/idex/test_data/imap_idex_l0_raw_20250108_v001.pkts +0 -0
- imap_processing/tests/idex/test_idex_l0.py +33 -11
- imap_processing/tests/idex/test_idex_l1a.py +50 -23
- imap_processing/tests/idex/test_idex_l1b.py +104 -25
- imap_processing/tests/idex/test_idex_l2a.py +48 -32
- imap_processing/tests/idex/test_idex_l2b.py +93 -0
- imap_processing/tests/lo/test_lo_l1a.py +3 -3
- imap_processing/tests/lo/test_lo_l1b.py +371 -6
- imap_processing/tests/lo/test_lo_l1c.py +1 -1
- imap_processing/tests/lo/test_lo_science.py +6 -7
- imap_processing/tests/lo/test_star_sensor.py +1 -1
- imap_processing/tests/mag/conftest.py +58 -9
- imap_processing/tests/mag/test_mag_decom.py +4 -3
- imap_processing/tests/mag/test_mag_l1a.py +13 -7
- imap_processing/tests/mag/test_mag_l1b.py +9 -9
- imap_processing/tests/mag/test_mag_l1c.py +151 -47
- imap_processing/tests/mag/test_mag_l2.py +130 -0
- imap_processing/tests/mag/test_mag_validation.py +144 -7
- imap_processing/tests/mag/validation/L1c/T013/mag-l1b-l1c-t013-magi-normal-in.csv +1217 -0
- imap_processing/tests/mag/validation/L1c/T013/mag-l1b-l1c-t013-magi-normal-out.csv +1857 -0
- imap_processing/tests/mag/validation/L1c/T013/mag-l1b-l1c-t013-mago-normal-in.csv +1217 -0
- imap_processing/tests/mag/validation/L1c/T013/mag-l1b-l1c-t013-mago-normal-out.csv +1857 -0
- imap_processing/tests/mag/validation/L1c/T014/mag-l1b-l1c-t014-magi-normal-in.csv +1217 -0
- imap_processing/tests/mag/validation/L1c/T014/mag-l1b-l1c-t014-magi-normal-out.csv +1793 -0
- imap_processing/tests/mag/validation/L1c/T014/mag-l1b-l1c-t014-mago-normal-in.csv +1217 -0
- imap_processing/tests/mag/validation/L1c/T014/mag-l1b-l1c-t014-mago-normal-out.csv +1793 -0
- imap_processing/tests/mag/validation/L1c/T015/mag-l1b-l1c-t015-magi-burst-in.csv +2561 -0
- imap_processing/tests/mag/validation/L1c/T015/mag-l1b-l1c-t015-magi-normal-in.csv +961 -0
- imap_processing/tests/mag/validation/L1c/T015/mag-l1b-l1c-t015-magi-normal-out.csv +1539 -0
- imap_processing/tests/mag/validation/L1c/T015/mag-l1b-l1c-t015-mago-normal-in.csv +1921 -0
- imap_processing/tests/mag/validation/L1c/T015/mag-l1b-l1c-t015-mago-normal-out.csv +2499 -0
- imap_processing/tests/mag/validation/L1c/T016/mag-l1b-l1c-t016-magi-normal-in.csv +865 -0
- imap_processing/tests/mag/validation/L1c/T016/mag-l1b-l1c-t016-magi-normal-out.csv +1196 -0
- imap_processing/tests/mag/validation/L1c/T016/mag-l1b-l1c-t016-mago-normal-in.csv +1729 -0
- imap_processing/tests/mag/validation/L1c/T016/mag-l1b-l1c-t016-mago-normal-out.csv +3053 -0
- imap_processing/tests/mag/validation/L2/imap_mag_l1b_norm-mago_20251017_v002.cdf +0 -0
- imap_processing/tests/mag/validation/calibration/imap_mag_l2-calibration-matrices_20251017_v004.cdf +0 -0
- imap_processing/tests/mag/validation/calibration/imap_mag_l2-offsets-norm_20251017_20251017_v001.cdf +0 -0
- imap_processing/tests/spacecraft/test_quaternions.py +1 -1
- imap_processing/tests/spice/test_data/fake_repoint_data.csv +4 -4
- imap_processing/tests/spice/test_data/fake_spin_data.csv +11 -11
- imap_processing/tests/spice/test_geometry.py +3 -3
- imap_processing/tests/spice/test_kernels.py +1 -200
- imap_processing/tests/spice/test_pointing_frame.py +185 -0
- imap_processing/tests/spice/test_repoint.py +20 -10
- imap_processing/tests/spice/test_spin.py +50 -9
- imap_processing/tests/spice/test_time.py +14 -0
- imap_processing/tests/swapi/lut/imap_swapi_esa-unit-conversion_20250211_v000.csv +73 -0
- imap_processing/tests/swapi/lut/imap_swapi_lut-notes_20250211_v000.csv +1025 -0
- imap_processing/tests/swapi/test_swapi_l1.py +7 -9
- imap_processing/tests/swapi/test_swapi_l2.py +180 -8
- imap_processing/tests/swe/lut/checker-board-indices.csv +24 -0
- imap_processing/tests/swe/lut/imap_swe_esa-lut_20250301_v000.csv +385 -0
- imap_processing/tests/swe/lut/imap_swe_l1b-in-flight-cal_20240510_20260716_v000.csv +3 -0
- imap_processing/tests/swe/test_swe_l1a.py +6 -6
- imap_processing/tests/swe/test_swe_l1a_science.py +3 -3
- imap_processing/tests/swe/test_swe_l1b.py +162 -24
- imap_processing/tests/swe/test_swe_l2.py +82 -102
- imap_processing/tests/test_cli.py +171 -88
- imap_processing/tests/test_utils.py +2 -1
- imap_processing/tests/ultra/data/mock_data.py +49 -21
- imap_processing/tests/ultra/unit/conftest.py +53 -70
- imap_processing/tests/ultra/unit/test_badtimes.py +2 -4
- imap_processing/tests/ultra/unit/test_cullingmask.py +4 -6
- imap_processing/tests/ultra/unit/test_de.py +3 -10
- imap_processing/tests/ultra/unit/test_decom_apid_880.py +27 -76
- imap_processing/tests/ultra/unit/test_decom_apid_881.py +15 -16
- imap_processing/tests/ultra/unit/test_decom_apid_883.py +12 -10
- imap_processing/tests/ultra/unit/test_decom_apid_896.py +202 -55
- imap_processing/tests/ultra/unit/test_lookup_utils.py +23 -1
- imap_processing/tests/ultra/unit/test_spacecraft_pset.py +3 -4
- imap_processing/tests/ultra/unit/test_ultra_l1a.py +84 -307
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +30 -12
- imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +2 -2
- imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py +4 -1
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +163 -29
- imap_processing/tests/ultra/unit/test_ultra_l1c.py +5 -5
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +32 -43
- imap_processing/tests/ultra/unit/test_ultra_l2.py +230 -0
- imap_processing/ultra/constants.py +1 -1
- imap_processing/ultra/l0/decom_tools.py +21 -34
- imap_processing/ultra/l0/decom_ultra.py +168 -204
- imap_processing/ultra/l0/ultra_utils.py +152 -136
- imap_processing/ultra/l1a/ultra_l1a.py +55 -243
- imap_processing/ultra/l1b/badtimes.py +1 -4
- imap_processing/ultra/l1b/cullingmask.py +2 -6
- imap_processing/ultra/l1b/de.py +62 -47
- imap_processing/ultra/l1b/extendedspin.py +8 -4
- imap_processing/ultra/l1b/lookup_utils.py +72 -9
- imap_processing/ultra/l1b/ultra_l1b.py +3 -8
- imap_processing/ultra/l1b/ultra_l1b_culling.py +4 -4
- imap_processing/ultra/l1b/ultra_l1b_extended.py +236 -78
- imap_processing/ultra/l1c/histogram.py +2 -6
- imap_processing/ultra/l1c/spacecraft_pset.py +2 -4
- imap_processing/ultra/l1c/ultra_l1c.py +1 -5
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +107 -60
- imap_processing/ultra/l2/ultra_l2.py +299 -0
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM45_LeftSlit.csv +526 -0
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM45_RightSlit.csv +526 -0
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM90_LeftSlit.csv +526 -0
- imap_processing/ultra/lookup_tables/Angular_Profiles_FM90_RightSlit.csv +526 -0
- imap_processing/ultra/lookup_tables/FM45_Startup1_ULTRA_IMGPARAMS_20240719.csv +2 -2
- imap_processing/ultra/lookup_tables/FM90_Startup1_ULTRA_IMGPARAMS_20240719.csv +2 -0
- imap_processing/ultra/packet_definitions/README.md +38 -0
- imap_processing/ultra/packet_definitions/ULTRA_SCI_COMBINED.xml +15302 -482
- imap_processing/ultra/utils/ultra_l1_utils.py +13 -12
- imap_processing/utils.py +1 -1
- {imap_processing-0.12.0.dist-info → imap_processing-0.13.0.dist-info}/METADATA +3 -2
- {imap_processing-0.12.0.dist-info → imap_processing-0.13.0.dist-info}/RECORD +264 -225
- imap_processing/hi/l1b/hi_eng_unit_convert_table.csv +0 -154
- imap_processing/mag/imap_mag_sdc-configuration_v001.yaml +0 -6
- imap_processing/mag/l1b/__init__.py +0 -0
- imap_processing/swe/l1b/swe_esa_lookup_table.csv +0 -1441
- imap_processing/swe/l1b/swe_l1b_science.py +0 -699
- imap_processing/tests/swe/test_swe_l1b_science.py +0 -103
- imap_processing/ultra/lookup_tables/dps_sensitivity45.cdf +0 -0
- imap_processing/ultra/lookup_tables/ultra_90_dps_exposure_compressed.cdf +0 -0
- /imap_processing/idex/packet_definitions/{idex_packet_definition.xml → idex_science_packet_definition.xml} +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/20240827095047_SWE_IALIRT_packet.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971383-404.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971384-405.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971385-406.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971386-407.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971387-408.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971388-409.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971389-410.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971390-411.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/461971391-412.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/BinLog CCSDS_FRAG_TLM_20240826_152323Z_IALIRT_data_for_SDC.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/IALiRT Raw Packet Telemetry.txt +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/apid01152.tlm +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/eu_SWP_IAL_20240826_152033.csv +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/hi_fsw_view_1_ccsds.bin +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/hit_ialirt_sample.ccsds +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/hit_ialirt_sample.csv +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/idle_export_eu.SWE_IALIRT_20240827_093852.csv +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/imap_codice_l1a_hi-ialirt_20240523200000_v0.0.0.cdf +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/imap_codice_l1a_lo-ialirt_20241110193700_v0.0.0.cdf +0 -0
- /imap_processing/tests/ialirt/{test_data → data}/l0/sample_decoded_i-alirt_data.csv +0 -0
- /imap_processing/tests/mag/validation/{imap_calibration_mag_20240229_v01.cdf → calibration/imap_mag_l1b-calibration_20240229_v001.cdf} +0 -0
- /imap_processing/{swe/l1b/engineering_unit_convert_table.csv → tests/swe/lut/imap_swe_eu-conversion_20240510_v000.csv} +0 -0
- {imap_processing-0.12.0.dist-info → imap_processing-0.13.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.12.0.dist-info → imap_processing-0.13.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.12.0.dist-info → imap_processing-0.13.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
"""Test ULTRA L1a CDFs."""
|
|
2
|
+
|
|
1
3
|
import numpy as np
|
|
2
|
-
import
|
|
4
|
+
import xarray as xr
|
|
3
5
|
|
|
4
|
-
from imap_processing import
|
|
5
|
-
from imap_processing.
|
|
6
|
-
from imap_processing.ultra.l0.decom_ultra import process_ultra_apids
|
|
6
|
+
from imap_processing.cdf.utils import write_cdf
|
|
7
|
+
from imap_processing.ultra.l0.decom_ultra import get_event_id
|
|
7
8
|
from imap_processing.ultra.l0.ultra_utils import (
|
|
8
9
|
ULTRA_AUX,
|
|
9
10
|
ULTRA_EVENTS,
|
|
@@ -11,344 +12,120 @@ from imap_processing.ultra.l0.ultra_utils import (
|
|
|
11
12
|
ULTRA_TOF,
|
|
12
13
|
)
|
|
13
14
|
from imap_processing.ultra.l1a.ultra_l1a import (
|
|
14
|
-
create_dataset,
|
|
15
|
-
get_event_id,
|
|
16
15
|
ultra_l1a,
|
|
17
16
|
)
|
|
18
|
-
from imap_processing.utils import group_by_apid
|
|
19
|
-
|
|
20
17
|
|
|
21
|
-
@pytest.fixture()
|
|
22
|
-
def decom_ultra_aux(ccsds_path_theta_0, xtce_path):
|
|
23
|
-
"""Data for decom_ultra_aux"""
|
|
24
|
-
packets = decom.decom_packets(ccsds_path_theta_0, xtce_path)
|
|
25
|
-
grouped_data = group_by_apid(packets)
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
grouped_data[ULTRA_AUX.apid[0]], ULTRA_AUX.apid[0]
|
|
29
|
-
)
|
|
30
|
-
return data_packet_list
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@pytest.mark.parametrize(
|
|
34
|
-
"decom_test_data",
|
|
35
|
-
[
|
|
36
|
-
pytest.param(
|
|
37
|
-
{
|
|
38
|
-
"apid": ULTRA_AUX.apid[0],
|
|
39
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
40
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
],
|
|
44
|
-
indirect=True,
|
|
45
|
-
)
|
|
46
|
-
@pytest.mark.xfail(reason="Fix CDF attrs")
|
|
47
|
-
def test_xarray_aux(decom_test_data):
|
|
19
|
+
def test_xarray_aux(ccsds_path_theta_0):
|
|
48
20
|
"""This function checks that a xarray was
|
|
49
21
|
successfully created from the decom_ultra_aux data."""
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# assert spin_period_valid_list == decom_ultra_aux["SPINPERIODVALID"]
|
|
62
|
-
# assert spin_period_valid_attr == expected_spin_period_valid_attr.output()
|
|
63
|
-
|
|
64
|
-
# # Spot check support data and attributes
|
|
65
|
-
# version_list = dataset.variables["VERSION"].values.tolist()
|
|
66
|
-
# version_attr = dataset.variables["VERSION"].attrs
|
|
67
|
-
# expected_version_attr = dataclasses.replace(
|
|
68
|
-
# ultra_cdf_attrs.ultra_support_attrs,
|
|
69
|
-
# catdesc="version",
|
|
70
|
-
# fieldname="version",
|
|
71
|
-
# label_axis="version",
|
|
72
|
-
# ).output()
|
|
73
|
-
|
|
74
|
-
# assert version_list == decom_ultra_aux["VERSION"]
|
|
75
|
-
# assert version_attr == expected_version_attr
|
|
76
|
-
|
|
77
|
-
# # Spot check metadata data and attributes
|
|
78
|
-
# shcoarse_list = dataset.variables["SHCOARSE"].values.tolist()
|
|
79
|
-
# shcoarse_attr = dataset.variables["SHCOARSE"].attrs
|
|
80
|
-
|
|
81
|
-
# expected_shcoarse_attr = dataclasses.replace(
|
|
82
|
-
# ultra_cdf_attrs.ultra_support_attrs,
|
|
83
|
-
# catdesc="shcoarse",
|
|
84
|
-
# fieldname="shcoarse",
|
|
85
|
-
# label_axis="shcoarse",
|
|
86
|
-
# ).output()
|
|
87
|
-
|
|
88
|
-
# assert shcoarse_list == decom_ultra_aux["SHCOARSE"]
|
|
89
|
-
# assert shcoarse_attr == expected_shcoarse_attr
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
@pytest.mark.parametrize(
|
|
93
|
-
"decom_test_data",
|
|
94
|
-
[
|
|
95
|
-
pytest.param(
|
|
96
|
-
{
|
|
97
|
-
"apid": ULTRA_RATES.apid[0],
|
|
98
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
99
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
],
|
|
103
|
-
indirect=True,
|
|
104
|
-
)
|
|
105
|
-
@pytest.mark.xfail(reason="Fix CDF attrs")
|
|
106
|
-
def test_xarray_rates(decom_test_data):
|
|
22
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_AUX.apid[0])
|
|
23
|
+
|
|
24
|
+
# Spot check metadata data and attributes
|
|
25
|
+
specific_epoch_data = test_data[0].sel(epoch=test_data[0].epoch[0])[
|
|
26
|
+
"spinperiodvalid"
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
assert (specific_epoch_data == test_data[0]["spinperiodvalid"][0]).all()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_xarray_rates(ccsds_path_theta_0):
|
|
107
33
|
"""This function checks that a xarray was
|
|
108
34
|
successfully created from the decom_ultra_rates data."""
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
# ).astype(np.int64)
|
|
117
|
-
# specific_epoch_data = dataset.sel(epoch=j2000_time)["START_RF"]
|
|
118
|
-
# startrf_list = specific_epoch_data.values.tolist()
|
|
119
|
-
# startrf_attr = dataset.variables["START_RF"].attrs
|
|
120
|
-
|
|
121
|
-
# expected_startrf_attr = dataclasses.replace(
|
|
122
|
-
# ultra_cdf_attrs.ultra_support_attrs,
|
|
123
|
-
# catdesc="start_rf",
|
|
124
|
-
# fieldname="start_rf",
|
|
125
|
-
# label_axis="start_rf",
|
|
126
|
-
# ).output()
|
|
127
|
-
|
|
128
|
-
# assert startrf_list == decom_ultra_rates["START_RF"][0]
|
|
129
|
-
# assert startrf_attr == expected_startrf_attr
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@pytest.mark.parametrize(
|
|
133
|
-
"decom_test_data",
|
|
134
|
-
[
|
|
135
|
-
pytest.param(
|
|
136
|
-
{
|
|
137
|
-
"apid": ULTRA_TOF.apid[0],
|
|
138
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
139
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
],
|
|
143
|
-
indirect=True,
|
|
144
|
-
)
|
|
145
|
-
@pytest.mark.xfail(reason="Fix CDF attrs")
|
|
146
|
-
def test_xarray_tof(decom_test_data):
|
|
35
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_RATES.apid[0])
|
|
36
|
+
# Spot check metadata data and attributes
|
|
37
|
+
specific_epoch_data = test_data[0].sel(epoch=test_data[0].epoch[0])["start_rf"]
|
|
38
|
+
assert (specific_epoch_data == test_data[0]["start_rf"][0]).all()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_xarray_tof(ccsds_path_theta_0):
|
|
147
42
|
"""This function checks that a xarray was
|
|
148
43
|
successfully created from the decom_ultra_tof data."""
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# expected_packetdata_attr = dataclasses.replace(
|
|
161
|
-
# ultra_cdf_attrs.ultra_support_attrs,
|
|
162
|
-
# catdesc="packetdata",
|
|
163
|
-
# fieldname="packetdata",
|
|
164
|
-
# label_axis="packetdata",
|
|
165
|
-
# depend_1="sid",
|
|
166
|
-
# depend_2="row",
|
|
167
|
-
# depend_3="column",
|
|
168
|
-
# units="pixels",
|
|
169
|
-
# variable_purpose="primary_var",
|
|
170
|
-
# ).output()
|
|
171
|
-
|
|
172
|
-
# assert (specific_epoch_data == decom_ultra_tof["PACKETDATA"][0][0]).all()
|
|
173
|
-
# assert packetdata_attr == expected_packetdata_attr
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
@pytest.mark.parametrize(
|
|
177
|
-
"decom_test_data",
|
|
178
|
-
[
|
|
179
|
-
pytest.param(
|
|
180
|
-
{
|
|
181
|
-
"apid": ULTRA_EVENTS.apid[0],
|
|
182
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
183
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
184
|
-
},
|
|
185
|
-
)
|
|
186
|
-
],
|
|
187
|
-
indirect=True,
|
|
188
|
-
)
|
|
189
|
-
@pytest.mark.xfail(reason="Fix CDF attrs")
|
|
190
|
-
def test_xarray_events(decom_test_data, decom_ultra_aux, events_test_path):
|
|
44
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_TOF.apid[0])
|
|
45
|
+
|
|
46
|
+
# Spot check metadata data and attributes
|
|
47
|
+
specific_epoch_data = test_data[0].sel(epoch=test_data[0].epoch[0], sid=0)[
|
|
48
|
+
"packetdata"
|
|
49
|
+
]
|
|
50
|
+
assert (specific_epoch_data == test_data[0]["packetdata"][0][0]).all()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_xarray_events(ccsds_path_theta_0):
|
|
191
54
|
"""This function checks that a xarray was
|
|
192
55
|
successfully created from the decom_ultra_events data."""
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
# expected_cointype_attr = dataclasses.replace(
|
|
211
|
-
# ultra_cdf_attrs.ultra_support_attrs,
|
|
212
|
-
# catdesc="coin_type",
|
|
213
|
-
# fieldname="coin_type",
|
|
214
|
-
# label_axis="coin_type",
|
|
215
|
-
# ).output()
|
|
216
|
-
|
|
217
|
-
# assert cointype_list == decom_ultra_events["COIN_TYPE"][0]
|
|
218
|
-
# assert cointype_attr == expected_cointype_attr
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
def test_cdf_aux(
|
|
222
|
-
ccsds_path_theta_0,
|
|
223
|
-
decom_ultra_aux,
|
|
224
|
-
):
|
|
225
|
-
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
226
|
-
|
|
227
|
-
test_data = ultra_l1a(
|
|
228
|
-
ccsds_path_theta_0, data_version="001", apid=ULTRA_AUX.apid[0]
|
|
229
|
-
)
|
|
56
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_EVENTS.apid[0])
|
|
57
|
+
specific_epoch_data = test_data[0].sel(epoch=test_data[0].epoch[0])["coin_type"]
|
|
58
|
+
assert (specific_epoch_data == test_data[0]["coin_type"][0]).all()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_xarray_hk(ccsds_path_theta_0):
|
|
62
|
+
"""This function checks that a xarray was
|
|
63
|
+
successfully created from the decom_ultra_hk data."""
|
|
64
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=869)
|
|
65
|
+
|
|
66
|
+
assert isinstance(test_data[0], xr.Dataset)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_cdf_aux(ccsds_path_theta_0):
|
|
70
|
+
"""Tests that CDF file can be created."""
|
|
71
|
+
|
|
72
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_AUX.apid[0])
|
|
230
73
|
test_data_path = write_cdf(test_data[0])
|
|
231
74
|
|
|
232
75
|
assert test_data_path.exists()
|
|
233
|
-
assert test_data_path.name == "imap_ultra_l1a_45sensor-
|
|
234
|
-
|
|
235
|
-
dataset_aux = create_dataset({ULTRA_AUX.apid[0]: decom_ultra_aux})
|
|
236
|
-
input_xarray_aux = load_cdf(test_data_path)
|
|
237
|
-
|
|
238
|
-
# write_cdf() injects some attributes that are not in the xarray
|
|
239
|
-
assert set(dataset_aux.attrs.keys()).issubset(set(input_xarray_aux.attrs.keys()))
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
@pytest.mark.parametrize(
|
|
243
|
-
"decom_test_data",
|
|
244
|
-
[
|
|
245
|
-
pytest.param(
|
|
246
|
-
{
|
|
247
|
-
"apid": ULTRA_RATES.apid[0],
|
|
248
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
249
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
250
|
-
},
|
|
251
|
-
)
|
|
252
|
-
],
|
|
253
|
-
indirect=True,
|
|
254
|
-
)
|
|
255
|
-
def test_cdf_rates(ccsds_path_theta_0, decom_test_data):
|
|
256
|
-
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
257
|
-
decom_ultra_rates, _ = decom_test_data
|
|
258
|
-
test_data = ultra_l1a(
|
|
259
|
-
ccsds_path_theta_0, data_version="001", apid=ULTRA_RATES.apid[0]
|
|
260
|
-
)
|
|
261
|
-
test_data_path = write_cdf(test_data[0], istp=False)
|
|
76
|
+
assert test_data_path.name == "imap_ultra_l1a_45sensor-aux_20240207_v999.cdf"
|
|
262
77
|
|
|
263
|
-
assert test_data_path.exists()
|
|
264
|
-
assert test_data_path.name == "imap_ultra_l1a_45sensor-rates_20240207_v001.cdf"
|
|
265
78
|
|
|
266
|
-
|
|
267
|
-
|
|
79
|
+
def test_cdf_rates(ccsds_path_theta_0):
|
|
80
|
+
"""Tests that CDF file can be created."""
|
|
81
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_RATES.apid[0])
|
|
82
|
+
test_data_path = write_cdf(test_data[0], istp=False)
|
|
268
83
|
|
|
269
|
-
|
|
270
|
-
assert
|
|
271
|
-
set(input_xarray_rates.attrs.keys())
|
|
272
|
-
)
|
|
84
|
+
assert test_data_path.exists()
|
|
85
|
+
assert test_data_path.name == "imap_ultra_l1a_45sensor-rates_20240207_v999.cdf"
|
|
273
86
|
|
|
274
87
|
|
|
275
|
-
|
|
276
|
-
"
|
|
277
|
-
[
|
|
278
|
-
pytest.param(
|
|
279
|
-
{
|
|
280
|
-
"apid": ULTRA_TOF.apid[0],
|
|
281
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
282
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
283
|
-
},
|
|
284
|
-
)
|
|
285
|
-
],
|
|
286
|
-
indirect=True,
|
|
287
|
-
)
|
|
288
|
-
def test_cdf_tof(ccsds_path_theta_0, decom_test_data):
|
|
289
|
-
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
290
|
-
decom_ultra_tof, _ = decom_test_data
|
|
291
|
-
test_data = ultra_l1a(
|
|
292
|
-
ccsds_path_theta_0, data_version="001", apid=ULTRA_TOF.apid[0]
|
|
293
|
-
)
|
|
88
|
+
def test_cdf_tof(ccsds_path_theta_0):
|
|
89
|
+
"""Tests that CDF file can be created."""
|
|
90
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_TOF.apid[0])
|
|
294
91
|
test_data_path = write_cdf(test_data[0])
|
|
295
|
-
|
|
296
92
|
assert test_data_path.exists()
|
|
297
|
-
assert
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
input_xarray_tof = load_cdf(test_data_path)
|
|
301
|
-
# write_cdf() injects some attributes that are not in the xarray
|
|
302
|
-
assert set(dataset_tof.attrs.keys()).issubset(set(input_xarray_tof.attrs.keys()))
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
@pytest.mark.parametrize(
|
|
306
|
-
"decom_test_data",
|
|
307
|
-
[
|
|
308
|
-
pytest.param(
|
|
309
|
-
{
|
|
310
|
-
"apid": ULTRA_EVENTS.apid[0],
|
|
311
|
-
"filename": "FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50"
|
|
312
|
-
"_theta-0.00_20240207T102740.CCSDS",
|
|
313
|
-
},
|
|
314
|
-
)
|
|
315
|
-
],
|
|
316
|
-
indirect=True,
|
|
317
|
-
)
|
|
318
|
-
def test_cdf_events(ccsds_path_theta_0, decom_ultra_aux, decom_test_data):
|
|
319
|
-
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
320
|
-
decom_ultra_events, _ = decom_test_data
|
|
321
|
-
test_data = ultra_l1a(
|
|
322
|
-
ccsds_path_theta_0, data_version="001", apid=ULTRA_EVENTS.apid[0]
|
|
93
|
+
assert (
|
|
94
|
+
test_data_path.name
|
|
95
|
+
== "imap_ultra_l1a_45sensor-histogram-ena-phxtof-hi-ang_20240207_v999.cdf"
|
|
323
96
|
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_cdf_events(ccsds_path_theta_0):
|
|
100
|
+
"""Tests that CDF file can be created."""
|
|
101
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=ULTRA_EVENTS.apid[0])
|
|
324
102
|
test_data_path = write_cdf(test_data[0], istp=False)
|
|
325
103
|
|
|
326
104
|
assert test_data_path.exists()
|
|
327
|
-
assert test_data_path.name == "imap_ultra_l1a_45sensor-
|
|
105
|
+
assert test_data_path.name == "imap_ultra_l1a_45sensor-de_20240207_v999.cdf"
|
|
328
106
|
|
|
329
|
-
dataset_events = create_dataset({ULTRA_EVENTS.apid[0]: decom_ultra_events})
|
|
330
|
-
input_xarray_events = load_cdf(test_data_path)
|
|
331
107
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
108
|
+
def test_cdf_hk(ccsds_path_theta_0):
|
|
109
|
+
"""Tests that CDF file can be created."""
|
|
110
|
+
test_data = ultra_l1a(ccsds_path_theta_0, apid_input=869)
|
|
111
|
+
data = test_data[0]
|
|
112
|
+
data.attrs["Data_version"] = "v999"
|
|
113
|
+
test_data_path = write_cdf(data, istp=True)
|
|
114
|
+
|
|
115
|
+
assert test_data_path.exists()
|
|
116
|
+
assert test_data_path.name == "imap_ultra_l1a_45sensor-status_20240207_v999.cdf"
|
|
336
117
|
|
|
337
118
|
|
|
338
119
|
def test_get_event_id():
|
|
339
120
|
"""Test get_event_id"""
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
decom_events = get_event_id(decom_ultra_dict)
|
|
121
|
+
data = np.array([445015662, 445015663, 445015664, 445015664])
|
|
122
|
+
decom_events = get_event_id(data)
|
|
344
123
|
counters_for_met = []
|
|
345
|
-
for i in range(len(decom_events
|
|
346
|
-
event_id = decom_events[
|
|
124
|
+
for i in range(len(decom_events)):
|
|
125
|
+
event_id = decom_events[i]
|
|
347
126
|
met_extracted = event_id >> np.int64(31)
|
|
348
127
|
|
|
349
|
-
assert met_extracted == np.int64(
|
|
350
|
-
decom_ultra_dict[ULTRA_EVENTS.apid[0]]["SHCOARSE"][i]
|
|
351
|
-
)
|
|
128
|
+
assert met_extracted == np.int64(data[i])
|
|
352
129
|
counters_for_met.append(event_id & np.int64(0x7FFFFFFF))
|
|
353
130
|
|
|
354
131
|
assert counters_for_met == [0, 0, 0, 1]
|
|
@@ -7,7 +7,7 @@ from imap_processing.ultra.l1b.ultra_l1b import ultra_l1b
|
|
|
7
7
|
from imap_processing.ultra.utils.ultra_l1_utils import create_dataset
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
@pytest.fixture
|
|
10
|
+
@pytest.fixture
|
|
11
11
|
def mock_data_l1a_rates_dict():
|
|
12
12
|
# Create sample data for the xarray Dataset
|
|
13
13
|
epoch = np.arange(
|
|
@@ -30,7 +30,7 @@ def mock_data_l1a_rates_dict():
|
|
|
30
30
|
return data_dict
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
@pytest.fixture
|
|
33
|
+
@pytest.fixture
|
|
34
34
|
def mock_data_l1b_de_dict():
|
|
35
35
|
epoch = np.array(
|
|
36
36
|
[760591786368000000, 760591787368000000, 760591788368000000],
|
|
@@ -40,8 +40,12 @@ def mock_data_l1b_de_dict():
|
|
|
40
40
|
return data_dict
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
@pytest.fixture
|
|
43
|
+
@pytest.fixture
|
|
44
44
|
def mock_data_l1b_extendedspin_dict():
|
|
45
|
+
epoch = np.array(
|
|
46
|
+
[760591786368000000, 760591787368000000, 760591788368000000],
|
|
47
|
+
dtype="datetime64[ns]",
|
|
48
|
+
)
|
|
45
49
|
spin = np.array(
|
|
46
50
|
[0, 1, 2],
|
|
47
51
|
dtype="uint32",
|
|
@@ -53,6 +57,7 @@ def mock_data_l1b_extendedspin_dict():
|
|
|
53
57
|
spin_start_time = np.array([0, 1, 2], dtype="uint64")
|
|
54
58
|
quality = np.zeros((2, 3), dtype="uint16")
|
|
55
59
|
data_dict = {
|
|
60
|
+
"epoch": epoch,
|
|
56
61
|
"spin_number": spin,
|
|
57
62
|
"energy_bin_geometric_mean": energy,
|
|
58
63
|
"spin_start_time": spin_start_time,
|
|
@@ -67,7 +72,6 @@ def test_create_extendedspin_dataset(mock_data_l1b_extendedspin_dict):
|
|
|
67
72
|
mock_data_l1b_extendedspin_dict,
|
|
68
73
|
"imap_ultra_l1b_45sensor-extendedspin",
|
|
69
74
|
"l1b",
|
|
70
|
-
"001",
|
|
71
75
|
)
|
|
72
76
|
|
|
73
77
|
assert "spin_number" in dataset.coords
|
|
@@ -82,9 +86,7 @@ def test_create_extendedspin_dataset(mock_data_l1b_extendedspin_dict):
|
|
|
82
86
|
|
|
83
87
|
def test_create_de_dataset(mock_data_l1b_de_dict):
|
|
84
88
|
"""Tests that dataset is created as expected."""
|
|
85
|
-
dataset = create_dataset(
|
|
86
|
-
mock_data_l1b_de_dict, "imap_ultra_l1b_45sensor-de", "l1b", "001"
|
|
87
|
-
)
|
|
89
|
+
dataset = create_dataset(mock_data_l1b_de_dict, "imap_ultra_l1b_45sensor-de", "l1b")
|
|
88
90
|
|
|
89
91
|
assert "epoch" in dataset.coords
|
|
90
92
|
assert dataset.coords["epoch"].dtype == "datetime64[ns]"
|
|
@@ -106,9 +108,9 @@ def test_ultra_l1b(l1b_de_dataset):
|
|
|
106
108
|
|
|
107
109
|
def test_cdf_de(l1b_de_dataset):
|
|
108
110
|
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
109
|
-
test_data_path = write_cdf(l1b_de_dataset[0], istp=
|
|
111
|
+
test_data_path = write_cdf(l1b_de_dataset[0], istp=True)
|
|
110
112
|
assert test_data_path.exists()
|
|
111
|
-
assert test_data_path.name == "imap_ultra_l1b_45sensor-
|
|
113
|
+
assert test_data_path.name == "imap_ultra_l1b_45sensor-de_20240207_v999.cdf"
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
def test_ultra_l1b_extendedspin(l1b_extendedspin_dataset):
|
|
@@ -130,13 +132,29 @@ def test_ultra_l1b_extendedspin(l1b_extendedspin_dataset):
|
|
|
130
132
|
|
|
131
133
|
def test_cdf_extendedspin(l1b_extendedspin_dataset):
|
|
132
134
|
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
133
|
-
test_data_path = write_cdf(l1b_extendedspin_dataset[0], istp=
|
|
135
|
+
test_data_path = write_cdf(l1b_extendedspin_dataset[0], istp=True)
|
|
136
|
+
assert test_data_path.exists()
|
|
137
|
+
assert (
|
|
138
|
+
test_data_path.name == "imap_ultra_l1b_45sensor-extendedspin_20240207_v999.cdf"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def test_cdf_cullingmask(l1b_extendedspin_dataset):
|
|
143
|
+
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
144
|
+
test_data_path = write_cdf(l1b_extendedspin_dataset[1], istp=True)
|
|
134
145
|
assert test_data_path.exists()
|
|
135
146
|
assert (
|
|
136
|
-
test_data_path.name == "imap_ultra_l1b_45sensor-
|
|
147
|
+
test_data_path.name == "imap_ultra_l1b_45sensor-cullingmask_20240207_v999.cdf"
|
|
137
148
|
)
|
|
138
149
|
|
|
139
150
|
|
|
151
|
+
def test_cdf_badtimes(l1b_extendedspin_dataset):
|
|
152
|
+
"""Tests that CDF file is created and contains same attributes as xarray."""
|
|
153
|
+
test_data_path = write_cdf(l1b_extendedspin_dataset[2], istp=True)
|
|
154
|
+
assert test_data_path.exists()
|
|
155
|
+
assert test_data_path.name == "imap_ultra_l1b_45sensor-badtimes_20240207_v999.cdf"
|
|
156
|
+
|
|
157
|
+
|
|
140
158
|
def test_ultra_l1b_error(mock_data_l1a_rates_dict):
|
|
141
159
|
"""Tests that L1a data throws an error."""
|
|
142
160
|
mock_data_l1a_rates_dict["bad_key"] = mock_data_l1a_rates_dict.pop(
|
|
@@ -145,4 +163,4 @@ def test_ultra_l1b_error(mock_data_l1a_rates_dict):
|
|
|
145
163
|
with pytest.raises(
|
|
146
164
|
ValueError, match="Data dictionary does not contain the expected keys."
|
|
147
165
|
):
|
|
148
|
-
ultra_l1b(mock_data_l1a_rates_dict
|
|
166
|
+
ultra_l1b(mock_data_l1a_rates_dict)
|
|
@@ -10,7 +10,7 @@ from imap_processing.ultra.l1b.ultra_l1b_annotated import (
|
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@pytest.fixture
|
|
13
|
+
@pytest.fixture
|
|
14
14
|
def kernels(spice_test_data_path):
|
|
15
15
|
"""List SPICE kernels."""
|
|
16
16
|
required_kernels = [
|
|
@@ -28,7 +28,7 @@ def kernels(spice_test_data_path):
|
|
|
28
28
|
return kernels
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
@pytest.mark.external_kernel
|
|
31
|
+
@pytest.mark.external_kernel
|
|
32
32
|
def test_get_particle_velocity(spice_test_data_path, kernels):
|
|
33
33
|
"""Tests get_particle_velocity function."""
|
|
34
34
|
spiceypy.furnsh(kernels)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
|
+
from imap_processing import imap_module_directory
|
|
6
7
|
from imap_processing.quality_flags import ImapAttitudeUltraFlags, ImapRatesUltraFlags
|
|
7
8
|
from imap_processing.ultra.constants import UltraConstants
|
|
8
9
|
from imap_processing.ultra.l1b.ultra_l1b_culling import (
|
|
@@ -14,8 +15,10 @@ from imap_processing.ultra.l1b.ultra_l1b_culling import (
|
|
|
14
15
|
get_spin_data,
|
|
15
16
|
)
|
|
16
17
|
|
|
18
|
+
TEST_PATH = imap_module_directory / "tests" / "ultra" / "data" / "l1"
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
@pytest.fixture
|
|
19
22
|
def test_data(use_fake_spin_data_for_time):
|
|
20
23
|
"""Fixture to compute and return test data."""
|
|
21
24
|
|