-
Notifications
You must be signed in to change notification settings - Fork 16
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
Docstring, variable name, formatting updates to IDEX L1 #799
Docstring, variable name, formatting updates to IDEX L1 #799
Conversation
# Create a large dictionary of values from the FPGA header that need to be | ||
# captured into the CDF file. They are lumped together because they share | ||
# similar attributes. | ||
# Notes about the variables are set here, acting as comments and will also be | ||
# placed into the CDF in the VAR_NOTES attribute. | ||
TRIGGER_DESCRIPTION = namedtuple( | ||
"TRIGGER_DESCRIPTION", | ||
["name", "packet_name"], | ||
) | ||
TRIGGER_DESCRIPTION_DICT = { |
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.
Moved this to the top of the file and made them ALL_CAPS since they are treated as global variables
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.
Nice!
@pytest.fixture(scope="session") | ||
def decom_test_data(): | ||
def decom_test_data() -> xr.Dataset: | ||
"""Return a ``xarray`` dataset containing test data. | ||
|
||
Returns | ||
------- | ||
dataset : xarray.Dataset | ||
A ``xarray`` dataset containing the test data | ||
""" | ||
test_file = Path( | ||
f"{imap_module_directory}/tests/idex/imap_idex_l0_raw_20230725_v001.pkts" | ||
) | ||
return PacketParser(test_file, "001") | ||
return PacketParser(test_file, "001").data |
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.
Many of us have moved function that's shared across tests into tests/<instrument>/conftest.py
. Can you do similar here?
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, good idea!
} # fmt: skip | ||
|
||
|
||
def get_idex_attrs(data_version: str) -> ImapCdfAttributes: |
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.
Moved this function to below all of the Class definitions
@@ -123,34 +104,30 @@ class PacketParser: | |||
data_version : str | |||
The version of the data product being created. | |||
|
|||
Methods | |||
------- | |||
TODO : Add method to generate quicklook plots |
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.
Moved this TODO to the top of the file
_calc_high_sample_resolution(num_samples) | ||
parse_packet(packet) | ||
Calculate the resolution of high samples. | ||
_populate_bit_strings(packet) |
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.
Renamed parse_packet
to _populate_bit_strings
to be more explicit about what the method is doing. Also the words "parse" and "packet" are used a lot elsewhere so it could get confusing.
@pytest.fixture(scope="session") | ||
def decom_test_data(): | ||
def decom_test_data() -> xr.Dataset: | ||
"""Return a ``xarray`` dataset containing test data. | ||
|
||
Returns | ||
------- | ||
dataset : xarray.Dataset | ||
A ``xarray`` dataset containing the test data | ||
""" | ||
test_file = Path( | ||
f"{imap_module_directory}/tests/idex/imap_idex_l0_raw_20230725_v001.pkts" | ||
) | ||
return PacketParser(test_file, "001") | ||
return PacketParser(test_file, "001").data |
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, good idea!
…-Operations-Center#799) * Various updates to docstrings, variable names, formatting * Moved pytest fixture that returns test data to conftest.py
This PR includes various updates to docstrings, variable names, code organization, etc. to just make things a bit more readable and consistent in the IDEX L1 code (in my opinion!)