Skip to content

Commit

Permalink
Merge pull request #481 from HajimeKawahara/releasev1.5
Browse files Browse the repository at this point in the history
Release v1.5
  • Loading branch information
HajimeKawahara authored Apr 26, 2024
2 parents ae3f78d + c2910c5 commit 78466ce
Show file tree
Hide file tree
Showing 243 changed files with 19,371 additions and 4,788 deletions.
892 changes: 891 additions & 1 deletion LICENSES_bundled.txt

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ include src/exojax/data/atom/barklem_collet_2016_pff.txt
include src/exojax/data/atom/iso_mn.txt
include src/exojax/data/atom/HITRAN_molparam.txt
include src/exojax/data/clouds/drag_force.txt
include src/exojax/data/clouds/ammonia_liquid_density.csv
include src/exojax/data/abundance/AAG2021.dat
include src/exojax/data/atom/NIST_Atomic_Ionization_Energies.txt

include src/exojax/data/testdata/spectrum.txt
include src/exojax/data/testdata/spectrum_ch4.txt
include src/exojax/data/testdata/spectrum_ch4_new.txt
include src/exojax/data/testdata/spectrum_co.txt
include src/exojax/data/testdata/moldb_h2o_exomol.pickle
include src/exojax/data/testdata/moldb_vald.pickle
include src/exojax/data/testdata/lpf_test_ref.txt
include src/exojax/data/testdata/modit_test_ref.txt
Expand Down Expand Up @@ -43,6 +43,10 @@ include src/exojax/data/testdata/CO/12C-16O/SAMPLE/12C-16O__SAMPLE.trans.bz2
include src/exojax/data/testdata/CO/12C-16O/SAMPLE/12C-16O__SAMPLE.trans.hdf5

include src/exojax/data/premodit/elower_grid_trange.npz
include src/exojax/data/premodit/elower_grid_trange_v2.npz

include src/exojax/data/testdata/test.refrind
include src/exojax/data/testdata/miegrid_lognorm_test.mg.npz

