Skip to content

Commit

Permalink
fixed science count tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdhoyt committed Sep 4, 2024
1 parent 7b839e9 commit 8afec33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
28 changes: 3 additions & 25 deletions imap_processing/lo/l1a/lo_l1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,9 @@ def lo_l1a(dependency: Path, data_version: str) -> list[xr.Dataset]:
datasets_by_apid[LoAPID.ILO_SCI_CNT] = add_dataset_attrs(
datasets_by_apid[LoAPID.ILO_SCI_CNT], attr_mgr, logical_source
)
# TEMPORARY: datasets are being removed until the logic
# is written to add the attributes in a future PR. I only
# have one sample dataset containing all the packets so I
# cannot test these easily in isolation
if LoAPID.ILO_SCI_DE in datasets_by_apid:
logical_source = "imap_lo_l1a_de"
del datasets_by_apid[LoAPID.ILO_SCI_DE]
if LoAPID.ILO_SPIN in datasets_by_apid:
logical_source = "imap_lo_l1a_spin"
del datasets_by_apid[LoAPID.ILO_SPIN]
if LoAPID.ILO_STAR in datasets_by_apid:
logical_source = "imap_lo_l1a_star"
del datasets_by_apid[LoAPID.ILO_STAR]
if LoAPID.ILO_APP_NHK in datasets_by_apid:
logical_source = "imap_lo_l1a_nhk"
del datasets_by_apid[LoAPID.ILO_APP_NHK]
if LoAPID.ILO_APP_SHK in datasets_by_apid:
logical_source = "imap_lo_l1a_shk"
del datasets_by_apid[LoAPID.ILO_APP_SHK]
if LoAPID.ILO_BOOT_HK in datasets_by_apid:
logical_source = "imap_lo_l1a_boot"
del datasets_by_apid[LoAPID.ILO_BOOT_HK]

print(datasets_by_apid[LoAPID.ILO_SCI_CNT])
return list(datasets_by_apid.values())

good_apids = [LoAPID.ILO_SCI_CNT]
return [datasets_by_apid[good_apid] for good_apid in good_apids]


def add_dataset_attrs(
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/lo/packet_definitions/lo_xtce.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2940,7 +2940,7 @@
<xtce:Parameter name="ILO_SCI_CNT.SHCOARSE" parameterTypeRef="ILO_SCI_CNT.SHCOARSE" shortDescription="CCSDS Secondary Header MET">
<xtce:LongDescription>CCSDS Secondary Header MET</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="ILO_SCI_CNT.SCI_CNT" parameterTypeRef="ILO_SCI_CNT.SCI_CNT" shortDescription="Binary SCI DE data" />
<xtce:Parameter name="ILO_SCI_CNT.SCI_CNT" parameterTypeRef="ILO_SCI_CNT.SCI_CNT" shortDescription="Binary Science Count data" />
<xtce:Parameter name="ILO_SCI_CNT.CHKSUM" parameterTypeRef="ILO_SCI_CNT.CHKSUM" shortDescription="16-bit CRC checksum">
<xtce:LongDescription>16-bit CRC checksum</xtce:LongDescription>
</xtce:Parameter>
Expand Down
5 changes: 3 additions & 2 deletions imap_processing/tests/lo/test_science_counts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import pytest

from imap_processing import imap_module_directory
Expand Down Expand Up @@ -91,7 +92,7 @@ def test_decompress_8_to_16_bit():
out = decompress(bin_str, bits_per_index, section_start, section_length)

# Assert
assert out == expected
np.testing.assert_equal(out, expected)


def test_decompress_12_to_16_bit():
Expand All @@ -110,4 +111,4 @@ def test_decompress_12_to_16_bit():
out = decompress(bin_str, bits_per_index, section_start, section_length)

# Assert
assert out == expected
np.testing.assert_equal(out, expected)

0 comments on commit 8afec33

Please sign in to comment.