fsciortino / Aurora

Modern toolbox for impurity transport, neutrals and radiation modeling in magnetically-confined plasmas
https://aurora-fusion.readthedocs.io
MIT License
39 stars 23 forks source link

Identical wavelength for different transitions in the same file #48

Open Didou09 opened 2 years ago

Didou09 commented 2 years ago

Motivations:

Current behaviour:

On python 3.7.11, the behaviour when fed several times the same key is that the dict will only retain the last provided value:

In [1]: {0: 1, 0: 2}
Out[1]: {0: 2}

It means that in its current version, aurora, when confronted with several transitions of identical wavelengths, will only provide the one it encounters last in the file.

Example:

Didou09 commented 2 years ago

Hi @fsciortino , thanks for the update on master.

Using it raised one error, that I corrected on my fork of aurora, and then a second error occured, that I also corrected on my fork.

Then it works, but I started thinking that when a line wavelength is shifted, the code should raise a warning so the user knows it, so I implemented the warning.

Using that version of the code revealed that there are actually many lines with redundant wavelengths.

So I implemented a more synthetic warning that is raised only once and gives the list of all redundant wavelengths (ordered according to the wavelength).

For file pec#ar15.dat here is the result: 183 lines have redundant wavelength.

In [11]: import aurora

In [12]: filepath_li = '/Home/DV226270/Diag_XICS/Atomic_data/Aurora/pec#ar15.dat'

In [13]: di = aurora.read_adf15(filepath_li)

image

I see at least 2 causes for concern:

  1. you will notice that more than 2 transitions can share the same wavelength => shifting the wavelength by +1e-6 A is not enough, because when 3 lines have the same wavelength, 2 of them will remain redundant (both shifted by 1e-6 A, so still equal) => Incremental shifts may fix that
  2. you will see that some different lines can, unfortunately,be separated by ...1e-6 A. => If lines a and b share the same wavelength lam, and line c has wavelength lam+1.e-6, if line b is shifted by 1.e-6 A, it will become redundant with line c, which originally, was not redundant with any other line.

Thoughts on this:

Proposition: