Skip to content

Commit

Permalink
Merge pull request #425 from vsnever/fix/adas_pec_hlike_header
Browse files Browse the repository at this point in the history
Improve parsing of the ADF15 metadata for H-like ions.
  • Loading branch information
jacklovell authored Dec 1, 2023
2 parents 25e839f + 7ec2059 commit cd06ea0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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.")

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

0 comments on commit cd06ea0

Please sign in to comment.