Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions imap_processing/cdf/config/imap_ultra_global_cdf_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,54 @@ imap_ultra_l1a_90sensor-energy-de:
Logical_source: imap_ultra_l1a_90sensor-energy-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Energy Direct Event Data.

imap_ultra_l1a_45sensor-priority-1-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_1_DE>Level-1A Priority 1 Direct Event
Logical_source: imap_ultra_l1a_45sensor-priority-1-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 1 Direct Event Data.

imap_ultra_l1a_90sensor-priority-1-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_1_DE>Level-1A Priority 1 Direct Event
Logical_source: imap_ultra_l1a_90sensor-priority-1-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 1 Direct Event Data.

imap_ultra_l1a_45sensor-priority-2-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_2_DE>Level-1A Priority 2 Direct Event
Logical_source: imap_ultra_l1a_45sensor-priority-2-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 2 Direct Event Data.

imap_ultra_l1a_90sensor-priority-2-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_2_DE>Level-1A Priority 2 Direct Event
Logical_source: imap_ultra_l1a_90sensor-priority-2-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 2 Direct Event Data.

imap_ultra_l1a_45sensor-priority-3-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_3_DE>Level-1A Priority 3 Direct Event
Logical_source: imap_ultra_l1a_45sensor-priority-3-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 3 Direct Event Data.

imap_ultra_l1a_90sensor-priority-3-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_3_DE>Level-1A Priority 3 Direct Event
Logical_source: imap_ultra_l1a_90sensor-priority-3-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 3 Direct Event Data.

imap_ultra_l1a_45sensor-priority-4-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_4_DE>Level-1A Priority 4 Direct Event
Logical_source: imap_ultra_l1a_45sensor-priority-4-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 4 Direct Event Data.

imap_ultra_l1a_90sensor-priority-4-de:
<<: *instrument_base
Data_type: L1A_PRIORITY_4_DE>Level-1A Priority 4 Direct Event
Logical_source: imap_ultra_l1a_90sensor-priority-4-de
Logical_source_description: IMAP-Ultra Instrument Level-1A Priority 4 Direct Event Data.

imap_ultra_l1b_45sensor-de:
<<: *instrument_base
Data_type: L1B_45Sensor-DE>Level-1B Direct Events for Ultra45
Expand Down
4 changes: 4 additions & 0 deletions imap_processing/tests/external_test_data_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@
("IMAP-Ultra45_r1_L1_V0_shortened.csv", "ultra/data/l1/"),

