Skip to content
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

Refactor parsing of results files #176

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

wtbarnes
Copy link
Member

@wtbarnes wtbarnes commented Nov 4, 2024

Fixes #86

This pull requests does a few things though is mainly focused on refactoring the parsing of the results files to try and simplify things:

  • Move all file parsing logic to standalone functions in pydrad/parse/util.py that return astropy.table.QTable objects rather than arrays
  • Properties on Strand are only dynamically generated if there are many of them or if they are unknown ahead of time (e.g. for the .ine files). Otherwise they are explicitly listed on Profile.
  • Quantities are now pulled out of the resulting tables by column name rather than relying on indexing an array. This should be more robust.
  • All results files are now optional except for the .amr files. If the .phy files are not read (or not present), the thermodynamic quantities are computed from the conserved quantities in the .amr files. See Function for calculating thermodynamic variables from conserved variables #86.

TODOs:

  • Docstrings for quantities on Profile
  • Create issue to track case where .amr file has an additional column for the electron mass density

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 44 lines in your changes missing coverage. Please review.

Project coverage is 71.50%. Comparing base (557e41a) to head (16cbbdd).

Files with missing lines Patch % Lines
pydrad/parse/util.py 60.00% 18 Missing ⚠️
pydrad/parse/parse.py 87.71% 14 Missing ⚠️
pydrad/configure/configure.py 10.00% 9 Missing ⚠️
pydrad/visualize/animate.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #176      +/-   ##
==========================================
+ Coverage   70.41%   71.50%   +1.08%     
==========================================
  Files          11       13       +2     
  Lines         730      800      +70     
==========================================
+ Hits          514      572      +58     
- Misses        216      228      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wtbarnes wtbarnes marked this pull request as draft November 4, 2024 22:09
@wtbarnes wtbarnes changed the title Minor refactoring of parsing and configuration Refactor parsing of results files Nov 7, 2024
@wtbarnes wtbarnes requested a review from jwreep November 7, 2024 20:22
@wtbarnes wtbarnes marked this pull request as ready for review November 7, 2024 20:22
pydrad/parse/util.py Outdated Show resolved Hide resolved
pydrad/configure/configure.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/parse.py Outdated Show resolved Hide resolved
pydrad/parse/util.py Outdated Show resolved Hide resolved
pydrad/parse/util.py Show resolved Hide resolved
@wtbarnes wtbarnes requested a review from jwreep December 2, 2024 21:56
Copy link
Member

@jwreep jwreep left a comment

Choose a reason for hiding this comment

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

A few minor suggestions that you can ignore if you want. This looks otherwise fine to me! Thanks for putting this together.

pydrad/parse/parse.py Show resolved Hide resolved
pydrad/parse/parse.py Show resolved Hide resolved
pydrad/parse/parse.py Show resolved Hide resolved
pydrad/util/constants.py Show resolved Hide resolved
name='average ion mass for a H-He plasma',
value=2.171e-24,
unit='g',
uncertainty=0,
Copy link
Member

Choose a reason for hiding this comment

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

There's definitely an uncertainty, but I don't know what it is!

The uncertainty from the abundance set (likely Feldman) + the uncertainty of the hydrogen and helium masses should propagate.

Perhaps we should make an issue to figure this out? I do like that this has the option of including it!

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I had this thought when I put in 0 for the uncertainty but didn't have any idea as to what this value may be. We can create another issue to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function for calculating thermodynamic variables from conserved variables
2 participants