Open Didou09 opened 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)
I see at least 2 causes for concern:
+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 that1e-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. index_lines=True
by default, and to prefer that kind of indexing everywhere in the code, but obviously that's non-negligible work that may take some time1.e-6 A
(maybe 1.e-10 A
?) to avoid case 2 (even though it theory, it can still happen)
Motivations:
aurora
load spectral lines fromADAS
adf15
files into a dictionary where they are sorted by wavelength (i.e.: the wavelentgth, as a float, is the key of the dictionary)Current behaviour:
On python
3.7.11
, the behaviour when fed several times the same key is that thedict
will only retain the last provided value: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:
Ar16+
, when ones looks for thek
lines, it turns out a different transition with the same wavelength (3.9900 A
) exists in the same filepec#ar15.dat
: