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

Current radis version is imcompatible with mdbHitemp #435

Closed HajimeKawahara closed 9 months ago

HajimeKawahara commented 10 months ago

Starting to figure out problems.. Related #397

HajimeKawahara commented 10 months ago
from exojax.spec import api
from exojax.utils.grids import wavenumber_grid
nus, wav, r = wavenumber_grid(24000.0, 26000.0, 1000, unit="AA", xsmode="premodit")
mdb = api.MdbHitemp("CO", nus, inherit_dataframe=True)

The code to load hitemp, for instance, the above code, ends up the following error.

Downloading 05_HITEMP2019.par.bz2 for CO (1/1).
Download complete. Parsing CO database to /home/exoplanet01/exojax/tests/integration/api/CO-05_HITEMP2019.hdf5
Traceback (most recent call last):
  File "/home/exoplanet01/exojax/tests/integration/api/api_hitran_hitemp_test.py", line 60, in <module>
    test_Hitemp()
  File "/home/exoplanet01/exojax/tests/integration/api/api_hitran_hitemp_test.py", line 19, in test_Hitemp
    mdb = api.MdbHitemp("CO",nus)
  File "/home/exoplanet01/exojax/src/exojax/spec/api.py", line 768, in __init__
    df = self.load(
  File "/home/exoplanet01/anaconda3/lib/python3.10/site-packages/radis-0.15-py3.10-linux-x86_64.egg/radis/api/dbmanager.py", line 465, in load
    return mgr.load(
  File "/home/exoplanet01/anaconda3/lib/python3.10/site-packages/radis-0.15-py3.10-linux-x86_64.egg/radis/api/hdf5.py", line 374, in load
    df = df[columns]
  File "/home/exoplanet01/anaconda3/lib/python3.10/site-packages/vaex/dataframe.py", line 5403, in __getitem__
    if isinstance(item[0], slice):
IndexError: list index out of range
HajimeKawahara commented 10 months ago

The reason of the above error is not column=None but column=[], then it fails at here

if columns is not None:
    df = df[columns]

so, I modified it just as

if columns is not None and columns != []:
    df = df[columns]

in radis hitemp_load branch.

HajimeKawahara commented 10 months ago

@ykawashima at least in my environment, a small correction of radis/api.hdf5.py solved the loading error. I pushed the correction at hitemp_load branch. Can you check it?

The sample code I used for checking:

from exojax.spec import api
from exojax.utils.grids import wavenumber_grid
nus, wav, r = wavenumber_grid(24000.0, 26000.0, 1000, unit="AA", xsmode="premodit")
mdb = api.MdbHitemp("CO", nus, inherit_dataframe=True)
HajimeKawahara commented 10 months ago

@ykawashima Ah, sorry, this is a different error from one you reported. I couldn't reproduce you error... The below code works in my environement.

from exojax.spec import api
from exojax.utils.grids import wavenumber_grid
nus, wav, r = wavenumber_grid(24000.0, 26000.0, 1000, unit="AA", xsmode="premodit")
mdb = api.MdbHitran("CO", nus, nonair_broadening=True)
HajimeKawahara commented 10 months ago

submitted to Radis PR #636

HajimeKawahara commented 9 months ago

Radis PR 636 merged