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

'MdbExomol' object has no attribute 'n_Texp' #519

Closed VectorZhao closed 2 weeks ago

VectorZhao commented 3 weeks ago

package list

(exojax) C:\Users\10923>conda list
# packages in environment at C:\Users\10923\anaconda3\envs\exojax:
#
# Name                    Version                   Build  Channel
annotated-types           0.7.0                    pypi_0    pypi
anyio                     4.2.0           py310haa95532_0
aplus                     0.11.0                   pypi_0    pypi
argon2-cffi               21.3.0             pyhd3eb1b0_0
argon2-cffi-bindings      21.2.0          py310h2bbff1b_0
arviz                     0.19.0                   pypi_0    pypi
asdf                      3.4.0                    pypi_0    pypi
asdf-astropy              0.6.1                    pypi_0    pypi
asdf-coordinates-schemas  0.3.0                    pypi_0    pypi
asdf-standard             1.1.1                    pypi_0    pypi
asdf-transform-schemas    0.5.0                    pypi_0    pypi
asdf-wcs-schemas          0.4.0                    pypi_0    pypi
asteval                   1.0.2                    pypi_0    pypi
astropy                   6.1.2                    pypi_0    pypi
astropy-iers-data         0.2024.8.27.10.28.29          pypi_0    pypi
astroquery                0.4.7                    pypi_0    pypi
asttokens                 2.0.5              pyhd3eb1b0_0
async-lru                 2.0.4           py310haa95532_0
attrs                     23.1.0          py310haa95532_0
babel                     2.11.0          py310haa95532_0
backports-tarfile         1.2.0                    pypi_0    pypi
beautifulsoup4            4.12.3          py310haa95532_0
blake3                    0.4.1                    pypi_0    pypi
bleach                    4.1.0              pyhd3eb1b0_0
blosc2                    2.7.1                    pypi_0    pypi
bqplot                    0.12.43                  pypi_0    pypi
branca                    0.7.2                    pypi_0    pypi
brotli-python             1.0.9           py310hd77b12b_8
bzip2                     1.0.8                h2bbff1b_6
ca-certificates           2024.7.2             haa95532_0
cachetools                5.5.0                    pypi_0    pypi
cantera                   3.0.1                    pypi_0    pypi
certifi                   2024.7.4        py310haa95532_0
cffi                      1.16.0          py310h2bbff1b_1
charset-normalizer        3.3.2              pyhd3eb1b0_0
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.0.0                    pypi_0    pypi
colorama                  0.4.6           py310haa95532_0
comm                      0.2.1           py310haa95532_0
configparser              7.1.0                    pypi_0    pypi
contourpy                 1.3.0                    pypi_0    pypi
corner                    2.2.2                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
cython                    3.0.11                   pypi_0    pypi
dask                      2024.8.1                 pypi_0    pypi
debugpy                   1.6.7           py310hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
dill                      0.3.8                    pypi_0    pypi
dm-tree                   0.1.8                    pypi_0    pypi
exceptiongroup            1.2.0           py310haa95532_0
executing                 0.8.3              pyhd3eb1b0_0
exojax                    1.5.1                    pypi_0    pypi
fastapi                   0.112.2                  pypi_0    pypi
filelock                  3.15.4                   pypi_0    pypi
fonttools                 4.53.1                   pypi_0    pypi
frozendict                2.4.4                    pypi_0    pypi
fsspec                    2024.6.1                 pypi_0    pypi
future                    1.0.0                    pypi_0    pypi
gwcs                      0.21.0                   pypi_0    pypi
h11                       0.14.0                   pypi_0    pypi
h5netcdf                  1.3.0                    pypi_0    pypi
h5py                      3.11.0                   pypi_0    pypi
habanero                  1.2.6                    pypi_0    pypi
hitran-api                1.2.2.2                  pypi_0    pypi
hjson                     3.1.0                    pypi_0    pypi
html5lib                  1.1                      pypi_0    pypi
httptools                 0.6.1                    pypi_0    pypi
idna                      3.7             py310haa95532_0
importlib-metadata        8.4.0                    pypi_0    pypi
ipydatawidgets            4.3.5                    pypi_0    pypi
ipykernel                 6.28.0          py310haa95532_0
ipyleaflet                0.19.2                   pypi_0    pypi
ipympl                    0.9.4                    pypi_0    pypi
ipython                   8.25.0          py310haa95532_0
ipython-genutils          0.2.0                    pypi_0    pypi
ipyvolume                 0.6.3                    pypi_0    pypi
ipyvue                    1.11.1                   pypi_0    pypi
ipyvuetify                1.10.0                   pypi_0    pypi
ipywebrtc                 0.6.0                    pypi_0    pypi
ipywidgets                8.1.5                    pypi_0    pypi
jaraco-classes            3.4.0                    pypi_0    pypi
jaraco-context            6.0.1                    pypi_0    pypi
jaraco-functools          4.0.2                    pypi_0    pypi
jax                       0.4.31                   pypi_0    pypi
jaxlib                    0.4.31                   pypi_0    pypi
jedi                      0.19.1          py310haa95532_0
jinja2                    3.1.4           py310haa95532_0
jmespath                  1.0.1                    pypi_0    pypi
joblib                    1.4.2                    pypi_0    pypi
json-tricks               3.17.3                   pypi_0    pypi
json5                     0.9.6              pyhd3eb1b0_0
jsonschema                4.19.2          py310haa95532_0
jsonschema-specifications 2023.7.1        py310haa95532_0
jupyter-leaflet           0.19.2                   pypi_0    pypi
jupyter-lsp               2.2.0           py310haa95532_0
jupyter_client            8.6.0           py310haa95532_0
jupyter_core              5.7.2           py310haa95532_0
jupyter_events            0.10.0          py310haa95532_0
jupyter_server            2.14.1          py310haa95532_0
jupyter_server_terminals  0.4.4           py310haa95532_1
jupyterlab                4.0.11          py310haa95532_0
jupyterlab-widgets        3.0.13                   pypi_0    pypi
jupyterlab_pygments       0.1.2                      py_0
jupyterlab_server         2.25.1          py310haa95532_0
keyring                   25.3.0                   pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
libffi                    3.4.4                hd77b12b_1
libsodium                 1.0.18               h62dcd97_0
llvmlite                  0.43.0                   pypi_0    pypi
lmfit                     1.3.2                    pypi_0    pypi
locket                    1.0.0                    pypi_0    pypi
lxml                      5.3.0                    pypi_0    pypi
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.3           py310h2bbff1b_0
matplotlib                3.9.2                    pypi_0    pypi
matplotlib-inline         0.1.6           py310haa95532_0
mdurl                     0.1.2                    pypi_0    pypi
mistune                   2.0.4           py310haa95532_0
ml-dtypes                 0.4.0                    pypi_0    pypi
more-itertools            10.4.0                   pypi_0    pypi
mpldatacursor             0.7.1                    pypi_0    pypi
msgpack                   1.0.8                    pypi_0    pypi
multipledispatch          1.0.0                    pypi_0    pypi
nbclient                  0.8.0           py310haa95532_0
nbconvert                 7.10.0          py310haa95532_0
nbformat                  5.9.2           py310haa95532_0
ndcube                    2.2.2                    pypi_0    pypi
ndindex                   1.8                      pypi_0    pypi
nest-asyncio              1.6.0           py310haa95532_0
notebook-shim             0.2.3           py310haa95532_0
numba                     0.60.0                   pypi_0    pypi
numexpr                   2.10.1                   pypi_0    pypi
numpy                     1.26.4                   pypi_0    pypi
numpyro                   0.15.2                   pypi_0    pypi
nvidia-cufft-cu11         10.9.0.58                pypi_0    pypi
openssl                   3.0.14               h827c3e9_0
opt-einsum                3.3.0                    pypi_0    pypi
overrides                 7.4.0           py310haa95532_0
packaging                 24.1            py310haa95532_0
pandas                    2.2.2                    pypi_0    pypi
pandocfilters             1.5.0              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
partd                     1.4.2                    pypi_0    pypi
peakutils                 1.3.5                    pypi_0    pypi
periodictable             1.7.1                    pypi_0    pypi
pillow                    10.4.0                   pypi_0    pypi
pip                       24.2            py310haa95532_0
platformdirs              3.10.0          py310haa95532_0
plotly                    5.23.0                   pypi_0    pypi
progressbar2              4.4.2                    pypi_0    pypi
prometheus_client         0.14.1          py310haa95532_0
prompt-toolkit            3.0.43          py310haa95532_0
prompt_toolkit            3.0.43               hd3eb1b0_0
psutil                    5.9.0           py310h2bbff1b_0
publib                    0.4.0                    pypi_0    pypi
pure_eval                 0.2.2              pyhd3eb1b0_0
py-cpuinfo                9.0.0                    pypi_0    pypi
pyarrow                   17.0.0                   pypi_0    pypi
pycparser                 2.21               pyhd3eb1b0_0
pydantic                  2.8.2                    pypi_0    pypi
pydantic-core             2.20.1                   pypi_0    pypi
pyerfa                    2.0.1.4                  pypi_0    pypi
pygments                  2.15.1          py310haa95532_1
pymiescatt                1.8.1.1                  pypi_0    pypi
pyparsing                 3.1.4                    pypi_0    pypi
pysocks                   1.7.1           py310haa95532_0
python                    3.10.14              he1021f5_1
python-dateutil           2.9.0post0      py310haa95532_2
python-dotenv             1.0.1                    pypi_0    pypi
python-fastjsonschema     2.16.2          py310haa95532_0
python-json-logger        2.0.7           py310haa95532_0
python-utils              3.8.2                    pypi_0    pypi
pythreejs                 2.4.2                    pypi_0    pypi
pytz                      2024.1          py310haa95532_0
pyvo                      1.5.2                    pypi_0    pypi
pywin32                   305             py310h2bbff1b_0
pywin32-ctypes            0.2.3                    pypi_0    pypi
pywinpty                  2.0.10          py310h5da7b33_0
pyyaml                    6.0.1           py310h2bbff1b_0
pyzmq                     25.1.2          py310hd77b12b_0
radis                     0.15.1                   pypi_0    pypi
referencing               0.30.2          py310haa95532_0
requests                  2.32.3          py310haa95532_0
rfc3339-validator         0.1.4           py310haa95532_0
rfc3986-validator         0.1.1           py310haa95532_0
rich                      13.8.0                   pypi_0    pypi
rpds-py                   0.10.6          py310h062c2fa_0
ruamel-yaml               0.18.6                   pypi_0    pypi
ruamel-yaml-clib          0.2.8                    pypi_0    pypi
scipy                     1.14.1                   pypi_0    pypi
seaborn                   0.13.2                   pypi_0    pypi
semantic-version          2.10.0                   pypi_0    pypi
send2trash                1.8.2           py310haa95532_0
setuptools                72.1.0          py310haa95532_0
shapely                   2.0.6                    pypi_0    pypi
six                       1.16.0             pyhd3eb1b0_1
sniffio                   1.3.0           py310haa95532_0
soupsieve                 2.5             py310haa95532_0
specutils                 1.16.0                   pypi_0    pypi
sqlite                    3.45.3               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
starlette                 0.38.2                   pypi_0    pypi
tables                    3.10.1                   pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tenacity                  9.0.0                    pypi_0    pypi
termcolor                 2.4.0                    pypi_0    pypi
terminado                 0.17.1          py310haa95532_0
tinycss2                  1.2.1           py310haa95532_0
tk                        8.6.14               h0416ee5_0
tomli                     2.0.1           py310haa95532_0
toolz                     0.12.1                   pypi_0    pypi
tornado                   6.4.1           py310h827c3e9_0
tqdm                      4.66.5                   pypi_0    pypi
traitlets                 5.14.3          py310haa95532_0
traittypes                0.2.1                    pypi_0    pypi
typing-extensions         4.11.0          py310haa95532_0
typing_extensions         4.11.0          py310haa95532_0
tzdata                    2024.1                   pypi_0    pypi
uncertainties             3.2.2                    pypi_0    pypi
urllib3                   2.2.2           py310haa95532_0
uvicorn                   0.30.6                   pypi_0    pypi
vaex                      4.17.0                   pypi_0    pypi
vaex-astro                0.9.3                    pypi_0    pypi
vaex-core                 4.17.1                   pypi_0    pypi
vaex-hdf5                 0.14.1                   pypi_0    pypi
vaex-jupyter              0.8.2                    pypi_0    pypi
vaex-ml                   0.18.3                   pypi_0    pypi
vaex-server               0.9.0                    pypi_0    pypi
vaex-viz                  0.5.4                    pypi_0    pypi
vc                        14.40                h2eaa2aa_0
vs2015_runtime            14.40.33807          h98bb1dd_0
watchfiles                0.23.0                   pypi_0    pypi
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1           py310haa95532_1
websocket-client          1.8.0           py310haa95532_0
websockets                13.0                     pypi_0    pypi
wheel                     0.43.0          py310haa95532_0
widgetsnbextension        4.0.13                   pypi_0    pypi
win_inet_pton             1.1.0           py310haa95532_0
winpty                    0.4.3                         4
xarray                    2024.7.0                 pypi_0    pypi
xarray-einstats           0.7.0                    pypi_0    pypi
xyzservices               2024.6.0                 pypi_0    pypi
xz                        5.4.6                h8cc25b3_1
yaml                      0.2.5                he774522_0
zeromq                    4.3.5                hd77b12b_0
zipp                      3.20.1                   pypi_0    pypi
zlib                      1.2.13               h8cc25b3_1

