Skip to content

Commit 06e4d78

Browse files
authored
Ultra l1a - add more apids 898, 899, 900, 901 (#1878)
1 parent 65b23fa commit 06e4d78

12 files changed

Lines changed: 483 additions & 15 deletions

imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,54 @@ imap_ultra_l1a_90sensor-energy-de:
8080
Logical_source: imap_ultra_l1a_90sensor-energy-de
8181
Logical_source_description: IMAP-Ultra Instrument Level-1A Energy Direct Event Data.
8282

83+
imap_ultra_l1a_45sensor-priority-1-de:
84+
<<: *instrument_base
85+
Data_type: L1A_PRIORITY_1_DE>Level-1A Priority 1 Direct Event
86+
Logical_source: imap_ultra_l1a_45sensor-priority-1-de
87+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 1 Direct Event Data.
88+
89+
imap_ultra_l1a_90sensor-priority-1-de:
90+
<<: *instrument_base
91+
Data_type: L1A_PRIORITY_1_DE>Level-1A Priority 1 Direct Event
92+
Logical_source: imap_ultra_l1a_90sensor-priority-1-de
93+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 1 Direct Event Data.
94+
95+
imap_ultra_l1a_45sensor-priority-2-de:
96+
<<: *instrument_base
97+
Data_type: L1A_PRIORITY_2_DE>Level-1A Priority 2 Direct Event
98+
Logical_source: imap_ultra_l1a_45sensor-priority-2-de
99+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 2 Direct Event Data.
100+
101+
imap_ultra_l1a_90sensor-priority-2-de:
102+
<<: *instrument_base
103+
Data_type: L1A_PRIORITY_2_DE>Level-1A Priority 2 Direct Event
104+
Logical_source: imap_ultra_l1a_90sensor-priority-2-de
105+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 2 Direct Event Data.
106+
107+
imap_ultra_l1a_45sensor-priority-3-de:
108+
<<: *instrument_base
109+
Data_type: L1A_PRIORITY_3_DE>Level-1A Priority 3 Direct Event
110+
Logical_source: imap_ultra_l1a_45sensor-priority-3-de
111+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 3 Direct Event Data.
112+
113+
imap_ultra_l1a_90sensor-priority-3-de:
114+
<<: *instrument_base
115+
Data_type: L1A_PRIORITY_3_DE>Level-1A Priority 3 Direct Event
116+
Logical_source: imap_ultra_l1a_90sensor-priority-3-de
117+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 3 Direct Event Data.
118+
119+
imap_ultra_l1a_45sensor-priority-4-de:
120+
<<: *instrument_base
121+
Data_type: L1A_PRIORITY_4_DE>Level-1A Priority 4 Direct Event
122+
Logical_source: imap_ultra_l1a_45sensor-priority-4-de
123+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 4 Direct Event Data.
124+
125+
imap_ultra_l1a_90sensor-priority-4-de:
126+
<<: *instrument_base
127+
Data_type: L1A_PRIORITY_4_DE>Level-1A Priority 4 Direct Event
128+
Logical_source: imap_ultra_l1a_90sensor-priority-4-de
129+
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 4 Direct Event Data.
130+
83131
imap_ultra_l1b_45sensor-de:
84132
<<: *instrument_base
85133
Data_type: L1B_45Sensor-DE>Level-1B Direct Events for Ultra45

imap_processing/tests/external_test_data_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@
6363
("IMAP-Ultra45_r1_L1_V0_shortened.csv", "ultra/data/l1/"),
6464

6565
# Ultra
66+
("FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.CCSDS", "ultra/data/l0/"),
6667
("ultra45_raw_sc_rawnrgevnt_19840122_00.csv", "ultra/data/l0/"),
6768
("ultra45_raw_sc_imgpriority1evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
69+
("ultra45_raw_sc_imgpriority2evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
70+
("ultra45_raw_sc_imgpriority3evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
71+
("ultra45_raw_sc_imgpriority4evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
6872
("ultra45_raw_sc_ultranrgrates_FM45_UltraFM45_Functional_"
6973
"2024-01-22T0105_20240122T010548.csv", "ultra/data/l0/"),
7074
("imap_ultra_l0_raw_20260924_v001.pkts", "ultra/data/l0/"),

imap_processing/tests/ultra/unit/conftest.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
ULTRA_ENERGY_EVENTS,
1717
ULTRA_ENERGY_RATES,
1818
ULTRA_EVENTS,
19+
ULTRA_PRI_1_EVENTS,
20+
ULTRA_PRI_2_EVENTS,
21+
ULTRA_PRI_3_EVENTS,
22+
ULTRA_PRI_4_EVENTS,
1923
ULTRA_RATES,
2024
ULTRA_TOF,
2125
)
@@ -102,6 +106,19 @@ def ccsds_path_functional():
102106
)
103107

104108

109+
@pytest.fixture
110+
def ccsds_path_extra():
111+
"""Returns the ccsds directory."""
112+
return (
113+
imap_module_directory
114+
/ "tests"
115+
/ "ultra"
116+
/ "data"
117+
/ "l0"
118+
/ "FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.CCSDS"
119+
)
120+
121+
105122
@pytest.fixture
106123
def xtce_path():
107124
"""Returns the xtce image rates directory."""
@@ -178,6 +195,14 @@ def decom_test_data(request, xtce_path):
178195
ULTRA_ENERGY_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
179196
ULTRA_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
180197
ULTRA_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
198+
ULTRA_PRI_1_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
199+
ULTRA_PRI_1_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
200+
ULTRA_PRI_2_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
201+
ULTRA_PRI_2_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
202+
ULTRA_PRI_3_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
203+
ULTRA_PRI_3_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
204+
ULTRA_PRI_4_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
205+
ULTRA_PRI_4_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
181206
ULTRA_RATES.apid[0]: lambda ds, apid: process_ultra_rates(ds),
182207
ULTRA_RATES.apid[1]: lambda ds, apid: process_ultra_rates(ds),
183208
ULTRA_ENERGY_RATES.apid[0]: lambda ds, apid: process_ultra_energy_rates(ds),
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import numpy as np
2+
import pandas as pd
3+
import pytest
4+
5+
from imap_processing import imap_module_directory
6+
7+
8+
@pytest.mark.parametrize(
9+
"decom_test_data",
10+
[
11+
pytest.param(
12+
{
13+
"apid": 898,
14+
"filename": "FM45_UltraFM45Extra_TV_Tests_"
15+
"2024-01-22T0930_20240122T093008.CCSDS",
16+
}
17+
)
18+
],
19+
indirect=True,
20+
)
21+
@pytest.mark.external_test_data
22+
def test_image_raw_events_decom(decom_test_data, xtce_path):
23+
"""This function reads validation data and checks that decom data
24+
matches validation data for image rate packet"""
25+
filename = (
26+
"ultra45_raw_sc_imgpriority1evnt_FM45_UltraFM45Extra_TV_Tests_"
27+
"2024-01-22T0930_20240122T093008.csv"
28+
)
29+
priority_1_events_test_path = (
30+
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
31+
)
32+
33+
decom_ultra = decom_test_data
34+
df = pd.read_csv(priority_1_events_test_path, index_col="MET")
35+
36+
vars_to_compare = {
37+
"SID": "sid",
38+
"Spin": "spin",
39+
"AbortFlag": "abortflag",
40+
"StartDelay": "startdelay",
41+
"Count": "count",
42+
"CoinType": "coin_type",
43+
"StartType": "start_type",
44+
"StopType": "stop_type",
45+
"StartPosTDC": "start_pos_tdc",
46+
"StopNorthTDC": "stop_north_tdc",
47+
"StopEastTDC": "stop_east_tdc",
48+
"StopSouthTDC": "stop_south_tdc",
49+
"StopWestTDC": "stop_west_tdc",
50+
"CoinNorthTDC": "coin_north_tdc",
51+
"CoinSouthTDC": "coin_south_tdc",
52+
"CoinDiscreteTDC": "coin_discrete_tdc",
53+
"EnergyOrPH": "energy_ph",
54+
"PulseWidth": "pulse_width",
55+
"PhaseAngle": "phase_angle",
56+
"Bin": "bin",
57+
}
58+
59+
for df_var, xr_var in vars_to_compare.items():
60+
good_values = df[df_var].values != -1
61+
np.testing.assert_array_equal(
62+
df[df_var].values[good_values], decom_ultra[xr_var].values[good_values]
63+
)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import numpy as np
2+
import pandas as pd
3+
import pytest
4+
5+
from imap_processing import imap_module_directory
6+
7+
8+
@pytest.mark.parametrize(
9+
"decom_test_data",
10+
[
11+
pytest.param(
12+
{
13+
"apid": 899,
14+
"filename": "FM45_UltraFM45Extra_TV_Tests_"
15+
"2024-01-22T0930_20240122T093008.CCSDS",
16+
}
17+
)
18+
],
19+
indirect=True,
20+
)
21+
@pytest.mark.external_test_data
22+
def test_image_raw_events_decom(decom_test_data, xtce_path):
23+
"""This function reads validation data and checks that decom data
24+
matches validation data for image rate packet"""
25+
filename = (
26+
"ultra45_raw_sc_imgpriority2evnt_FM45_UltraFM45Extra_TV_Tests_"
27+
"2024-01-22T0930_20240122T093008.csv"
28+
)
29+
priority_2_events_test_path = (
30+
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
31+
)
32+
33+
decom_ultra = decom_test_data
34+
df = pd.read_csv(priority_2_events_test_path, index_col="MET")
35+
36+
vars_to_compare = {
37+
"SID": "sid",
38+
"Spin": "spin",
39+
"AbortFlag": "abortflag",
40+
"StartDelay": "startdelay",
41+
"Count": "count",
42+
"CoinType": "coin_type",
43+
"StartType": "start_type",
44+
"StopType": "stop_type",
45+
"StartPosTDC": "start_pos_tdc",
46+
"StopNorthTDC": "stop_north_tdc",
47+
"StopEastTDC": "stop_east_tdc",
48+
"StopSouthTDC": "stop_south_tdc",
49+
"StopWestTDC": "stop_west_tdc",
50+
"CoinNorthTDC": "coin_north_tdc",
51+
"CoinSouthTDC": "coin_south_tdc",
52+
"CoinDiscreteTDC": "coin_discrete_tdc",
53+
"EnergyOrPH": "energy_ph",
54+
"PulseWidth": "pulse_width",
55+
"PhaseAngle": "phase_angle",
56+
"Bin": "bin",
57+
}
58+
59+
for df_var, xr_var in vars_to_compare.items():
60+
good_values = df[df_var].values != -1
61+
np.testing.assert_array_equal(
62+
df[df_var].values[good_values],
63+
decom_ultra[xr_var].values[good_values],
64+
)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import numpy as np
2+
import pandas as pd
3+
import pytest
4+
5+
from imap_processing import imap_module_directory
6+
7+
8+
@pytest.mark.parametrize(
9+
"decom_test_data",
10+
[
11+
pytest.param(
12+
{
13+
"apid": 900,
14+
"filename": "FM45_UltraFM45Extra_TV_Tests_"
15+
"2024-01-22T0930_20240122T093008.CCSDS",
16+
}
17+
)
18+
],
19+
indirect=True,
20+
)
21+
@pytest.mark.external_test_data
22+
def test_image_raw_events_decom(decom_test_data, xtce_path):
23+
"""This function reads validation data and checks that decom data
24+
matches validation data for image rate packet"""
25+
filename = (
26+
"ultra45_raw_sc_imgpriority3evnt_FM45_UltraFM45Extra_TV_Tests_"
27+
"2024-01-22T0930_20240122T093008.csv"
28+
)
29+
priority_3_events_test_path = (
30+
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
31+
)
32+
33+
decom_ultra = decom_test_data
34+
df = pd.read_csv(priority_3_events_test_path, index_col="MET")
35+
36+
vars_to_compare = {
37+
"SID": "sid",
38+
"Spin": "spin",
39+
"AbortFlag": "abortflag",
40+
"StartDelay": "startdelay",
41+
"Count": "count",
42+
"CoinType": "coin_type",
43+
"StartType": "start_type",
44+
"StopType": "stop_type",
45+
"StartPosTDC": "start_pos_tdc",
46+
"StopNorthTDC": "stop_north_tdc",
47+
"StopEastTDC": "stop_east_tdc",
48+
"StopSouthTDC": "stop_south_tdc",
49+
"StopWestTDC": "stop_west_tdc",
50+
"CoinNorthTDC": "coin_north_tdc",
51+
"CoinSouthTDC": "coin_south_tdc",
52+
"CoinDiscreteTDC": "coin_discrete_tdc",
53+
"EnergyOrPH": "energy_ph",
54+
"PulseWidth": "pulse_width",
55+
"PhaseAngle": "phase_angle",
56+
"Bin": "bin",
57+
}
58+
59+
for df_var, xr_var in vars_to_compare.items():
60+
good_values = df[df_var].values != -1
61+
np.testing.assert_array_equal(
62+
df[df_var].values[good_values],
63+
decom_ultra[xr_var].values[good_values],
64+
)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import numpy as np
2+
import pandas as pd
3+
import pytest
4+
5+
from imap_processing import imap_module_directory
6+
7+
8+
@pytest.mark.parametrize(
9+
"decom_test_data",
10+
[
11+
pytest.param(
12+
{
13+
"apid": 901,
14+
"filename": "FM45_UltraFM45Extra_TV_Tests_"
15+
"2024-01-22T0930_20240122T093008.CCSDS",
16+
}
17+
)
18+
],
19+
indirect=True,
20+
)
21+
@pytest.mark.external_test_data
22+
def test_image_raw_events_decom(decom_test_data, xtce_path):
23+
"""This function reads validation data and checks that decom data
24+
matches validation data for image rate packet"""
25+
filename = (
26+
"ultra45_raw_sc_imgpriority4evnt_FM45_UltraFM45Extra_TV_Tests_"
27+
"2024-01-22T0930_20240122T093008.csv"
28+
)
29+
priority_4_events_test_path = (
30+
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
31+
)
32+
33+
decom_ultra = decom_test_data
34+
df = pd.read_csv(priority_4_events_test_path, index_col="MET")
35+
36+
vars_to_compare = {
37+
"SID": "sid",
38+
"Spin": "spin",
39+
"AbortFlag": "abortflag",
40+
"StartDelay": "startdelay",
41+
"Count": "count",
42+
"CoinType": "coin_type",
43+
"StartType": "start_type",
44+
"StopType": "stop_type",
45+
"StartPosTDC": "start_pos_tdc",
46+
"StopNorthTDC": "stop_north_tdc",
47+
"StopEastTDC": "stop_east_tdc",
48+
"StopSouthTDC": "stop_south_tdc",
49+
"StopWestTDC": "stop_west_tdc",
50+
"CoinNorthTDC": "coin_north_tdc",
51+
"CoinSouthTDC": "coin_south_tdc",
52+
"CoinDiscreteTDC": "coin_discrete_tdc",
53+
"EnergyOrPH": "energy_ph",
54+
"PulseWidth": "pulse_width",
55+
"PhaseAngle": "phase_angle",
56+
"Bin": "bin",
57+
}
58+
59+
for df_var, xr_var in vars_to_compare.items():
60+
good_values = df[df_var].values != -1
61+
np.testing.assert_array_equal(
62+
df[df_var].values[good_values],
63+
decom_ultra[xr_var].values[good_values],
64+
)

0 commit comments

Comments
 (0)