Coder Social home page Coder Social logo

dcmvdbekerom / exojax Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hajimekawahara/exojax

0.0 1.0 0.0 96.14 MB

๐Ÿˆ Automatic differentiable spectrum modeling of exoplanets/brown dwarfs compatible to JAX.

Home Page: http://secondearths.sakura.ne.jp/exojax/

License: MIT License

Python 99.89% Makefile 0.04% HTML 0.02% Batchfile 0.05%

exojax's Introduction

exojax

License Docs arxiv

Auto-differentiable line-by-line spectral modeling of exoplanets/brown dwarfs using JAX. Read the docs ๐Ÿ•. In a nutshell, ExoJAX enables you to do a HMC-NUTS fitting using the latest database.

Functions

Voigt Profile โœ”๏ธ
from exojax.spec import voigt
nu=numpy.linspace(-10,10,100)
voigt(nu,1.0,2.0) #sigma_D=1.0, gamma_L=2.0
Cross Section using HITRAN/HITEMP/ExoMol โœ”๏ธ
from exojax.spec import AutoXS
nus=numpy.linspace(1900.0,2300.0,200000,dtype=numpy.float64) #wavenumber (cm-1)
autoxs=AutoXS(nus,"ExoMol","CO") #using ExoMol CO (12C-16O). HITRAN and HITEMP are also supported.  
xsv=autoxs.xsection(1000.0,1.0) #cross section for 1000K, 1bar (cm2)
Do you just want to plot the line strength?
ls=autoxs.linest(1000.0) #line strength for T=1000K
plt.plot(autoxs.mdb.nu_lines,ls,".")

autoxs.mdb is the moldb.MdbExomol class for molecular database. Here is a entrance to a deeper level. exojax is more flexible in the way it calculates the molecular lines. ๐Ÿˆ Go to the docs for the deeper level.

Emission Spectrum โœ”๏ธ
from exojax.spec.rtransfer import nugrid
from exojax.spec import AutoRT
nus,wav,res=nugrid(1900.0,2300.0,200000,"cm-1")
Parr=numpy.logspace(-8,2,100) #100 layers from 10^-8 bar to 10^2 bar
Tarr = 500.*(Parr/Parr[-1])**0.02    
autort=AutoRT(nus,1.e5,2.33,Tarr,Parr) #g=1.e5 cm/s2, mmw=2.33
autort.addcia("H2-H2",0.74,0.74)       #CIA, mmr(H)=0.74
autort.addcia("H2-He",0.74,0.25)       #CIA, mmr(He)=0.25
autort.addmol("ExoMol","CO",0.01)      #CO line, mmr(CO)=0.01
F=autort.rtrun()
Are you an observer?
nusobs=numpy.linspace(1900.0,2300.0,10000,dtype=numpy.float64) #observation wavenumber bin (cm-1)
F=autort.spectrum(nusobs,100000.0,20.0,0.0) #R=100000, vsini=10km/s, RV=0km/s

If you want to customize the model, see here.

HMC-NUTS of Emission Spectra โœ”๏ธ

To fit a spectrum model to real data, you need to know a little more about exojax. See here.

๐Ÿฅฅ HMC-NUTS modeling of a brown dwarf, Luhman 16 A using exojax. See here for an example of the Bayes inference using the real spectrum.

Clouds โœ… Only for brave users.
HMC-NUTS of Transmission Spectra โŒ Not supported yet.

Installation

pip install exojax

or

python setup.py install
Note on installation w/ GPU support

๐Ÿ“š You need to install CUDA, NumPyro, JAX w/ NVIDIA GPU support, and cuDNN.

  • NumPyro

exojax supports NumPyro >0.5.0, which enables the forward differentiation of HMC-NUTS. Please check the required JAX version by NumPyro. In May 2021, it seems the recent version of NumPyro requires jaxlib>=0.1.62 (see setup.py of NumPyro for instance).

  • JAX

Check you cuda version:

nvcc -V

Install such as

pip install --upgrade "jax[cuda111]"  -f https://storage.googleapis.com/jax-releases/jax_releases.html

This is the case for cuda11.1 to 11.4. Visit here for the details.

  • cuDNN

For instance, get .deb from NVIDIA and install such as

sudo dpkg -i libcudnn8_8.2.0.53-1+cuda11.3_amd64.deb

cuDNN is used for to compute the astronomical/instrumental response for the large number of wave number grid (exojax.spec.response). Otherwise, we do not use it.

References

  • Kawahara, Kawashima, Masuda, Crossfield, Pannier, van den Bekerom (2021) accepted by ApJS: arXiv:2105.14782

License

๐Ÿˆ Copyright 2020-2021 Hajime Kawahara and contributors. exojax is publicly available under the MIT license. Under development since Dec. 2020.

exojax's People

Contributors

bmorris3 avatar chonma0ctopus avatar dcmvdbekerom avatar hajimekawahara avatar ykawashima avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.