ExoJAX

2024.08.31 update

When using radis==0.15.1, there may be an error “‘MdbExomol’ object has no attribute ‘n_Texp'”.

pip install radis==0.15.0 could fix it.


Introduction

ExoJAX — ExoJAX 1.5.0 documentation

ExoJAX provides an auto-differentiable high-resolution spectrum model for exoplanets/brown dwarfs using JAX. ExoJAX enables a fully Bayesian inference of the high-dispersion data to fit the line-by-line spectral computation to the observed spectrum, from end-to-end (i.e. from molecular/atomic databases to real spectra), by combining it with the Hamiltonian Monte Carlo in recent probabilistic programming languages such as NumPyro. So, the notable features of ExoJAX are summarized as

  • HMC-NUTS, gradient-based optimizer available
  • Easy to use the latest molecular/atomic data in ExoMol, HITEMP, HITRAN, and VALD3
  • A transparent open-source project; anyone who wants to participate can join the development!

Here is the updated step-by-step installation guide for ExoJAX, including verification using JupyterLab.

Step-by-Step Installation Guide for ExoJAX

Platform: Win 11 or Linux

  1. Created a new conda environment with Python 3.10(python最低版本3.10,是为了安装最新版本的arviz):
conda create -n exojax_test1 python=3.10
  1. Activated the environment:
conda activate exojax_test1
  1. Installed JupyterLab and Exojax:
conda install jupyterlab
pip install exojax
  1. Launched JupyterLab:
jupyter lab
  1. Ran the following demo:

We got the error: ModuleNotFoundError: No module named 'vaex'.

  1. Installed vaex:
pip install vaex

The error in step 5 was resolved.

  1. Ran the following commands:
from exojax.spec.api import MdbHitran

MdbHitran(".database/CO/", nurange=[4200.0, 4300.0])
MdbHitran(".database/05/", nurange=[4200.0, 4300.0])

We got the error: ModuleNotFoundError: No module named 'radis'.

  1. Installed the develop branch of radis as mentioned in the email:
git clone <https://github.com/radis/radis.git>
cd radis
pip install -e .[dev] -v

The detailed installation log is as follows:

   Running setup.py develop for radis
   ...
   distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": <https://visualstudio.microsoft.com/visual-cpp-build-tools/>
   ...
   WARNING: RADIS C-extension could not be compiled, speedups are not enabled.
   Plain-Python build succeeded.
  1. Repeated step 7, and got the following error:

ModuleNotFoundError: No module named 'radis.db'

  1. The error in step 9 was due to missing Microsoft Visual C++ 14.0 or greater. After downloading and installing Microsoft C++ Build Tools, and restarting the computer, we successfully installed radis 0.15 using:
pip install -e .[dev] -v
  1. Repeated step 7 successfully.

🎉Congratulations,everything is now working correctly.

Run errors

MdbHitran执行报错解决方案:

run codes

from exojax.spec.api import Mdbhitran
Mdbhitran(".database/CO/", nurange=[4200.0, 4300.0])
Mdbhitran(".database/05/", nurange=[4200.0, 4300.0])

errors

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 MdbHitran(".database/CO/", nurange=[4200.0, 4300.0])

File ~\\anaconda3\\envs\\exojax_test\\lib\\site-packages\\exojax\\spec\\api.py:880, in MdbHitran.__init__(self, path, nurange, crit, elower_max, Ttyp, isotope, gpu_transfer, inherit_dataframe, activation, parfile, nonair_broadening, with_error)
    878 download_files = self.get_missing_files(local_file)
    879 if download_files:
--> 880     self.download_and_parse(
    881         download_files,
    882         cache=True,
    883         parse_quanta=True,
    884         add_HITRAN_uncertainty_code=with_error,
    885     )
    887 if len(download_files) > 0:
    888     self.clean_download_files()

TypeError: download_and_parse() got an unexpected keyword argument 'add_HITRAN_uncertainty_code'

MdbHitran 类与原来的主要区别在于移除了对 download_and_parse 方法中 add_HITRAN_uncertainty_code 参数的调用。这是为了避免 TypeError: download_and_parse() got an unexpected keyword argument 'add_HITRAN_uncertainty_code' 错误。具体修改如下:

  1. 移除 add_HITRAN_uncertainty_code 参数
    • self.download_and_parse 方法的调用中移除了 add_HITRAN_uncertainty_code 参数。

修改后的部分代码如下:

if download_files:
    self.download_and_parse(
        download_files,
        cache=True,
        parse_quanta=True,
        # Removed the invalid parameter `add_HITRAN_uncertainty_code`
    )

这是唯一的主要修改,其他部分保持不变。这样做的目的是确保代码不会因为传递一个无效的参数而抛出异常。

安装radis dev branch v1.5,上述错误可以修复。

文档中存在拼写错误

ExoMol, HITEMP, HITRAN — ExoJAX 1.5.0 documentation

Mdbhitran —> MdbHitran

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
-->