forked from IMAP-Science-Operations-Center/imap_processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6315472
commit 51254e5
Showing
12 changed files
with
7,056 additions
and
73 deletions.
There are no files selected for viewing
Binary file added
BIN
+177 KB
...est_data/l0/FM45_40P_Phi28p5_BeamCal_LinearScan_phi28.50_theta-0.00_20240207T102740.CCSDS
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
...5_40P_Phi28p5_BeamCal_LinearScan_phi28.50_theta-0.00_ULTRA_AUXILIARY_20240207T102753_.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SHCOARSE,TIMESPINSTART,TIMESPINSTARTSUB,DURATION,SPINNUMBER,TIMESPINDATA,SPINPERIOD,SPINPHASE,SPINPERIODVALID,SPINPHASEVALID,SPINPERIODSOURCE,CATBEDHEATERFLAG,INTS,INTN1,INTN2,HWMODE,IMCENB,LEFTDEFLECTIONCHARGE,RIGHTDEFLECTIONCHARGE | ||
445015650,445015650,0,15000,29667711,445015650,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015665,445015665,0,14999,29667712,445015665,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015680,445015680,0,14999,29667713,445015680,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015694,445015694,999,15001,29667714,445015695,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015710,445015710,1,14998,29667715,445015710,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015725,445015725,0,14999,29667716,445015725,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015739,445015739,999,15001,29667717,445015740,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015755,445015755,1,14998,29667718,445015755,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015770,445015770,0,14999,29667719,445015770,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015784,445015784,999,15001,29667720,445015785,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015800,445015800,1,14998,29667721,445015800,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015815,445015815,0,14999,29667722,445015815,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015829,445015829,999,15001,29667723,445015830,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015845,445015845,1,14998,29667724,445015845,46875,65535,1,1,0,0,1,1,1,0,1,0,0 | ||
445015860,445015860,0,14999,29667725,445015860,46875,65535,1,1,0,0,1,1,1,0,1,0,0 |
3,243 changes: 3,243 additions & 0 deletions
3,243
...Phi28p5_BeamCal_LinearScan_phi28.50_theta-0.00_Ultra_Image_Raw_Event_20240207T102746_.csv
Large diffs are not rendered by default.
Oops, something went wrong.
3,314 changes: 3,314 additions & 0 deletions
3,314
...Cal_LinearScan_phi28.50_theta-0.00_Ultra_Image_Raw_Event_20240207T102746_withFSWcalcs.csv
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
imap_processing/tests/ultra/unit/test_decom_apid_880_theta_0.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
from imap_processing import decom | ||
from imap_processing.ultra.l0.decom_ultra import decom_ultra_apids | ||
from imap_processing.ultra.l0.ultra_utils import ULTRA_AUX | ||
from imap_processing.utils import group_by_apid | ||
|
||
|
||
@pytest.fixture() | ||
def decom_test_data(ccsds_path_theta_0, xtce_path): | ||
"""Read test data from file""" | ||
data_packet_list = decom.decom_packets(ccsds_path_theta_0, xtce_path) | ||
return data_packet_list | ||
|
||
|
||
def test_aux_enumerated(decom_test_data): | ||
"""Test if enumerated values derived correctly""" | ||
|
||
count = 0 # count number of packets with APID 880 | ||
total_packets = 15 | ||
|
||
grouped_data = group_by_apid(decom_test_data) | ||
apid_data = grouped_data[880] | ||
|
||
for packet in apid_data: | ||
assert packet.data["SPINPERIODVALID"].derived_value == "VALID" | ||
assert packet.data["SPINPHASEVALID"].derived_value == "VALID" | ||
assert packet.data["SPINPERIODSOURCE"].derived_value == "SAFING" | ||
assert packet.data["CATBEDHEATERFLAG"].derived_value == "UNFLAGGED" | ||
count += 1 | ||
|
||
assert count == total_packets | ||
|
||
|
||
def test_aux_mode(decom_test_data): | ||
"""Test if enumerated values derived correctly""" | ||
|
||
for packet in decom_test_data: | ||
if packet.header["PKT_APID"].derived_value == 880: | ||
assert packet.data["HWMODE"].derived_value == "MODE0" | ||
assert packet.data["IMCENB"].derived_value == "MODE1" | ||
assert packet.data["LEFTDEFLECTIONCHARGE"].derived_value == "MODE0" | ||
assert packet.data["RIGHTDEFLECTIONCHARGE"].derived_value == "MODE0" | ||
|
||
|
||
def test_aux_decom(ccsds_path_theta_0, xtce_path, aux_test_path_theta_0): | ||
"""This function reads validation data and checks that | ||
decom data matches validation data for auxiliary packet""" | ||
|
||
decom_ultra = decom_ultra_apids(ccsds_path_theta_0, xtce_path, ULTRA_AUX.apid[0]) | ||
df = pd.read_csv(aux_test_path_theta_0, index_col="SHCOARSE") | ||
|
||
np.testing.assert_array_equal(df.TIMESPINSTART, decom_ultra["TIMESPINSTART"]) | ||
np.testing.assert_array_equal(df.TIMESPINSTARTSUB, decom_ultra["TIMESPINSTARTSUB"]) | ||
np.testing.assert_array_equal(df.DURATION, decom_ultra["DURATION"]) | ||
np.testing.assert_array_equal(df.SPINNUMBER, decom_ultra["SPINNUMBER"]) | ||
np.testing.assert_array_equal(df.TIMESPINDATA, decom_ultra["TIMESPINDATA"]) | ||
np.testing.assert_array_equal(df.SPINPERIOD, decom_ultra["SPINPERIOD"]) | ||
np.testing.assert_array_equal(df.SPINPHASE, decom_ultra["SPINPHASE"]) |
59 changes: 59 additions & 0 deletions
59
imap_processing/tests/ultra/unit/test_decom_apid_896_theta_0.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
from imap_processing.cdf.defaults import GlobalConstants | ||
from imap_processing.ultra.l0.decom_ultra import decom_ultra_apids | ||
from imap_processing.ultra.l0.ultra_utils import ULTRA_EVENTS | ||
|
||
|
||
@pytest.fixture() | ||
def decom_ultra(ccsds_path_theta_0, xtce_path): | ||
"""Data for decom_ultra""" | ||
data_packet_list = decom_ultra_apids( | ||
ccsds_path_theta_0, xtce_path, ULTRA_EVENTS.apid[0] | ||
) | ||
# Convert dictionary to DataFrame | ||
decom_ultra_df = pd.DataFrame(data_packet_list) | ||
|
||
# Now apply the filtering | ||
filtered_decom_ultra = decom_ultra_df[ | ||
(decom_ultra_df["COIN_TYPE"] != GlobalConstants.INT_FILLVAL) | ||
] | ||
return filtered_decom_ultra | ||
|
||
|
||
def test_image_raw_events_decom(decom_ultra, events_test_path_theta_0): | ||
"""This function reads validation data and checks that decom data | ||
matches validation data for image rate packet""" | ||
|
||
df = pd.read_csv(events_test_path_theta_0, index_col="TimeTag") | ||
|
||
np.testing.assert_array_equal(df["Spin"], decom_ultra["SPIN"]) | ||
np.testing.assert_array_equal(df["AbortFlag"], decom_ultra["ABORTFLAG"]) | ||
np.testing.assert_array_equal(df["StartDelay"], decom_ultra["STARTDELAY"]) | ||
np.testing.assert_array_equal(df["CoinType"], decom_ultra["COIN_TYPE"]) | ||
np.testing.assert_array_equal(df["StartType"], decom_ultra["START_TYPE"]) | ||
np.testing.assert_array_equal(df["StopType"], decom_ultra["STOP_TYPE"]) | ||
np.testing.assert_array_equal(df["StartPosTDC"], decom_ultra["START_POS_TDC"]) | ||
np.testing.assert_array_equal(df["StopNorthTDC"], decom_ultra["STOP_NORTH_TDC"]) | ||
np.testing.assert_array_equal(df["StopEastTDC"], decom_ultra["STOP_EAST_TDC"]) | ||
np.testing.assert_array_equal(df["StopSouthTDC"], decom_ultra["STOP_SOUTH_TDC"]) | ||
np.testing.assert_array_equal(df["StopWestTDC"], decom_ultra["STOP_WEST_TDC"]) | ||
np.testing.assert_array_equal(df["CoinNorthTDC"], decom_ultra["COIN_NORTH_TDC"]) | ||
np.testing.assert_array_equal(df["CoinSouthTDC"], decom_ultra["COIN_SOUTH_TDC"]) | ||
np.testing.assert_array_equal(df["CoinDiscrete"], decom_ultra["COIN_DISCRETE_TDC"]) | ||
np.testing.assert_array_equal(df["EnergyPH"], decom_ultra["ENERGY_PH"]) | ||
np.testing.assert_array_equal(df["PulseWidth"], decom_ultra["PULSE_WIDTH"]) | ||
np.testing.assert_array_equal(df["Bin"], decom_ultra["BIN"]) | ||
|
||
|
||
def test_image_raw_events_decom_flags(decom_ultra, events_test_path_theta_0): | ||
"""This function reads validation data and checks that decom data | ||
matches validation data for image rate packet""" | ||
|
||
df = pd.read_csv(events_test_path_theta_0, index_col="TimeTag") | ||
|
||
np.testing.assert_array_equal(df["PHCompSL"], decom_ultra["EVENT_FLAG_PHCMPSL"]) | ||
np.testing.assert_array_equal(df["PHCompSR"], decom_ultra["EVENT_FLAG_PHCMPSR"]) | ||
np.testing.assert_array_equal(df["PHCompCD"], decom_ultra["EVENT_FLAG_PHCMPCD"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.