graft tests
graft examples
Expand Down
63 changes: 30 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
[![paper](https://img.shields.io/badge/paper-ApJS_258_31_(2022)-orange)](https://iopscience.iop.org/article/10.3847/1538-4365/ac3b4d)
<a href="https://codeclimate.com/github/HajimeKawahara/exojax/maintainability"><img src="https://api.codeclimate.com/v1/badges/97c5e8835f3ef9c4ad7c/maintainability" /></a>

Auto-differentiable line-by-line spectral modelling of exoplanets/brown dwarfs/M dwarfs using JAX. Read [the docs](http://secondearths.sakura.ne.jp/exojax) 🐕.
In short, ExoJAX allows you to do gradient based optimisation and HMC NUTS fitting using the latest database.
Differentiable spectral modelling of exoplanets/brown dwarfs/M dwarfs using JAX!
Read [the docs](http://secondearths.sakura.ne.jp/exojax/develop) 🐕.
In short, ExoJAX allows you to do gradient based optimizations and HMC-NUTS samplings using the latest database.

ExoJAX is at least compatible with

- [NumPyro](https://github.com/pyro-ppl/numpyro) (PPL)
- BlackJAX
- [JAXopt](https://github.com/google/jaxopt) (differentiable optimizer)
- PPLs: [NumPyro](https://github.com/pyro-ppl/numpyro), [blackjax](https://github.com/blackjax-devs/blackjax)
- Optimizers: [JAXopt](https://github.com/google/jaxopt), [optax](https://github.com/google-deepmind/optax), [bayeux](https://github.com/jax-ml/bayeux)

<img src="https://github.com/HajimeKawahara/exojax/assets/15956904/8aa9673b-b64b-4b65-a76c-2966ef1edbc7" Titie="exojax" Width=850px>

<details><summary>ExoJAX Classes</summary>

- Databases: *db (mdb: molecular, adb: atomic, cdb:continuum, pdb: particulates)
- Opacity Calculators: opa (i.e. Voigt profile)
- Atmospheric Radiative Transfer: art (emission w, w/o scattering, refelction, transmission)
- Atompsheric Microphysics: amp (clouds etc)

</details>

## Get Started

See [this page](http://secondearths.sakura.ne.jp/exojax/develop/tutorials/get_started.html) for the first step!

<img src="https://user-images.githubusercontent.com/15956904/222950543-6de25bb2-48f2-4bc7-a588-77daa105442e.png" Titie="exojax" Width=850px>

## Functions

<details open><summary>Voigt Profile :heavy_check_mark: </summary>
Expand All @@ -34,8 +47,7 @@ voigt(nu,1.0,2.0) #sigma_D=1.0, gamma_L=2.0
from exojax.utils.grids import wavenumber_grid
from exojax.spec.api import MdbExomol
from exojax.spec.opacalc import OpaPremodit

from jax.config import config
from jax import config
config.update("jax_enable_x64", True)

nu_grid,wav,res=wavenumber_grid(1900.0,2300.0,200000,xsmode="premodit",unit="cm-1",)
Expand All @@ -48,6 +60,8 @@ xsv = opa.xsvector(1000.0, 1.0) # cross section for 1000K, 1 bar

</details>



<details><summary>Do you just want to plot the line strength at T=1000K? </summary>

```python
Expand All @@ -68,7 +82,8 @@ F = art.run(dtau, Tarr)

</details>

See http://secondearths.sakura.ne.jp/exojax/develop/tutorials/get_started.html for the first step!
<details><summary>Transmission Spectrum :heavy_check_mark: </summary></details>
<details><summary>Reflection Spectrum :heavy_check_mark: </summary></details>

## Installation

Expand All @@ -82,38 +97,20 @@ or
python setup.py install
```

<details><summary> Note on installation w/ GPU support</summary>

:books: You need to install CUDA, NumPyro, JAX w/ NVIDIA GPU support, and cuDNN.
<details><summary>Note on installation w/ GPU support</summary>

- NumPyro
:books: You need to install CUDA, JAX w/ NVIDIA GPU support.

ExoJAX supports NumPyro >=0.7.0. Please check the required JAX version by NumPyro. In May 2021, it seems the recent version of [NumPyro](https://github.com/pyro-ppl/numpyro) requires jaxlib>=0.1.62 (see [setup.py](https://github.com/pyro-ppl/numpyro/blob/master/setup.py) of NumPyro for instance).

- JAX

Check you cuda version:

```
nvcc -V
```

Install such as

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

Please visit [here](https://github.com/google/jax) for details.
Visit [here](https://github.com/google/jax) for the installation of GPU supported JAX.

</details>


## References
[![paper](https://img.shields.io/badge/paper_I-ApJS_258_31_(2022)-orange)](https://iopscience.iop.org/article/10.3847/1538-4365/ac3b4d)

- Paper I: Kawahara, Kawashima, Masuda, Crossfield, Pannier, van den Bekerom, [ApJS 258, 31 (2022)](https://iopscience.iop.org/article/10.3847/1538-4365/ac3b4d)

## License

🐈 Copyright 2020-2023 ExoJAX contributors. exojax is publicly available under the MIT license.
🐈 Copyright 2020-2024 ExoJAX contributors. ExoJAX is publicly available under the MIT license.
4 changes: 2 additions & 2 deletions documents/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
# -- Project information -----------------------------------------------------

project = 'ExoJAX'
copyright = '2020-2023, ExoJAX contributors'
copyright = '2020-2024, ExoJAX contributors'
author = 'ExoJAX contributors'

# The full version, including alpha/beta/rc tags
release = '1.4.1'
release = '1.5.0'


# -- General configuration ---------------------------------------------------
Expand Down
14 changes: 10 additions & 4 deletions documents/developers/doc.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Generating Documents
Generates documents
==============================

We use the google style of the sphinx document.

.. code:: sh
pip install sphinx_rtd_theme sphinxemoji
This is an example to generate the sphinx doc.
Expand All @@ -18,10 +18,10 @@ This is an example to generate the sphinx doc.
make clean
make html
Generating up-to-date documents of tutorials
Generates the up-to-date documents of tutorials
------------------------------------------------

The below commands automatically run the tutorial notebooks and generate rst:
The following commands automatically run the tutorial notebooks and generate rst:

.. code:: sh
Expand All @@ -34,3 +34,9 @@ If you just want to generate rst without executing notebooks, try this:
python jupyter2rst.py none
One by One:

.. code:: sh
python jupyter2rst_each.py (python filename)
64 changes: 25 additions & 39 deletions documents/developers/pytest.rst
Original file line number Diff line number Diff line change
@@ -1,61 +1,47 @@
Test codes for developers
==============================

ExoJAX has many test codes in 'tests' directory.
We recommend to write the unit test code in 'tests' directory before pull-request and to perform the unit tests before your submission of the pull-request:
ExoJAX has many test codes in the ``tests`` directory. The ``test`` directory contains several types of the collection of ``pytest`` code.

.. code:: sh
cd exojax
pytest tests
- ``tests/unittests``: the collection of the unit tests. The GitHub action runs the test code in this directory.
- ``tests/integration``: the collection of the test codes that need longer time to run than the code in ``unittest``.

You might need some files.
test/unittests
---------------------

- VALD data

You can download them from `here <http://secondearths.sakura.ne.jp/exojax/data/>`_, but see the following warning.

.. warning::

Note that if you use Windows or Mac, .gz might be unziped when downloading despite no renaming. I mean, the same name with .gz, but unziped! In this case, download ``extradata.tar`` and untar it.


Unit test using pytest
----------------------------

Before starting the unit test, install pytest:
We recommend to write the unit test code in ``tests/unittests`` directory before pull-request and to perform the unit tests before your submission of the pull-request:

.. code:: sh
pip install pytest
cd exojax/test/unittests
pytest
To test all of the unit tests, perform
test/integration/unittest_long
----------------------------------

.. code:: sh
In essence, these are the unit tests that need longer time than the code in ``unittest``, sometimes including downloading the data.

cd exojax
pytest tests
test/integration/comparison
---------------------------

or you can test one by one
The code for the comparison with external data, packages, etc

.. code:: sh
- ``transmission/comparison_with_kawashima_transmission.py``: comparison with Yui Kawashima's computation of the transmission spectrum
- ``twostream/comparison_petitRADTRANS_*.py``: comparison with pRT
- ``nonair/nonair_co_hitran_comp.py``: non-air broadening comparison with ``radis``

cd tests/auto
pytest autoxs_test.py


Tests for the reverse modeling (retrieval)
-----------------------------------------------
Others
--------------

The unit test is not appropriate for the reverse modeling because it takes a lot of time.
For the tests of the reverse modeling, use code in 'tests/reverse' directory.
VALD data
^^^^^^^^^^^^^^^^

- reverse_lpf.py simple test for HMC-NUTS using LPF
- reverse_methane.py simple test for HMC-NUTS using MODIT
You can download them from `here <http://secondearths.sakura.ne.jp/exojax/data/>`_, but see the following warning.

.. code:: sh
.. warning::

Note that if you use Windows or Mac, .gz might be unziped when downloading despite no renaming. I mean, the same name with .gz, but unziped! In this case, download ``extradata.tar`` and untar it.

cd tests/reverse
python reverse_lpf.py
python reverse_methane.py
Binary file modified documents/exojax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions documents/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
ExoJAX
==================================

version 1.4 (:doc:`userguide/history`)
Version 1.5 (:doc:`userguide/history`)

`ExoJAX <https://github.com/HajimeKawahara/exojax>`_ provides an auto-differentiable high-resolution spectrum model for exoplanets/brown dwarfs using `JAX <https://github.com/google/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 <https://en.wikipedia.org/wiki/Hamiltonian_Monte_Carlo>`_ in recent probabilistic programming languages such as `NumPyro <https://github.com/pyro-ppl/numpyro>`_. So, the notable features of ExoJAX are summarized as
`ExoJAX <https://github.com/HajimeKawahara/exojax>`_ provides an auto-differentiable high-resolution spectrum model for exoplanets/brown dwarfs using `JAX <https://github.com/google/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 <https://en.wikipedia.org/wiki/Hamiltonian_Monte_Carlo>`_
in recent probabilistic programming languages such as `NumPyro <https://github.com/pyro-ppl/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** :doc:`userguide/api`, **and** :doc:`userguide/atomll`
- **A transparent open-source project; anyone who wants to participate can join the development!**

|:green_circle:| If you have an error and/or want to know the up-to-date info, visit `ExoJAX wiki <https://github.com/HajimeKawahara/exojax/wiki>`_. Or use `the discussions form <https://github.com/HajimeKawahara/exojax/discussions>`_ on github or directly raise `issues <https://github.com/HajimeKawahara/exojax/issues>`_.

|:green_circle:| If you have an error and/or want to know the up-to-date info, visit `ExoJAX wiki <https://github.com/HajimeKawahara/exojax/wiki>`_.
Or use `the discussions form <https://github.com/HajimeKawahara/exojax/discussions>`_ on github or directly raise `issues <https://github.com/HajimeKawahara/exojax/issues>`_.

Contents
==================================

Expand Down Expand Up @@ -59,7 +65,7 @@ License & Attribution
Copyright 2021-2023, Contributors

- `Hajime Kawahara <http://secondearths.sakura.ne.jp/en/index.html>`_ (@HajimeKawahara, maintainer)
- Yui Kawashima (@ykawashima)
- `Yui Kawashima <https://sites.google.com/view/yuikawashima/home>`_ (@ykawashima, co-maintainer)
- Kento Masuda (@kemasuda)
- Ian Crossfield
- Dirk van den Bekerom (@dcmvdbekerom)
Expand All @@ -69,6 +75,7 @@ Copyright 2021-2023, Contributors
- Stevanus Nugroho (@astrostevanus)
- Tako Ishikawa (@chonma0ctopus)
- Yui Kasagi (@YuiKasagi)
- Shotaro Tada (@sh-tada)

ExoJAX is free software made available under the MIT License. See the ``LICENSE``.

Binary file added documents/rt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 23 additions & 12 deletions documents/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ Basics
:maxdepth: 1

tutorials/get_started.rst
tutorials/optimize_spectrum_JAXopt.rst
tutorials/optimize_spectrum.rst
tutorials/reverse_premodit.rst


Applications
====================


Retrieval More
--------------------------
Tips for Real Analysis
-------------------------

.. toctree::
:maxdepth: 1

tutorials/Fitting_Telluric_Lines.rst
tutorials/reverse_precompute_grid.rst
userguide/memorysetting.rst
tutorials/elower_setting.rst


Transmission Spectra
Expand All @@ -30,6 +32,14 @@ Transmission Spectra

tutorials/Transmission_beta.rst

Reflection Spectrum
------------------------------------

.. toctree::
:maxdepth: 1

tutorials/Jupiter_cloud_model_using_amp.rst
tutorials/Jupiter_Hires_Modeling.rst

Molecular/Atomic/Continuum Databases
---------------------------------------
Expand All @@ -42,14 +52,6 @@ Molecular/Atomic/Continuum Databases
tutorials/Fortrat.rst
tutorials/CIA_opacity.rst

Tuning ExoJAX
===========================

.. toctree::
:maxdepth: 1

userguide/memorysetting.rst
tutorials/elower_setting.rst

Multi Molecule/Segments Mdb and Opa Handler
=============================================
Expand Down Expand Up @@ -79,6 +81,15 @@ Cross Section using Various Opacity Calculators
Others
================

Scattering
--------------------

.. toctree::
:maxdepth: 1

userguide/rayleigh.rst


Micro Chemical/Physical Processes
--------------------------------------

Expand Down
Loading

0 comments on commit 78466ce

Please sign in to comment.