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

Split the openadas module into atomic repository and OpenADAS parser #377

Draft
wants to merge 28 commits into
base: development
Choose a base branch
from

Conversation

vsnever
Copy link
Member

@vsnever vsnever commented Aug 25, 2022

As discussed in #352 and #364, the user should be able to mix atomic data from different providers in a single local repository. In particular, some data such as the dictionary of spectral line wavelengths and Gaunt factors for bremsstrahlung, which are already distributed, or will be distributed with Cherab, are not taken from OpenADAS. Therefore, following @CnlPepper's advice, this PR splits the old opeanadas module into two components: the atomic module for working with a local json repository, and the new openadas module for parsing ADAS files and installing them in a local repository.

The list of changes includes:

  1. openadas.repository is moved to atomic.repository,
  2. openadas.rates is moved to atomic.rates,
  3. openadas/openadas.py is moved to atomic/atomicdata.py and OpenADAS() class is renamed to AtomicData().
  4. Default path to atomic data repository changed to ~/.cherab/atomicdata/default_repository.
  5. For backward compatibility, openadas.repository, openadas.rates and openadas.OpenADAS() now redirect to atomic.repository, atomic.rates and atomic.AtomicData() respectively.
  6. All AtomicData() methods now search for the isotope data, and fallback to the element data only if the isotope data is missing. This behaviour is controlled by the rate_element_fallback argument, which is set to True by default.
  7. Docstrings of the functions in the atomic.repository and openadas.install are improved. The new sections "Atomic data repository" and "Open-ADAS" are added to the documentation under the "Atomic Data" section.
  8. All demos are updated to use the new AtomicData() interface.

Of course, the format for representing the atomic rates in the local repository is very specific to ADAS. In the future, this format can be generalised. For example, parameters such as interpolation type or the order of coordinates for interpolation should also be stored in json. I think that a fairly general format for representing atomic and molecular data in ITER IMAS, AMNS_data IDS, can serve as a guide here.

P.S. I used git mv for all moved files, but for some reason (too many changes?) git treats some of those files as new.

@vsnever
Copy link
Member Author

vsnever commented Aug 10, 2023

I've added support for the CHERAB_ATOMIC_DATA environment variable from #416.

The PR #5 in cherab-adas demonstrates how much simpler the subpackage will become after this PR is accepted.

Since #400 and #415 add new atomic data, I will need to make additional changes after they are accepted.

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

Successfully merging this pull request may close these issues.

None yet

2 participants