Split the openadas module into atomic repository and OpenADAS parser
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:
openadas.repositoryis moved toatomic.repository,openadas.ratesis moved toatomic.rates,openadas/openadas.pyis moved toatomic/atomicdata.pyandOpenADAS()class is renamed toAtomicData().- Default path to atomic data repository changed to
~/.cherab/atomicdata/default_repository. - For backward compatibility,
openadas.repository,openadas.ratesandopenadas.OpenADAS()now redirect toatomic.repository,atomic.ratesandatomic.AtomicData()respectively. - 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 therate_element_fallbackargument, which is set toTrueby default. - Docstrings of the functions in the
atomic.repositoryandopenadas.installare improved. The new sections "Atomic data repository" and "Open-ADAS" are added to the documentation under the "Atomic Data" section. - 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.
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.
Obviously, this change is too big to make in one PR. I'll break it down into several PRs. The first will affect only the documentation, improving docstrings of the openadas.repository and openadas.install functions and adding respective sections to the docs. The second will split the openadas module into the atomic data repository and the OpenADAS parser modules without adding new functionality. Subsequent PRs will add functions for data manipulation that are not included in OpenADAS and distributed with Cherab.