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

Improve parsing of the ADF15 metadata for H-like ions. #425

Merged
merged 3 commits into from
Dec 1, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ New:
* Add numerical integration of Bremsstrahlung spectrum over a spectral bin. (#395)
* Replace the coarse numerical constant in the Bremsstrahlung model with an exact expression. (#409)
* Add the kind attribute to RayTransferPipelineXD that determines whether the ray transfer matrix is multiplied by sensitivity ('power') or not ('radiance'). (#412)
* Improved parsing of metadata from the ADAS ADF15 'bnd' files for H-like ions. Raises a runtime error if the metadata cannot be parsed. (#424)

Bug fixes:
* Fix deprecated transforms being cached in LaserMaterial after laser.transform update (#420)
Expand Down
10 changes: 9 additions & 1 deletion cherab/openadas/parse/adf15.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,19 @@ def parse_adf15(element, charge, adf_file_path, header_format=None):
# use simple electron configuration structure for hydrogen-like ions
if header_format == 'hydrogen' or element == hydrogen:
config = _scrape_metadata_hydrogen(file, element, charge)
elif header_format == 'hydrogen-like' or element.atomic_number - charge == 1:
elif header_format == 'hydrogen-like':
config = _scrape_metadata_hydrogen_like(file, element, charge)
elif element.atomic_number - charge == 1:
config = _scrape_metadata_hydrogen_like(file, element, charge)
if not config and 'bnd#' in adf_file_path:
# ADF15 files with the "bnd" suffix may have metadata in the "hydrogen" format
config = _scrape_metadata_hydrogen(file, element, charge)
else:
config = _scrape_metadata_full(file, element, charge)

if not config:
raise RuntimeError("Unable to parse ADF15 metadata.")

Comment on lines +80 to +82
Copy link
Member

Choose a reason for hiding this comment

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

I like this. More obvious failure modes are good.

# process rate data
rates = RecursiveDict()
for cls in ('excitation', 'recombination', 'thermalcx'):
Expand Down
Loading