diff --git a/CHANGELOG.md b/CHANGELOG.md index 9da11db2..13202802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/cherab/openadas/parse/adf15.py b/cherab/openadas/parse/adf15.py index b9fe42be..51bbcf6b 100644 --- a/cherab/openadas/parse/adf15.py +++ b/cherab/openadas/parse/adf15.py @@ -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'):