# Ultra
("FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.CCSDS", "ultra/data/l0/"),
("ultra45_raw_sc_rawnrgevnt_19840122_00.csv", "ultra/data/l0/"),
("ultra45_raw_sc_imgpriority1evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
("ultra45_raw_sc_imgpriority2evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
Comment thread
laspsandoval marked this conversation as resolved.
("ultra45_raw_sc_imgpriority3evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
("ultra45_raw_sc_imgpriority4evnt_FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.csv", "ultra/data/l0/"),
("ultra45_raw_sc_ultranrgrates_FM45_UltraFM45_Functional_"
"2024-01-22T0105_20240122T010548.csv", "ultra/data/l0/"),
("imap_ultra_l0_raw_20260924_v001.pkts", "ultra/data/l0/"),
Expand Down
25 changes: 25 additions & 0 deletions imap_processing/tests/ultra/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
ULTRA_ENERGY_EVENTS,
ULTRA_ENERGY_RATES,
ULTRA_EVENTS,
ULTRA_PRI_1_EVENTS,
ULTRA_PRI_2_EVENTS,
ULTRA_PRI_3_EVENTS,
ULTRA_PRI_4_EVENTS,
ULTRA_RATES,
ULTRA_TOF,
)
Expand Down Expand Up @@ -102,6 +106,19 @@ def ccsds_path_functional():
)


@pytest.fixture
def ccsds_path_extra():
"""Returns the ccsds directory."""
return (
imap_module_directory
/ "tests"
/ "ultra"
/ "data"
/ "l0"
/ "FM45_UltraFM45Extra_TV_Tests_2024-01-22T0930_20240122T093008.CCSDS"
)


@pytest.fixture
def xtce_path():
"""Returns the xtce image rates directory."""
Expand Down Expand Up @@ -178,6 +195,14 @@ def decom_test_data(request, xtce_path):
ULTRA_ENERGY_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_1_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_1_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_2_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_2_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_3_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_3_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_4_EVENTS.apid[0]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_PRI_4_EVENTS.apid[1]: lambda ds, apid: process_ultra_events(ds, apid),
ULTRA_RATES.apid[0]: lambda ds, apid: process_ultra_rates(ds),
ULTRA_RATES.apid[1]: lambda ds, apid: process_ultra_rates(ds),
ULTRA_ENERGY_RATES.apid[0]: lambda ds, apid: process_ultra_energy_rates(ds),
Expand Down
63 changes: 63 additions & 0 deletions imap_processing/tests/ultra/unit/test_decom_apid_898.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import numpy as np
import pandas as pd
import pytest

from imap_processing import imap_module_directory


@pytest.mark.parametrize(
"decom_test_data",
[
pytest.param(
{
"apid": 898,
"filename": "FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.CCSDS",
}
)
],
indirect=True,
)
@pytest.mark.external_test_data
def test_image_raw_events_decom(decom_test_data, xtce_path):
"""This function reads validation data and checks that decom data
matches validation data for image rate packet"""
filename = (
"ultra45_raw_sc_imgpriority1evnt_FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.csv"
)
priority_1_events_test_path = (
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
)

decom_ultra = decom_test_data
df = pd.read_csv(priority_1_events_test_path, index_col="MET")

vars_to_compare = {
"SID": "sid",
"Spin": "spin",
"AbortFlag": "abortflag",
"StartDelay": "startdelay",
"Count": "count",
"CoinType": "coin_type",
"StartType": "start_type",
"StopType": "stop_type",
"StartPosTDC": "start_pos_tdc",
"StopNorthTDC": "stop_north_tdc",
"StopEastTDC": "stop_east_tdc",
"StopSouthTDC": "stop_south_tdc",
"StopWestTDC": "stop_west_tdc",
"CoinNorthTDC": "coin_north_tdc",
"CoinSouthTDC": "coin_south_tdc",
"CoinDiscreteTDC": "coin_discrete_tdc",
"EnergyOrPH": "energy_ph",
"PulseWidth": "pulse_width",
"PhaseAngle": "phase_angle",
"Bin": "bin",
}

for df_var, xr_var in vars_to_compare.items():
good_values = df[df_var].values != -1
np.testing.assert_array_equal(
df[df_var].values[good_values], decom_ultra[xr_var].values[good_values]
)
64 changes: 64 additions & 0 deletions imap_processing/tests/ultra/unit/test_decom_apid_899.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import numpy as np
import pandas as pd
import pytest

from imap_processing import imap_module_directory


@pytest.mark.parametrize(
"decom_test_data",
[
pytest.param(
{
"apid": 899,
"filename": "FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.CCSDS",
}
)
],
indirect=True,
)
@pytest.mark.external_test_data
def test_image_raw_events_decom(decom_test_data, xtce_path):
"""This function reads validation data and checks that decom data
matches validation data for image rate packet"""
filename = (
"ultra45_raw_sc_imgpriority2evnt_FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.csv"
)
priority_2_events_test_path = (
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
)

decom_ultra = decom_test_data
df = pd.read_csv(priority_2_events_test_path, index_col="MET")

vars_to_compare = {
"SID": "sid",
"Spin": "spin",
"AbortFlag": "abortflag",
"StartDelay": "startdelay",
"Count": "count",
"CoinType": "coin_type",
"StartType": "start_type",
"StopType": "stop_type",
"StartPosTDC": "start_pos_tdc",
"StopNorthTDC": "stop_north_tdc",
"StopEastTDC": "stop_east_tdc",
"StopSouthTDC": "stop_south_tdc",
"StopWestTDC": "stop_west_tdc",
"CoinNorthTDC": "coin_north_tdc",
"CoinSouthTDC": "coin_south_tdc",
"CoinDiscreteTDC": "coin_discrete_tdc",
"EnergyOrPH": "energy_ph",
"PulseWidth": "pulse_width",
"PhaseAngle": "phase_angle",
"Bin": "bin",
}

for df_var, xr_var in vars_to_compare.items():
good_values = df[df_var].values != -1
np.testing.assert_array_equal(
df[df_var].values[good_values],
decom_ultra[xr_var].values[good_values],
)
64 changes: 64 additions & 0 deletions imap_processing/tests/ultra/unit/test_decom_apid_900.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import numpy as np
import pandas as pd
import pytest

from imap_processing import imap_module_directory


@pytest.mark.parametrize(
"decom_test_data",
[
pytest.param(
{
"apid": 900,
"filename": "FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.CCSDS",
}
)
],
indirect=True,
)
@pytest.mark.external_test_data
def test_image_raw_events_decom(decom_test_data, xtce_path):
"""This function reads validation data and checks that decom data
matches validation data for image rate packet"""
filename = (
"ultra45_raw_sc_imgpriority3evnt_FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.csv"
)
priority_3_events_test_path = (
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
)

decom_ultra = decom_test_data
df = pd.read_csv(priority_3_events_test_path, index_col="MET")

vars_to_compare = {
"SID": "sid",
"Spin": "spin",
"AbortFlag": "abortflag",
"StartDelay": "startdelay",
"Count": "count",
"CoinType": "coin_type",
"StartType": "start_type",
"StopType": "stop_type",
"StartPosTDC": "start_pos_tdc",
"StopNorthTDC": "stop_north_tdc",
"StopEastTDC": "stop_east_tdc",
"StopSouthTDC": "stop_south_tdc",
"StopWestTDC": "stop_west_tdc",
"CoinNorthTDC": "coin_north_tdc",
"CoinSouthTDC": "coin_south_tdc",
"CoinDiscreteTDC": "coin_discrete_tdc",
"EnergyOrPH": "energy_ph",
"PulseWidth": "pulse_width",
"PhaseAngle": "phase_angle",
"Bin": "bin",
}

for df_var, xr_var in vars_to_compare.items():
good_values = df[df_var].values != -1
np.testing.assert_array_equal(
df[df_var].values[good_values],
decom_ultra[xr_var].values[good_values],
)
64 changes: 64 additions & 0 deletions imap_processing/tests/ultra/unit/test_decom_apid_901.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import numpy as np
import pandas as pd
import pytest

from imap_processing import imap_module_directory


@pytest.mark.parametrize(
"decom_test_data",
[
pytest.param(
{
"apid": 901,
"filename": "FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.CCSDS",
}
)
],
indirect=True,
)
@pytest.mark.external_test_data
def test_image_raw_events_decom(decom_test_data, xtce_path):
"""This function reads validation data and checks that decom data
matches validation data for image rate packet"""
filename = (
"ultra45_raw_sc_imgpriority4evnt_FM45_UltraFM45Extra_TV_Tests_"
"2024-01-22T0930_20240122T093008.csv"
)
priority_4_events_test_path = (
imap_module_directory / "tests" / "ultra" / "data" / "l0" / filename
)

decom_ultra = decom_test_data
df = pd.read_csv(priority_4_events_test_path, index_col="MET")

vars_to_compare = {
"SID": "sid",
"Spin": "spin",
"AbortFlag": "abortflag",
"StartDelay": "startdelay",
"Count": "count",
"CoinType": "coin_type",
"StartType": "start_type",
"StopType": "stop_type",
"StartPosTDC": "start_pos_tdc",
"StopNorthTDC": "stop_north_tdc",
"StopEastTDC": "stop_east_tdc",
"StopSouthTDC": "stop_south_tdc",
"StopWestTDC": "stop_west_tdc",
"CoinNorthTDC": "coin_north_tdc",
"CoinSouthTDC": "coin_south_tdc",
"CoinDiscreteTDC": "coin_discrete_tdc",
"EnergyOrPH": "energy_ph",
"PulseWidth": "pulse_width",
"PhaseAngle": "phase_angle",
"Bin": "bin",
}

for df_var, xr_var in vars_to_compare.items():
good_values = df[df_var].values != -1
np.testing.assert_array_equal(
df[df_var].values[good_values],
decom_ultra[xr_var].values[good_values],
)
Loading