-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add ASCII opacity parser to mean_opacity_photons class. #54
Conversation
+ Add ZhuTableOpacity photon class with Rosseland-Planck databox. + Assume log-log rho-T for DataBox interpolation. + Add ZhuTable variant to opac_photons.hpp. + Add unit test for ZhuTable variant. Notes: - See: Zhaohuan Zhu et al (2021). - The next step is to convert the Zhu ASCII into HDF5 format(s).
@brryan @jonahm-LANL - can't seem to add reviewers - anyway here is a preliminary changeset - thanks for the help! |
+ Use filesystem header to check extention in ctor. + Refactor old ASCII parser to a private function (called if .txt). + Add ZhuTable::Save method and use to add HDF5 file. + Update unit test to parse HDF5 data instead. Thanks to Jonah Miller for the suggestion to use the Save method to create the HDF5 file.
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.
Looks good! Some minor suggestions but overall this seems like a pretty clean implementation. My main suggestion/complaint is to move the data files out of git. If we want to distribute them, we could maybe use github's release machinery. Let's discuss when you have the chance.
singularity-opac/photons/zhu_data/opacitysolar09dustq3p5amax0p1new.txt
Outdated
Show resolved
Hide resolved
Co-authored-by: Jonah Miller <[email protected]>
Co-authored-by: Jonah Miller <[email protected]>
+ Remove Zhu grey table class and unit test. + Replace Zhu data table with toy power-law data table. + Generalize file-based ctor to take ASCII or HDF5 file. + Add sub-test for parsing toy power-law data into MeanOpacity.
e997f50
to
8629b31
Compare
8629b31
to
5706c37
Compare
What do people think about slightly modifying the ASCII format: e.g. extending the header line with min/max density and temperature, so it can be parsed in rather than hard-coded? |
I'm a bit nervous about doing that if the ASCII file is provided by someone else. However, if we assume control of it, that makes complete sense. You could also just demand the min/max densities be provided as inputs? |
That's a fair point - right now, working on adding a preprocessing python script to generate a new file that: verifies the header data, adds the min/max rho-T values to the header calculated from the original file data, and optionally interpolates to a log-log grid in rho-T (if the grid is not log-log already). This might help people vet their data, or provide a starting point. However, we can defer modifying the ASCII that gets parsed in. |
+ (Optionally) interpolate using SciPy interp2d. + Assert logarithmic grids if is_loglog is specified. + Verify number of rho-T points in header in old opacity file. + Add min/max rho-T as metadata to header in new opacity file. Note: this script assumes old ASCII file is in Zhu et al (2021) grey opacity format, which has a Rosseland and Planck column.
Just added the old->new ASCII preprocessing script in the last commit, but left the MeanOpacity class alone. |
+ Make changes to parser name and comments to remove references. + Remove power-law opacity generation script. Note: the new metadata is redundant with the rho-T column data, so either might be removed.
+ Remove rho-T parsing from MeanOpacity loadASCII function. + Update test ASCII data file example_ascii/kap_plaw.txt. Note: non-uniform rho-T data points can be interpolated onto a log-log grid, e.g., with example_ascii/preproc_ascii_opac.py.
Now the |
I'm happy with this. @RyanWollaeger @brryan merge when you feel its ready. |
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.
Few nitpicking comments, otherwise LGTM! Thanks for adding the test and documentation
Co-authored-by: Ben Ryan <[email protected]>
Co-authored-by: Ben Ryan <[email protected]>
(Thanks to BRR for the suggestion.)
mean_opacity_photons.hpp
Databox
, with a 3rd discrete index valued:kap_plaw.txt
).