HajimeKawahara / exojax

🐈 Automatic differentiable spectrum modeling of exoplanets/brown dwarfs using JAX, compatible with NumPyro and JAXopt
http://secondearths.sakura.ne.jp/exojax/
MIT License
45 stars 14 forks source link

H2S downloading #504

Closed HajimeKawahara closed 1 month ago

HajimeKawahara commented 1 month ago

some trouble in downloading H2S from ExoMol

from exojax.spec.api import MdbExomol
from exojax.utils.grids import wavenumber_grid
nu_grid, wav, res = wavenumber_grid(22900,23000,10000, xsmode="premodit", unit="AA")
mdbH2S = MdbExomol(".database/H2S/1H2-32S/AYT2", nurange=nu_grid, gpu_transfer=False)
shirochan:~/exojax/tests/integration/api(h2s_download)>python download_h2s.py
xsmode =  premodit
xsmode assumes ESLOG in wavenumber space: xsmode=premodit
/home/kawahara/exojax/src/exojax/spec/unitconvert.py:62: UserWarning: Both input wavelength and output wavenumber are in ascending order.
  warnings.warn(
======================================================================
The wavenumber grid should be in ascending order.
The users can specify the order of the wavelength grid by themselves.
Your wavelength grid is in ***  descending  *** order
======================================================================
/home/kawahara/exojax/src/exojax/utils/molname.py:179: FutureWarning: e2s will be replaced to exact_molname_exomol_to_simple_molname.
  warnings.warn(
HITRAN exact name= H2(32S)
         => Downloading from http://www.exomol.com/db/H2S/1H2-32S/1H2-32S__H2.broad
Error: Couldn't download .broad file at http://www.exomol.com/db/H2S/1H2-32S/1H2-32S__H2.broad and save.
         => Downloading from http://www.exomol.com/db/H2S/1H2-32S/1H2-32S__He.broad
Error: Couldn't download .broad file at http://www.exomol.com/db/H2S/1H2-32S/1H2-32S__He.broad and save.
         => Downloading from http://www.exomol.com/db/H2S/1H2-32S/1H2-32S__air.broad
Molecule:  H2S
Isotopologue:  1H2-32S
Background atmosphere:  H2
ExoMol database:  None
Local folder:  .database/H2S/1H2-32S/AYT2
Transition files: 
     => File 1H2-32S__AYT2__04000-05000.trans
         => Downloading from http://www.exomol.com/db/H2S/1H2-32S/AYT2/1H2-32S__AYT2__04000-05000.trans.bz2
         => Caching the *.trans.bz2 file to the vaex (*.h5) format. After the second time, it will become much faster.
         => You can deleted the 'trans.bz2' file by hand.
Traceback (most recent call last):
  File "/home/kawahara/exojax/tests/integration/api/download_h2s.py", line 4, in <module>
    mdbH2S = MdbExomol(".database/H2S/1H2-32S/AYT2", nurange=nu_grid, gpu_transfer=False)
  File "/home/kawahara/exojax/src/exojax/spec/api.py", line 113, in __init__
    super().__init__(
  File "/home/kawahara/exojax/src/radis/radis/api/exomolapi.py", line 1207, in __init__
    trans = pickup_gE(
  File "/home/kawahara/exojax/src/radis/radis/api/exomolapi.py", line 463, in pickup_gE
    map_add("E", "eupper", "i_upper")
TypeError: pickup_gE.<locals>.map_add() missing 1 required positional argument: 'trans_key'
HajimeKawahara commented 1 month ago

looks no nu_lines nor eupper in trans.

#          i_upper    i_lower    A           nu_lines    gup    jlower    jupper    elower
0          188754     181910     1.8829e-06  nan         201    32        33        15347.445207
1          98588      103713     0.00040218  nan         117    20        19        8793.510937
2          92997      94594      0.0028331   nan         39     19        19        7483.326462
3          188168     181642     0.0009701   nan         201    32        33        12185.383337
4          17284      16130      5.0657e-05  nan         39     6         6         5303.725302
...        ...        ...        ...         ...         ...    ...       ...       ...
7,808,602  120345     118102     0.00014457  nan         135    22        22        8950.458881
7,808,603  123479     121571     0.002517    nan         47     23        23        4874.571459
7,808,604  30702      31552      2.1178e-09  nan         57     9         9         10341.875442
7,808,605  125231     126822     0.002517    nan         141    23        23        4874.571459
7,808,606  172468     170831     6.8856e-16  nan         183    30        30        7107.444288
HajimeKawahara commented 1 month ago

back to the original trans file:

#          i_upper    i_lower    A           nu_lines
0          188754     181910     1.8829e-06  nan
1          98588      103713     0.00040218  nan
2          92997      94594      0.0028331   nan
3          188168     181642     0.0009701   nan
4          17284      16130      5.0657e-05  nan
...        ...        ...        ...         ...
7,808,602  120345     118102     0.00014457  nan
7,808,603  123479     121571     0.002517    nan
7,808,604  30702      31552      2.1178e-09  nan
7,808,605  125231     126822     0.002517    nan
7,808,606  172468     170831     6.8856e-16  nan

and the state

#        i       E             g    J
0        1       0.0           1    0
1        2       1182.576991   1    0
2        3       2353.964679   1    0
3        4       2614.407743   1    0
4        5       3513.789974   1    0
...      ...     ...           ...  ...
220,613  220614  21625.793216  243  40
220,614  220615  21631.062133  243  40
220,615  220616  21642.306246  243  40
220,616  220617  21647.739589  243  40
220,617  220618  21649.90075   243  40
HajimeKawahara commented 1 month ago

Issue identified from these facts:

HajimeKawahara commented 1 month ago

L463 in exomolapi.py in radis

HajimeKawahara commented 1 month ago
        map_add("E", "eupper", "i_upper")

should be

        trans = map_add(trans, "E", "eupper", "i_upper")
minouHub commented 1 month ago

rerunning the tests and merging. Thanks for catching and correcting that! We will merge soon the develop to solve minor bugs and potentially add atomic spectra functionality.