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
22 changes: 7 additions & 15 deletions imap_processing/ialirt/l0/process_hit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
find_groups,
)
from imap_processing.ialirt.utils.time import calculate_time
from imap_processing.spice.time import met_to_ttj2000ns, met_to_utc
from imap_processing.spice.time import met_to_ttj2000ns

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -132,6 +132,7 @@ def process_hit(xarray_data: xr.Dataset) -> list[dict]:
"""
hit_data = []
incomplete_groups = []
status_groups = []

# Subsecond time conversion specified in 7516-9054 GSW-FSW ICD.
# Value of SCLK subseconds, unsigned, (LSB = 1/256 sec)
Expand All @@ -151,12 +152,7 @@ def process_hit(xarray_data: xr.Dataset) -> list[dict]:
]

if np.any(status_values == 0):
logger.info(
f"Off-nominal value detected at "
f"missing or duplicate pkt_counter values: "
f"{group}"
)
continue
status_groups.append(group)

# Subcom values for the group should be 0-59 with no duplicates.
subcom_values = grouped_data["hit_subcom"][
Expand All @@ -172,14 +168,6 @@ def process_hit(xarray_data: xr.Dataset) -> list[dict]:
grouped_data["hit_met"][(grouped_data["group"] == group).values].values[0]
)

status_values = grouped_data["hit_status"][
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting was this a duplicate check here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But also they want to produce data even if the status is not nominal. So that's what this ticket is about.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool yeah that part makes sense.

(grouped_data["group"] == group).values
]

if np.any(status_values == 0):
logger.info(f"Off-nominal value detected at {met_to_utc(hit_met)}")
continue

fast_rate_1 = grouped_data["hit_fast_rate_1"][
(grouped_data["group"] == group).values
]
Expand Down Expand Up @@ -227,5 +215,9 @@ def process_hit(xarray_data: xr.Dataset) -> list[dict]:
f"missing or duplicate pkt_counter values: "
f"{incomplete_groups}"
)
if status_groups:
logger.warning(
f"The following hit groups have zero status values: {status_groups}"
)

return hit_data
4 changes: 2 additions & 2 deletions imap_processing/tests/ialirt/unit/test_process_hit.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ def test_process_hit(xarray_data, caplog):

# Tests that it functions normally
hit_product = process_hit(xarray_data)
assert len(hit_product) == 1
assert len(hit_product) == 15

assert hit_product[0]["hit_e_a_side_low_en"] == 0
assert hit_product[0]["hit_e_a_side_med_en"] == 0
assert hit_product[0]["hit_e_b_side_low_en"] == 0
assert hit_product[0]["hit_e_b_side_high_en"] == 0
assert hit_product[0]["hit_e_b_side_med_en"] == 1
assert hit_product[0]["hit_e_b_side_med_en"] == 0
assert hit_product[0]["hit_he_omni_high_en"] == 0


Expand Down
Loading