Skip to content

Commit

Permalink
Merge pull request #537 from HajimeKawahara/releasev1_6
Browse files Browse the repository at this point in the history
Release v1_6
  • Loading branch information
HajimeKawahara authored Oct 7, 2024
2 parents c40d66e + 6650898 commit 7734959
Show file tree
Hide file tree
Showing 216 changed files with 93,735 additions and 86,954 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: actions/checkout@v4

# Setup Python
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

# install package
- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ 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/abundance/xspec_abundance.txt
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_ch4_trans.txt
include src/exojax/data/testdata/spectrum_co.txt
include src/exojax/data/testdata/moldb_vald.pickle
include src/exojax/data/testdata/lpf_test_ref.txt
Expand Down
91 changes: 12 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@

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.
In short, ExoJAX allows you to do gradient based optimizations, HMC-NUTS, and SVI using the latest database.

ExoJAX is at least compatible with

- 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)
- PPLs: [NumPyro](https://github.com/pyro-ppl/numpyro), [blackjax](https://github.com/blackjax-devs/blackjax), [bayeux](https://github.com/jax-ml/bayeux)
- Optimizers: [JAXopt](https://github.com/google/jaxopt), [optax](https://github.com/google-deepmind/optax)

<img src="https://github.com/HajimeKawahara/exojax/assets/15956904/8aa9673b-b64b-4b65-a76c-2966ef1edbc7" Titie="exojax" Width=850px>
<img src="https://github.com/user-attachments/assets/70d4291b-f818-4204-ab96-b3bd6c99c48f" 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)
- Opacity Calculators: opa (Voigt profile, CIA, Mie, Rayleigh scattering etc)
- Atmospheric Radiative Transfer: art (emission w, w/o scattering, refelction, transmission)
- Spectral Operator: sop (planet rotation, instrumental boradening)
- Atompsheric Microphysics: amp (clouds etc)

</details>
Expand All @@ -29,87 +30,19 @@ ExoJAX is at least compatible with

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

## Functions
## Real Examples (external)

<details open><summary>Voigt Profile :heavy_check_mark: </summary>

```python3
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
```

</details>

<details><summary>Cross Section using HITRAN/HITEMP/ExoMol :heavy_check_mark: </summary>

```python
from exojax.utils.grids import wavenumber_grid
from exojax.spec.api import MdbExomol
from exojax.spec.opacalc import OpaPremodit
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",)
mdb = MdbExomol(".database/CO/12C-16O/Li2015",nu_grid)
opa = OpaPremodit(mdb,nu_grid,auto_trange=[900.0,1100.0])
xsv = opa.xsvector(1000.0, 1.0) # cross section for 1000K, 1 bar
```

<img src="https://user-images.githubusercontent.com/15956904/111430765-2eedf180-873e-11eb-9740-9e1a313d590c.png" Titie="exojax auto cross section" Width=850px>

</details>



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

```python
mdb.change_reference_temperature(1000.) # at 1000K
plt.plot(mdb.nu_lines,mdb.line_strength_ref,".")
```

</details>

<details><summary>Emission Spectrum :heavy_check_mark: </summary>

```python
art = ArtEmisPure(nu_grid=nu_grid, pressure_btm=1.e2, pressure_top=1.e-8, nlayer=100)
F = art.run(dtau, Tarr)
```

<img src="https://user-images.githubusercontent.com/15956904/116488770-286ea000-a8ce-11eb-982d-7884b423592c.png" Titie="exojax auto \emission spectrum" Width=850px>

</details>

<details><summary>Transmission Spectrum :heavy_check_mark: </summary></details>
<details><summary>Reflection Spectrum :heavy_check_mark: </summary></details>

## Installation

```
pip install exojax
```

or

```
python setup.py install
```

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

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

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

</details>
- :star: [exojaxample_WASP39b](https://github.com/sh-tada/exojaxample_WASP39b) : An example of HMC-NUTS for actual hot Saturn (JWST/ERS, NIRSPEC/G395H)
- :star: [exojaxample_jupiter](https://github.com/HajimeKawahara/exojaxample_jupiter) : An example of HMC-NUTS for actual Jupiter reflection spectrum


## 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)
- Paper II: in prep



## License

Expand Down
34 changes: 19 additions & 15 deletions documents/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,53 @@
import sphinx_rtd_theme
import os
import sys
sys.path.insert(0, os.path.abspath('~/exojax'))

sys.path.insert(0, os.path.abspath("~/exojax"))


# -- Project information -----------------------------------------------------

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

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


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinxemoji.sphinxemoji',
]
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxemoji.sphinxemoji",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_logo = '_static/logo.png'
html_static_path = ["_static"]
html_logo = "_static/logo.png"

#html_theme_options = {
# html_theme_options = {
# 'style_nav_header_background': '#333',
#}
html_css_files = ['header.css']
# }
html_css_files = ["header.css"]
4 changes: 3 additions & 1 deletion documents/developers/doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Generates the up-to-date documents of tutorials

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

``documents/tutorials/``


.. code:: sh
cd documents/tutorials/
python jupyter2rst.py exe
If you just want to generate rst without executing notebooks, try this:
Expand Down
52 changes: 24 additions & 28 deletions documents/developers/pytest.rst
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
Test codes for developers
==============================

ExoJAX has many test codes in the ``tests`` directory. The ``test`` directory contains several types of the collection of ``pytest`` code.
ExoJAX has many test codes in the ``tests`` directory. ExoJAX has three test categories.

Unit Tests
-----------------
``tests/unittests``: Tests in this category are automatically executed by GitHub Actions
when a pull request is made to the develop or master branch.
Therefore, items that need to be downloaded from external sites or take more than 10 seconds to run should not be included in this category.
Tests that take a long time but are considered unit tests should be placed in ``integrations/unittests_long``.

Integration Tests
-----------------
``tests/integration``: This category is for testing the behavior of multiple integrated functions. Tests that have a long execution time,
involve external downloads, or depend on the status of external servers should be included here if they are to be part of automated testing.
ntegration tests also include comparisons with other codes or outputs, ensuring higher reliability.
However, since changes in the counterpart code can occur, the tests do not always succeed.

- ``tests/integration/comparison/transmission`` : An example of a transmission comparison with calculations done by Y. Kawashima using a different method.
- ``tests/integration/comparison/twostream``: A comparison code with the radiative spectrum calculations performed by petitRADTRANS.
- ``tests/integration/comparison/clouds``: A comparison with cloud models from VIRGA.

End-to-end Tests
-----------------
``tests/endtoend``: In ExoJAX, codes like HMC-NUTS that require long execution times are often used in the final application.
Therefore, such tests belong to the end-to-end category. However, due to the long execution times, these tests are not run frequently.

- ``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``.

test/unittests
---------------------

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
cd exojax/test/unittests
pytest
test/integration/unittest_long
----------------------------------

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

test/integration/comparison
---------------------------

The code for the comparison with external data, packages, etc

- ``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``



Expand Down
24 changes: 20 additions & 4 deletions documents/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
ExoJAX
==================================

Version 1.5 (:doc:`userguide/history`)
Version 1.6 (:doc:`userguide/history`)

Note: Paper II will be under peer review. We plan to release version 2.0 at the time of acceptance of the paper II.

`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,
Expand All @@ -19,6 +21,11 @@ So, the notable features of ExoJAX are summarized as
- **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!**

.. admonition:: For a more geek-oriented explanation

ExoJAX is a spectral model based on the `Differentiable Programming (DP) <https://arxiv.org/abs/2403.14606>`_ paradigm!
ExoJAX aims to provide building blocks for retrieval code, much like Minecraft |:bricks:|.

|: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>`_.

Expand Down Expand Up @@ -49,6 +56,13 @@ Contents

exojax/exojax.rst

ExoJAX example (exojaxample)
---------------------------------

- |:ringed_planet:| `exojaxample_WASP39b <https://github.com/sh-tada/exojaxample_WASP39b>`_ : An example of HMC-NUTS for actual hot Saturn (JWST/ERS, NIRSPEC/G395H)

- |:ringed_planet:| `exojaxample_jupiter <https://github.com/HajimeKawahara/exojaxample_jupiter>`_ : An example of HMC-NUTS for actual Jupiter reflection spectrum


References
---------------------
Expand All @@ -57,12 +71,12 @@ References
`ApJS 258, 31 (2022) <https://iopscience.iop.org/article/10.3847/1538-4365/ac3b4d>`_
(Paper I)

- Kawahara et al., 2024, in prep. (Paper II)


License & Attribution
---------------------

Copyright 2021-2023, Contributors
Copyright 2021-2024, Contributors

- `Hajime Kawahara <http://secondearths.sakura.ne.jp/en/index.html>`_ (@HajimeKawahara, maintainer)
- `Yui Kawashima <https://sites.google.com/view/yuikawashima/home>`_ (@ykawashima, co-maintainer)
Expand All @@ -71,11 +85,13 @@ Copyright 2021-2023, Contributors
- Dirk van den Bekerom (@dcmvdbekerom)
- Daniel Kitzmann (@daniel-kitzmann)
- Brett Morris (@bmorris3)
- Erwan Pannier (@erwanp) and `RADIS <https://github.com/radis/radis>`_ community
- Erwan Pannier (@erwanp) and Nicolas Minesi (@minouHub) from `RADIS <https://github.com/radis/radis>`_ community
- Stevanus Nugroho (@astrostevanus)
- Tako Ishikawa (@chonma0ctopus)
- Yui Kasagi (@YuiKasagi)
- Shotaro Tada (@sh-tada)
- Ko Hosokawa (@KoHosokawa)
- Hibiki Yama

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

12 changes: 10 additions & 2 deletions documents/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ Transmission Spectra

tutorials/Transmission_beta.rst

|:ringed_planet:| An example of HMC-NUTS for actual hot Saturn (JWST/ERS, NIRSPEC/G395H) can be found `here <https://github.com/sh-tada/exojaxample_WASP39b>`_ .


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

.. toctree::
:maxdepth: 1

tutorials/Jupiter_cloud_model_using_amp.rst
tutorials/Jupiter_Hires_Modeling.rst
tutorials/jupiters/Jupiter_cloud_model_using_amp.rst
tutorials/jupiters/Jupiter_Hires_Modeling.rst

|:ringed_planet:| An example of HMC-NUTS for actual Jupiter reflection spectrum can be found `here <https://github.com/HajimeKawahara/exojaxample_jupiter>`_ .

Molecular/Atomic/Continuum Databases
---------------------------------------
Expand All @@ -51,6 +56,7 @@ Molecular/Atomic/Continuum Databases
tutorials/branch.rst
tutorials/Fortrat.rst
tutorials/CIA_opacity.rst
tutorials/Forward_modeling_for_Fe_I_lines_of_Kurucz.rst


Multi Molecule/Segments Mdb and Opa Handler
Expand Down Expand Up @@ -118,5 +124,7 @@ Others
tutorials/hjerting.rst
tutorials/pure_absorption_rt.rst
tutorials/voigt_function.rst
tutorials/Cross_Section_using_Discrete_Integral_Transform.rst
tutorials/Cross_Section_using_Modified_Discrete_Integral_Transform.rst


Loading

0 comments on commit 7734959

Please sign in to comment.