Here is the code

# Create an instance of the molecular database for CO (carbon monoxide)
# Parameters: database path, wavenumber range, GPU transfer flag, maximum lower state energy
mdbCO = MdbExomol('.database/CO/12C-16O/Li2015/', nurange=nu_grid, gpu_transfer=False, elower_max=58242.689)

print('N=', len(mdbCO.nu_lines))

# Set the diffusion mode to 0
diffmode = 0

# Create the opacity model for CO using premodit method
# Parameters: molecular database, wavenumber grid, diffusion mode, automatic temperature range, grid resolution
opaCO = OpaPremodit(mdb=mdbCO, nu_grid=nu_grid, diffmode=diffmode, auto_trange=[Tlow, Thigh], dit_grid_resolution=1.0)

# Create an instance of the molecular database for H2O (water vapor)
# Parameters: database path, wavenumber range, GPU transfer flag, critical value, maximum lower state energy
mdbH2O = MdbExomol('.database/H2O/1H2-16O/POKAZATEL', nurange=nu_grid, gpu_transfer=False, crit=1.e-46, elower_max=23726.625476)
# Print the number of spectral lines in the H2O database
print('N=', len(mdbH2O.nu_lines))

# Create the opacity model for H2O using premodit method
# Parameters: molecular database, wavenumber grid, diffusion mode, automatic temperature range, grid resolution
opaH2O = OpaPremodit(mdb=mdbH2O, nu_grid=nu_grid, diffmode=diffmode, auto_trange=[Tlow, Thigh], dit_grid_resolution=1.0, allow_32bit=True)

