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

Look up in cherab.core.atomic.elements instead of using _popular_species and _species_symbol_map dicts #33

Closed
vsnever opened this issue Sep 3, 2020 · 4 comments · Fixed by #35

Comments

@vsnever
Copy link
Member

vsnever commented Sep 3, 2020

I suggest that instead of using _popular_species dict when reading the data from raw or balance files, we should search for the matches in cherab.core.atomic.elements. First, get all isotopes with a given nuclear charge, second, from them find the one with the closest atomic mass to the given one.

Similarly, _species_symbol_map dict must be replaced with the search for the matching element symbol in cherab.core.atomic.elements. Extracting the nuclear charge from the balance file also must be improved the same way.

@CnlPepper
Copy link
Member

I built these search functions to simplify element handling:

https://github.com/cherab/core/blob/d58c8c26470209be9643a8c23b9dc9385bbe30e9/cherab/core/atomic/elements.pyx#L136

You can lookup the element by name, atomic number etc....

@vsnever
Copy link
Member Author

vsnever commented Sep 3, 2020

Yes @CnlPepper, it's exactly what I was looking for, thank you. I'll update the code and make the PR then.

@jacklovell, could you please provide me with any balance.nc file for testing? All examples in SOLPS-ITER are in md5.

@vsnever
Copy link
Member Author

vsnever commented Sep 3, 2020

Current representation of species in SOLPSSimulation class as a list of strings (symbol + charge) in unsafe. Let's say we have He3 in the plasma, for the neutral He3, re.match(_SPECIES_REGEX, sp).groups() will return ('He', 30). It's better to keep the species as the list of (symbol, charge) tuples or even (Element/Isotope, charge) tuples. In the latter case, we can avoid try-except for Element/Isotope when initialising Species.

@vsnever
Copy link
Member Author

vsnever commented Apr 6, 2021

Fixed in #35.

@vsnever vsnever closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants