Metadata-Version: 2.4
Name: exo-k
Version: 1.3.1
Summary: Library to handle radiative opacities from various sources for atmospheric applications
Author-email: Jeremy Leconte <jeremy.leconte@u-bordeaux.fr>
Maintainer-email: Alexandre Mechineau <alexandre.mechineau@u-bordeaux.fr>
License-Expression: GPL-3.0-only
License-File: LICENSE
Keywords: atmosphere,atmospheric,correlated-k,cross sections,exoplanet,opacities,radiative transfer,spectra
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: MacOS
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: astropy>=6.1.4
Requires-Dist: h5py>=3.14
Requires-Dist: matplotlib>=3.7.3
Requires-Dist: nestle>=0.2
Requires-Dist: netcdf4>=1.7
Requires-Dist: numba>=0.61; python_version < '3.14'
Requires-Dist: numba>=0.64; python_version >= '3.14'
Requires-Dist: pandas>=2.2.3
Requires-Dist: scipy>=1.15.1
Requires-Dist: typing-extensions>=4.12.2
Description-Content-Type: text/markdown

# Exo_k

![Stable Version](https://img.shields.io/pypi/v/exo_k?label=Stable)
![Python Versions](https://img.shields.io/pypi/pyversions/exo_k?label=Python)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Taskfile](https://img.shields.io/badge/Taskfile-grey?logo=task)](https://taskfile.dev/)

Author: Jeremy Leconte (CNRS/LAB/Univ. Bordeaux)

`Exo_k` is a Python 3 based library to handle radiative opacities from various sources for atmospheric applications.
It now comes with a full-fledged 1D atmospheric evolution model.

It enables you to:

* Interpolate efficiently and easily in correlated-k and cross section tables.
* Convert easily correlated-k and cross section tables from one format to another
  (hdf5, LMDZ GCM, Exomol, Nemesis, PetitCode, TauREx, ExoREM, ARCIS, etc.).
* Adapt precomputed correlated-k tables to your needs by changing:
    * the spectral and quadrature (g) grids,
    * the pressure/temperature grid.
* Create tables for a mix of gases using tables for individual gases.
* Create your own tables from high-resolution spectra (for example from K-spectrum, Helios-K, etc.).
* Use your data in an integrated radiative transfer framework to simulate planetary atmospheres.
* Compute the physical state of planetary atmospheres in radiative-convective equilibrium.

For a complete online documentation, checkout:
https://lab.pages.in2p3.fr/whiplash-public/exo_k

In this repository, you'll find
a [tutorial jupyter notebook](https://gitlab.in2p3.fr/LAB/whiplash-public/exo_k/-/blob/public/tutorials/tutorial-exo_k.ipynb)
that will show you how to do all that with concrete examples that you can run on your own machine.
Many important concepts and options are presented along the way.

Enjoy!

J. Leconte

## Acknowledgements

If you use this library in your research, please acknowledge it by citing
[Leconte (2021)](https://ui.adsabs.harvard.edu/abs/2021A%26A...645A..20L/abstract):

* Spectral binning of precomputed correlated-k coefficients. **Astronomy and Astrophysics** 645. Leconte, J. 2021. doi:
  10.1051/0004-6361/202039040

This project has received funding from the European Research Council (ERC)
under the European Union's Horizon 2020 research and innovation programme
(grant agreement n° 679030/WHIPLASH).

The framework for this documentation has been developed by Aurelien Falco using Sphinx.
The framework for automatic testing has been developed by Alexandre Mechineau.

## last release (see past releases below)

v1.3.1 (May 2025): Allow specifying an albedo for the collimated incoming stellar light, as a follow-up to the previous
work.
Improved how the albedo is defined and passed to Atm.
Replaced Poetry with uv.
Migrated to IN2P3's forge.

## Installation

Exo_k can be installed using pip (without cloning the repository;
dependencies should be downloaded automatically):

```shell
pip install exo_k
```

## Usage

To learn how to use `exo_k`, we provide notebooks that teach you what you can do with `exo_k`.
Start by cloning the repository:

```shell
git clone https://gitlab.in2p3.fr/LAB/whiplash-public/exo_k.git
cd exo_k
```

You can get started by opening
[tutorial-exo_k.ipynb](https://gitlab.in2p3.fr/LAB/whiplash-public/exo_k/-/blob/public/tutorials/tutorial-exo_k.ipynb).
(On your machine: [tutorials/tutorial-exo_k.ipynb]([tutorials/tutorial-exo_k.ipynb]))

To run this notebook, you will need to install a proper virtual environment.
We recommend that you use [uv](https://docs.astral.sh/uv/getting-started/installation/) to get started quickly.

See: https://docs.astral.sh/uv/getting-started/installation/

From the cloned repository, `uv` will create a virtual environment `.venv` and install all dependencies for you:

```shell
uv sync
```

You can now select the virtual environment with your editor, such as VS Code.

Have fun!

## Links

* Project homepage: http://perso.astrophy.u-bordeaux.fr/~jleconte/
* Code repository: https://gitlab.in2p3.fr/LAB/whiplash-public/exo_k
* Documentation: https://lab.pages.in2p3.fr/whiplash-public/exo_k
* Contact: jeremy.leconte at u-bordeaux.fr

## past releases

v1.3.0 (September 2024): Now possible to specify the direction of incoming stellar light in Atmospheric radiative
transfer calculations.

v1.2.3 (April 2024): Implements diffusion of potential temperature in the atmospheric evolution model and other
features.
Inclusion of Helios-binary, Atmo-netcdf and Cia tabular data formats.

v1.2.2 (September 2023): Improvement have been made on the development side. We added a conda environment allowing
to easily contribute to `Exo_k`. Dependencies have been updated.

v1.2.1 (June 2023):  Fixes some minor bugs in the atmospheric evolution module.
Addition of a contribution function in the atmospheric radiative transfer module.
See the atmosphere tutorial for an example.

v1.2.0 (July 2022): The model for atmospheric evolution is finally stable and documented.
The atm module has also seen several note worthy additions: surface albedo, oceans.
We also added a framework for an automatic test suite. In particular, we can test several python versions. Additional
tests should rapidly come along.
Rosseland and Planck mean opacities can now be computed from radiative tables.

v1.1.0 (August 2021): New scheme for the computation of atmospheric emission/transmission
to ensure an improved numerical accuracy. The variable names to instantiate atm objects have
changed accordingly (see tutorial).

v1.0.2 (June 2021): Adds a few missing dependencies. Enables computation of thermal
emission spectra with scattering through the two-stream method (full documentation pending).
Enables creating Xtables for a mix of gases (CIA can be added as well). Solves some issues
with the 2018 Hitran CIA format.

v1.0.1 (Jan 2021): Solves a binary/string conversion issue introduced by version 3 of h5py.
Enables linear interpolation in pressure (default is log). Enables creation of
empty tables to be filled later and extension of the spectral range of existing tables.

v1.0.0 (Dec 2020): Finally our first official version. Creation of a
'examples' notebook with fully worked out use cases for the `Exo_k`.

v0.0.5 (Oct 2020): Ensures compatibility with latest Exomol correlated-k and cross-section tables.