# CIA (Collision-Induced Absorption) setting for H2-H2 interactions
# Create an instance of the CIA database for H2-H2
cdbH2H2 = CdbCIA('.database/H2-H2_2011.cia', nu_grid)
# Create the opacity model for H2-H2 CIA
opciaH2H2 = OpaCIA(cdb=cdbH2H2, nu_grid=nu_grid)

and the output is

c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\utils\molname.py:178: FutureWarning: e2s will be replaced to exact_molname_exomol_to_simple_molname.
  warnings.warn(
HITRAN exact name= (12C)(16O)
         => Downloading from http://www.exomol.com/db/CO/12C-16O/Li2015/12C-16O__Li2015.def
         => Downloading from http://www.exomol.com/db/CO/12C-16O/Li2015/12C-16O__Li2015.pf
         => Downloading from http://www.exomol.com/db/CO/12C-16O/Li2015/12C-16O__Li2015.states.bz2
         => Downloading from http://www.exomol.com/db/CO/12C-16O/12C-16O__H2.broad
         => Downloading from http://www.exomol.com/db/CO/12C-16O/12C-16O__He.broad
         => Downloading from http://www.exomol.com/db/CO/12C-16O/12C-16O__air.broad
Note: Caching states data to the vaex format. After the second time, it will become much faster.
Molecule:  CO
Isotopologue:  12C-16O
Background atmosphere:  H2
ExoMol database:  None
Local folder:  .database\CO\12C-16O\Li2015
Transition files: 
     => File 12C-16O__Li2015.trans
         => Downloading from http://www.exomol.com/db/CO/12C-16O/Li2015/12C-16O__Li2015.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.
c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\radis\api\exomolapi.py:614: AccuracyWarning: The default broadening parameter (alpha = 0.07 cm^-1 and n = 0.5) are used for J'' > 80 up to J'' = 152
  warnings.warn(
c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\spec\opacalc.py:171: UserWarning: dit_grid_resolution is not None. Ignoring broadening_parameter_resolution.
  warnings.warn(
#        i_upper    i_lower    A          nu_lines      gup    jlower    jupper    elower      Sij0
0        84         42         1.155e-06  2.405586      3      0         1         66960.7124  3.811968891483239e-164
1        83         41         1.161e-06  2.441775      3      0         1         65819.903   9.66302808612315e-162
2        82         40         1.162e-06  2.477774      3      0         1         64654.9206  2.743839242930895e-159
3        81         39         1.159e-06  2.513606      3      0         1         63465.8042  8.733228323835037e-157
4        80         38         1.152e-06  2.549292      3      0         1         62252.5793  3.1152203985525016e-154
...      ...        ...        ...        ...           ...    ...       ...       ...         ...
125,491  306        253        7.164e-10  22147.135424  15     6         7         80.7354     1.8282485560395954e-31
125,492  474        421        9.852e-10  22147.86595   23     10        11        211.4041    2.0425455628245774e-31
125,493  348        295        7.72e-10   22147.897299  17     7         8         107.6424    1.9589545214604644e-31
125,494  432        379        9.056e-10  22148.262711  21     9         10        172.978     2.0662209079393328e-31
125,495  390        337        8.348e-10  22148.273111  19     8         9         138.3903    2.03878272167021e-31
Broadening code level: ['a0']
N= 817
OpaPremodit: params automatically set.
default elower grid trange (degt) file version: 2
Robust range: 293.090818280627 - 5825.6230021434285 K
Tref changed: 296.0K->346.7268608280219K
OpaPremodit: Tref_broadening is set to  948.6832980505134 K
# of reference width grid :  2
# of temperature exponent grid : 2
uniqidx: 100%|██████████| 1/1 [00:00<?, ?it/s]
c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\utils\molname.py:178: FutureWarning: e2s will be replaced to exact_molname_exomol_to_simple_molname.
  warnings.warn(
Premodit: Twt= 1544.9884733632073 K Tref= 346.7268608280219 K
Making LSD:|####################| 100%
HITRAN exact name= H2(16O)
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL.def
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL.pf
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL.states.bz2
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/1H2-16O__H2.broad
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/1H2-16O__He.broad
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/1H2-16O__air.broad
Note: Caching states data to the vaex format. After the second time, it will become much faster.
Molecule:  H2O
Isotopologue:  1H2-16O
Background atmosphere:  H2
ExoMol database:  None
Local folder:  .database\H2O\1H2-16O\POKAZATEL
Transition files: 
     => File 1H2-16O__POKAZATEL__04300-04400.trans
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL__04300-04400.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.
     => File 1H2-16O__POKAZATEL__04400-04500.trans
         => Downloading from http://www.exomol.com/db/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL__04400-04500.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.
#           i_upper    i_lower    A           nu_lines           gup    jlower    jupper    elower        eupper        Sij0
0           430647     446902     0.0013639   4300.0             141    24        23        33894.059312  38194.059312  2.2284708135953441e-94
1           296443     301972     0.00041817  4300.000001        111    18        18        21579.948833  25879.948834  5.316645368654245e-69
2           527690     532029     0.0014096   4300.000001        57     28        28        30159.597077  34459.597078  7.118462470135165e-87
3           751753     753008     0.033149    4300.000000999993  255    42        42        35775.917436  40075.917437  1.0433581011751462e-96
4           668437     671222     0.053839    4300.000004000001  213    35        35        32691.274546  36991.27455   4.597775607061154e-90
...         ...        ...        ...         ...                ...    ...       ...       ...           ...           ...
84,110,812  569068     552518     0.028276    4499.999984999999  61     29        30        26996.937987  31496.937972  6.622392572808052e-79
84,110,813  306035     273384     0.037438    4499.999986999996  111    17        18        33395.656039  37895.656026  4.9576610744933354e-92
84,110,814  517130     521383     0.00014321  4499.999986999999  165    27        27        31413.983698  35913.983685  4.299201337208587e-90
84,110,815  373490     378578     0.0027422   4499.999990999997  129    21        21        29337.412332  33837.412323  1.556823743433284e-84
84,110,816  545830     538533     0.0095634   4499.999996999999  171    28        28        35134.551268  39634.551265  4.163516310403288e-96
Broadening code level: ['a0' 'a1']
N= 5301788
OpaPremodit: params automatically set.
default elower grid trange (degt) file version: 2
Robust range: 293.090818280627 - 5825.6230021434285 K
Tref changed: 296.0K->346.7268608280219K
c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\radis\api\exomolapi.py:1270: UserWarning: The broadening file contains more than one broadening code: ['a0' 'a1']. This feature is NOT implemented yet.
  warnings.warn(
c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\spec\opacalc.py:171: UserWarning: dit_grid_resolution is not None. Ignoring broadening_parameter_resolution.
  warnings.warn(
OpaPremodit: Tref_broadening is set to  948.6832980505134 K

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], [line 22](vscode-notebook-cell:?execution_count=8&line=22)
     [18](vscode-notebook-cell:?execution_count=8&line=18) print('N=', len(mdbH2O.nu_lines))
     [20](vscode-notebook-cell:?execution_count=8&line=20) # Create the opacity model for H2O using premodit method
     [21](vscode-notebook-cell:?execution_count=8&line=21) # Parameters: molecular database, wavenumber grid, diffusion mode, automatic temperature range, grid resolution
---> [22](vscode-notebook-cell:?execution_count=8&line=22) opaH2O = OpaPremodit(mdb=mdbH2O, nu_grid=nu_grid, diffmode=diffmode, auto_trange=[Tlow, Thigh], dit_grid_resolution=1.0, allow_32bit=True)
     [24](vscode-notebook-cell:?execution_count=8&line=24) # CIA (Collision-Induced Absorption) setting for H2-H2 interactions
     [25](vscode-notebook-cell:?execution_count=8&line=25) # Create an instance of the CIA database for H2-H2
     [26](vscode-notebook-cell:?execution_count=8&line=26) cdbH2H2 = CdbCIA('.database/H2-H2_2011.cia', nu_grid)

File c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\spec\opacalc.py:112, in OpaPremodit.__init__(self, mdb, nu_grid, diffmode, broadening_resolution, auto_trange, manual_params, dit_grid_resolution, allow_32bit, wavelength_order, version_auto_trange)
    [109](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:109) self.broadening_parameters_setting()
    [111](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:111) if auto_trange is not None:
--> [112](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:112)     self.auto_setting(auto_trange[0], auto_trange[1])
    [113](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:113) elif manual_params is not None:
    [114](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:114)     self.manual_setting(manual_params[0], manual_params[1], manual_params[2])

File c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\spec\opacalc.py:124, in OpaPremodit.auto_setting(self, Tl, Tu)
    [122](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:122) self.Tmax = Tu
    [123](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:123) self.Tmin = Tl
--> [124](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:124) self.apply_params()

File c:\Users\10923\anaconda3\envs\exojax\lib\site-packages\exojax\spec\opacalc.py:238, in OpaPremodit.apply_params(self)
    [235](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:235) else:
...
--> [223](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:223)     self.n_Texp = mdb.n_Texp
    [224](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:224)     reference_factor = (Tref_original / self.Tref_broadening) ** (self.n_Texp)
    [225](file:///C:/Users/10923/anaconda3/envs/exojax/lib/site-packages/exojax/spec/opacalc.py:225)     self.gamma_ref = mdb.alpha_ref * reference_factor

AttributeError: 'MdbExomol' object has no attribute 'n_Texp'
HajimeKawahara commented 3 weeks ago

@VectorZhao Thanks! can you show me the entire code? for instance, what value did you input to nu_grid?

VectorZhao commented 3 weeks ago

@VectorZhao Thanks! can you show me the entire code? for instance, what value did you input to nu_grid? image

wav_arr = dat['wav'].to_numpy() * 10000

idx = (22250 < wav_arr) * (wav_arr < 23250)
mask = (22920 > wav_arr) + (wav_arr > 22660)
masked = mask*idx

wavd=dat['wav'].values[masked]*10000
flux=dat['flux'].values[masked]
err=dat['error'].values[masked]

nusd = jnp.array(1.e8/wavd)

# Number of points in the wavenumber grid
Nx = 4500

# Create the wavenumber grid for atmospheric radiative transfer calculations
# Parameters: min and max wavelength (in Angstrom) extended by 5 units, number of grid points, 
# unit as Angstrom, cross-section mode as premodit
nu_grid, wav, res = wavenumber_grid(np.min(wavd) - 5.0, np.max(wavd) + 5.0, Nx, unit="AA", xsmode="premodit")

# Set the temperature range for the atmospheric model
Tlow = 300.0  # Lowest temperature in Kelvin
Thigh = 3000.0  # Highest temperature in Kelvin

# Initialize the atmospheric radiative transfer model for emission with pure absorption
# Parameters: wavenumber grid, top pressure (in bar), bottom pressure (in bar), number of layers
art = ArtEmisPure(nu_grid=nu_grid, pressure_top=1.e-5, pressure_btm=1.e2, nlayer=100)

# Change the temperature range in the atmospheric model
art.change_temperature_range(Tlow, Thigh)

# Set the instrumental resolution
Rinst = 30000.  # Instrumental resolution

# Convert the instrumental resolution to Gaussian standard deviation for convolution
beta_inst = resolution_to_gaussian_std(Rinst)

image

# Create an instance of the molecular database for CO (carbon monoxide)
# Parameters: database path, wavenumber range, GPU transfer flag, maximum lower state energy
mdbCO = MdbExomol('.database/CO/12C-16O/Li2015/', nurange=nu_grid, gpu_transfer=False, elower_max=58242.689)

print('N=', len(mdbCO.nu_lines))

# Set the diffusion mode to 0
diffmode = 0

# Create the opacity model for CO using premodit method
# Parameters: molecular database, wavenumber grid, diffusion mode, automatic temperature range, grid resolution
opaCO = OpaPremodit(mdb=mdbCO, nu_grid=nu_grid, diffmode=diffmode, auto_trange=[Tlow, Thigh], dit_grid_resolution=1.0)

# Create an instance of the molecular database for H2O (water vapor)
# Parameters: database path, wavenumber range, GPU transfer flag, critical value, maximum lower state energy
mdbH2O = MdbExomol('.database/H2O/1H2-16O/POKAZATEL', nurange=nu_grid, gpu_transfer=False, crit=1.e-46, elower_max=23726.625476)
# Print the number of spectral lines in the H2O database
print('N=', len(mdbH2O.nu_lines))

# Create the opacity model for H2O using premodit method
# Parameters: molecular database, wavenumber grid, diffusion mode, automatic temperature range, grid resolution
opaH2O = OpaPremodit(mdb=mdbH2O, nu_grid=nu_grid, diffmode=diffmode, auto_trange=[Tlow, Thigh], dit_grid_resolution=1.0, allow_32bit=True)

# CIA (Collision-Induced Absorption) setting for H2-H2 interactions
# Create an instance of the CIA database for H2-H2
cdbH2H2 = CdbCIA('.database/H2-H2_2011.cia', nu_grid)
# Create the opacity model for H2-H2 CIA
opciaH2H2 = OpaCIA(cdb=cdbH2H2, nu_grid=nu_grid)

# Mean molecular weight
mmw = 2.33

# Mass mixing ratio for H2
mmrH2 = 0.74
# Molecular mass for H2
molmassH2 = molinfo.molmass_isotope('H2')
# Volume mixing ratio for H2
vmrH2 = (mmrH2 * mmw / molmassH2)  # VMR

# CIA setting for H2-He interactions
# Create an instance of the CIA database for H2-He
cdbH2He = CdbCIA('.database/H2-He_2011.cia', nu_grid)
# Create the opacity model for H2-He CIA
opciaH2He = OpaCIA(cdb=cdbH2He, nu_grid=nu_grid)

# Mass mixing ratio for He
mmrHe = 0.25
# Molecular mass for He
molmassHe = molinfo.molmass_isotope('He', db_HIT=False)
# Volume mixing ratio for He
vmrHe = (mmrHe * mmw / molmassHe)  # VMR
VectorZhao commented 3 weeks ago

Several days ago, the code was functioning properly. Yesterday, I created a new environment. When the same spectral data was processed by executing the same code again, issues emerged, which is highly perplexing.

HajimeKawahara commented 2 weeks ago

@VectorZhao I was able to reproduce this error! I will look for the reason.

HajimeKawahara commented 2 weeks ago

@VectorZhao it's because the bug of radis==0.15.1. for now, I think using radis==0.15 can solve it.

VectorZhao commented 2 weeks ago

@HajimeKawahara thank you, I will test the code using radis==0.15

VectorZhao commented 2 weeks ago

By the way, could you please tell me approximately when exojax 2.0 will be launched? We are really looking forward to it.

HajimeKawahara commented 2 weeks ago

By the way, could you please tell me approximately when exojax 2.0 will be launched? We are really looking forward to it. @VectorZhao

Sorry to keep you waiting. Here is the current plan:

First, we aim to submit the ExoJAX2 paper in September or October, if possible. We will make the necessary revisions during the revise process and plan to release version 2.0 upon the paper's acceptance. The timing of this release depends on the review process, but we aim to release it within six months to a year at the latest. However, for the major components, we intend to release a new version as a pre-release around the time of the paper submission.

VectorZhao commented 2 weeks ago

@VectorZhao it's because the bug of radis==0.15.1. for now, I think using radis==0.15 can solve it.

radis==0.15 fixed it.

HajimeKawahara commented 2 weeks ago

I will close this Issue after merging radis/radis#691 into radis/develop.