Skip to content

Commit 3fabb69

Browse files
authored
FIX: The golden triple calculation needs to check mode bit == 1 (IMAP-Science-Operations-Center#2623)
This was a bug identified in computing the golden triples identified by the Lo team where the mode bit was being checked incorrectly when updating the TOF1 value.
1 parent 3b6f99d commit 3fabb69

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

imap_processing/lo/l1b/lo_l1b.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,8 @@ def calculate_tof1_for_golden_triples(l1a_de: xr.Dataset) -> xr.Dataset:
828828
The L1A DE dataset with the TOF1 calculated for golden triples.
829829
"""
830830
for idx, coin_type in enumerate(l1a_de["coincidence_type"].values):
831-
if coin_type == 0 and l1a_de["mode"][idx] == 0:
831+
# NOTE: mode bit of 1 is used to identify golden triple (event was compressed)
832+
if coin_type == 0 and l1a_de["mode"][idx] == 1:
832833
# Calculate TOF1
833834
# TOF1 equation requires values to be right bit shifted. These values were
834835
# originally right bit shifted when packed in the telemetry packet, but were

imap_processing/tests/lo/test_lo_l1b.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def test_calculate_tof1_for_golden_triples():
581581
"coincidence_type": ("epoch", [0, 0, 0]),
582582
"mode": ("epoch", [0, 0, 1]),
583583
"tof0": ("epoch", [2, 4, 2]),
584-
"tof1": ("epoch", [42, 36, 0]),
584+
"tof1": ("epoch", [0, 0, 42]),
585585
"tof2": ("epoch", [2, 6, 2]),
586586
"tof3": ("epoch", [2, 8, 2]),
587587
"cksm": ("epoch", [2, 12, 2]),
@@ -592,7 +592,7 @@ def test_calculate_tof1_for_golden_triples():
592592
l1a_de = calculate_tof1_for_golden_triples(l1a_de)
593593

594594
# Assert
595-
assert l1a_de_expected.equals(l1a_de)
595+
xr.testing.assert_equal(l1a_de, l1a_de_expected)
596596

597597

598598
def test_set_coincidence_type(attr_mgr_l1a):

0 commit comments

Comments
 (0)