-
Notifications
You must be signed in to change notification settings - Fork 33
Ultra l1a - added cdf for apid 882 #1854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
laspsandoval
merged 5 commits into
IMAP-Science-Operations-Center:dev
from
laspsandoval:ialirt_cdf_updates
Jun 27, 2025
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,50 @@ | ||
| import json | ||
|
|
||
| import numpy as np | ||
| import pandas as pd | ||
| import pytest | ||
|
|
||
| from imap_processing.ultra.l0.ultra_utils import ENERGY_RATES_KEYS, ULTRA_ENERGY_RATES | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "decom_test_data", | ||
| [ | ||
| pytest.param( | ||
| { | ||
| "apid": ULTRA_ENERGY_RATES.apid[0], | ||
| "filename": "FM45_UltraFM45_Functional_" | ||
| "2024-01-22T0105_20240122T010548.CCSDS", | ||
| } | ||
| ) | ||
| ], | ||
| indirect=True, | ||
| ) | ||
| def test_image_rate_decom(decom_test_data, energy_rates_test_path): | ||
| """This function reads validation data and checks that decom data | ||
| matches validation data for image rate packet""" | ||
| decom_ultra = decom_test_data | ||
|
|
||
| df = pd.read_csv(energy_rates_test_path, index_col="MET") | ||
| total_packets = 315 | ||
|
|
||
| np.testing.assert_array_equal(df.SID, decom_ultra["sid"]) | ||
| 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"]) | ||
|
|
||
| # Spot-check first packet | ||
| t0 = decom_ultra["shcoarse"][0] | ||
| expected_arr0 = json.loads(df.loc[int(t0)].Counts) | ||
| arr = [] | ||
| for name in ENERGY_RATES_KEYS: | ||
| arr.append(decom_ultra[name][0]) | ||
| assert expected_arr0 == arr | ||
|
|
||
| # Spot-check last packet | ||
| tn = decom_ultra["shcoarse"][total_packets - 1] | ||
| expected_arrn = json.loads(df.loc[int(tn)].Counts) | ||
| arr = [] | ||
| for name in ENERGY_RATES_KEYS: | ||
| arr.append(decom_ultra[name][total_packets - 1]) | ||
| assert expected_arrn == arr |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very close to the above function. If you are going to be doing this on other rate-type packets too it might be good to abstract the boilerplate stuff out and pass in the apid/enum to do the lookup of the packet-specific things within a common function instead of needing to duplicate all the looping/logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I know. This is the last rates packet, though.