Skip to main content

Python wrapper for the FORTRAN ACE code.

Project description

ACEPython - An equilibrium chemistry code

Introduction | Usage | TauREx 3 | Citing ACEPython

Introduction

ACEPython is a Python wrapper for the FORTRAN equilibrium chemistry code developed by Agúndez et al. 2012. It can rapidly compute the equilibirum chemical scheme for a given temperature and pressure.

Installation

ACEPython can be installed with prebuilt wheels using pip:

pip install acepython

Or, if you prefer, you can build it from source which requires a FORTRAN and C compiler. The following commands will build and install ACEPython:

git clone https://github.com/ucl-exoplanets/acepython.git
cd acepython
pip install .

Usage

ACEPython can be used to compute the equilibrium chemistry for a given temperature and pressure. Temperature and pressure must be created with astropy units. For pressure, any unit can be used (Pa, bar etc). The following example shows how to compute the equilibrium chemistry for a column of atmosphere:

from acepython import run_ace
from astropy import units as u
import numpy as np
import matplotlib.pyplot as plt


temperature = np.linspace(3000, 1000, 100) << u.K
pressure = np.logspace(6, -2, 100) << u.bar

species, mix_profile, mu_profile = run_ace(
    temperature,
    pressure,
)

species_to_see = ["H2", "H20", "CH4", "NH3", "C2H2", "CO", "CO2", "H2CO"]

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))

for i, spec in enumerate(species):
    if spec in species_to_see:
        ax1.plot(mix_profile[i], pressure, label=spec)

ax1.set_yscale("log")
ax1.set_xscale("log")
ax1.invert_yaxis()
ax1.set_ylabel("Pressure (bar)")
ax1.set_xlabel("VMR")

ax1.legend()

ax2.plot(mu_profile, pressure)
ax2.set_yscale("log")
ax2.invert_yaxis()
ax2.set_ylabel("Pressure (bar)")
ax2.set_xlabel("Mean molecular weight (au)")

plt.show()

Should produce the following figure: alt text

Custom chemical scheme

By default the elements in the chemical scheme are H, He, C, N, O at log abundances 12, 10.93, 8.39, 7.86, 8.73 respectively. The abundances can be changed by passing the elements and corresponding abundances to the run_ace function:

species, mix_profile, mu_profile = run_ace(
    temperature,
    pressure,
    elements=["H", "He", "C", "N", "O"],
    abundances=[12, 10.93, 8.39, 7.86, 7.73],
)

where we have changed O to have a log abundance of 7.73.

You can customize the species included by passing in thermochemical and species data files.

For example, if we have a custom thermochemical data file called custom_thermochemical_data.dat and a custom species data file called custom_species_data.dat that includes sulphur we can run ACEPython with:

species, mix_profile, mu_profile = run_ace(
    temperature,
    pressure,
    elements=["H", "He", "C", "N", "O", "S"],
    abundances=[12, 10.93, 8.39, 7.86, 7.73, 7.0],
    thermochemical_data="custom_thermochemical_data_w_S.dat",
    species_data="custom_species_data_w_S.dat",
)

TauREx3

ACEPython also includes a plugin for TauREx 3.1 that allows you to use ACEPython as a chemistry scheme. In the input file you can select it in the Chemistry section using acepython with arguments:

[Chemistry]
chemistry = acepython
# He/H ratio (optional)
he_h_ratio = 0.83
# Elements excluding H, He (optional)
elements = C, N, O  
# log abundances (optional)
abundances = 8.39, 7.86, 8.73 
# Custom species data file (optional)
spec_file = custom_species_data.dat 
# Custom thermochemical data file (optional)
thermo_file = custom_thermochemical_data.dat 

Citing ACEPython

If you use ACEPython in your research, please cite the following papers:

@ARTICLE{Agundez2012,
    author = {{Ag{\'u}ndez}, M. and {Venot}, O. and {Iro}, N. and {Selsis}, F. and
        {Hersant}, F. and {H{'e}brard}, E. and {Dobrijevic}, M.},
        title = "{The impact of atmospheric circulation on the chemistry of the hot Jupiter HD 209458b}",
    journal = {A\&A},
    keywords = {astrochemistry, planets and satellites: atmospheres, planets and satellites: individual: HD 209458b, Astrophysics - Earth and Planetary Astrophysics},
        year = "2012",
        month = "Dec",
    volume = {548},
        eid = {A73},
        pages = {A73},
        doi = {10.1051/0004-6361/201220365},
archivePrefix = {arXiv},
    eprint = {1210.6627},
primaryClass = {astro-ph.EP},
    adsurl = {https://ui.adsabs.harvard.edu/abs/2012A&A...548A..73A},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{2021ApJ...917...37A,
       author = {{Al-Refaie}, A.~F. and {Changeat}, Q. and {Waldmann}, I.~P. and {Tinetti}, G.},
        title = "{TauREx 3: A Fast, Dynamic, and Extendable Framework for Retrievals}",
      journal = {\apj},
     keywords = {Open source software, Astronomy software, Exoplanet atmospheres, Radiative transfer, Bayesian statistics, Planetary atmospheres, Planetary science, 1866, 1855, 487, 1335, 1900, 1244, 1255, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Earth and Planetary Astrophysics},
         year = 2021,
        month = aug,
       volume = {917},
       number = {1},
          eid = {37},
        pages = {37},
          doi = {10.3847/1538-4357/ac0252},
archivePrefix = {arXiv},
       eprint = {1912.07759},
 primaryClass = {astro-ph.IM},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2021ApJ...917...37A},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{2022ApJ...932..123A,
       author = {{Al-Refaie}, A.~F. and {Changeat}, Q. and {Venot}, O. and {Waldmann}, I.~P. and {Tinetti}, G.},
        title = "{A Comparison of Chemical Models of Exoplanet Atmospheres Enabled by TauREx 3.1}",
      journal = {\apj},
     keywords = {Open source software, Publicly available software, Chemical abundances, Bayesian statistics, Exoplanet atmospheres, Exoplanet astronomy, Exoplanet atmospheric composition, Exoplanets, Radiative transfer, 1866, 1864, 224, 1900, 487, 486, 2021, 498, 1335, Astrophysics - Earth and Planetary Astrophysics, Astrophysics - Instrumentation and Methods for Astrophysics},
         year = 2022,
        month = jun,
       volume = {932},
       number = {2},
          eid = {123},
        pages = {123},
          doi = {10.3847/1538-4357/ac6dcd},
archivePrefix = {arXiv},
       eprint = {2110.01271},
 primaryClass = {astro-ph.EP},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2022ApJ...932..123A},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acepython-0.0.8.tar.gz (80.0 kB view details)

Uploaded Source

Built Distributions

acepython-0.0.8-cp312-cp312-win_amd64.whl (435.5 kB view details)

Uploaded CPython 3.12 Windows x86-64

acepython-0.0.8-cp312-cp312-musllinux_1_1_x86_64.whl (767.5 kB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

acepython-0.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

acepython-0.0.8-cp312-cp312-macosx_10_9_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

acepython-0.0.8-cp311-cp311-win_amd64.whl (435.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

acepython-0.0.8-cp311-cp311-musllinux_1_1_x86_64.whl (767.3 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

acepython-0.0.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

acepython-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

acepython-0.0.8-cp310-cp310-win_amd64.whl (435.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

acepython-0.0.8-cp310-cp310-musllinux_1_1_x86_64.whl (767.1 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

acepython-0.0.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

acepython-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

acepython-0.0.8-cp39-cp39-win_amd64.whl (435.2 kB view details)

Uploaded CPython 3.9 Windows x86-64

acepython-0.0.8-cp39-cp39-musllinux_1_1_x86_64.whl (767.1 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

acepython-0.0.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

acepython-0.0.8-cp39-cp39-macosx_10_9_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file acepython-0.0.8.tar.gz.

File metadata

  • Download URL: acepython-0.0.8.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for acepython-0.0.8.tar.gz
Algorithm Hash digest
SHA256 06e421dfe0002bbfb1eda138bbbc49a9c6cca8eee0ddaba08bd7b5ad47c6b282
MD5 4cfd108cd29e10baef6d8af6000d13fa
BLAKE2b-256 fdcd78dee0f7eaa5a2a4bfcdcd7551549a5c1c8edcfcc0f9b8e13cd07aa5fb38

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13e4339fd45fb032aac989e32d5179308b9f50ce21f6d65de8e6fb6913b2b079
MD5 b2ac63c685bf6c25182896958d8c06e3
BLAKE2b-256 18bd21ec2fc6774a2397cbbabfe57065a1d7d74de54ccd4c580015fabb3811a3

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a1874b3f6c6b379bc89440a9dc33d19abe3371dc9a55a580c0b71ca08f5a6379
MD5 bda8fcc4af3cb366d24be1c30c80735b
BLAKE2b-256 d82c5645793d336324618b97b2fdfde873592a8f95c92e5caf7423d007aeefce

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38bc6668997767c721989434ebedb7206af60e7232cdd7754acb3414d05039b2
MD5 153e578d213d2ab3746ffa89dbe3d2c5
BLAKE2b-256 9911e1fd89d73f5b78530e90bf402ad582f17bb7e25ccf93a046009393344b5c

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d150c64c16ace2d7dba246ed1a6c1425f2f2f4e88cd00f86aa595d4b5144f5e
MD5 f7e707efd8b609e336979953711a8749
BLAKE2b-256 9ff604d8a6246ff2600ad7072399e981b9fcce58221810629a0b7138b998b1f1

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 45ece403035f24ba44544497806ee7fd8e013283e350751287e57fd052e3fa9e
MD5 3602da8e76766e9e37a71aaf519f7d64
BLAKE2b-256 0d2b1ceffd811d6a1b4d7a2d219aefa372d18c0fdd1154809df4db6e411a2b3f

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 24e73a2458b93787d018dd2d49494542e1553f8768a1307f9b119961ec24b44b
MD5 af4e0e4c6e68bd87776d62e3dda5a0ec
BLAKE2b-256 4b194ddeb02b250e91d70649dcdcea866f652acdd2d3c0fcae2edbe4e2c849d6

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aedb9d029614d7cf355026ebf4d3184f03cbb7f62fe08f7ea62ed5e0a53c4ad3
MD5 5058fb6e82407ea98f723e0f6f056119
BLAKE2b-256 62452181dc8b534be6c9e315751ae90ec34c3fb57553bfb5a42209eb0b25a044

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8d050c2445ff104596ba9e807ebbace5d3cf5bf3c06341bd4eda84a312cf087c
MD5 975770052ac075f2293e9b0c461c54fb
BLAKE2b-256 efd4b2a15cc2df8f7560006e7d8661fe244ab45ca60e78509006529041c03346

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0946f5ce28fc0d7502877f2e43dc986cd6ab53110eb974fe4da7970f0cd80cc1
MD5 1aad97514a1e13c5e61c5cc3ff1db432
BLAKE2b-256 a515b515d4c88055e60e623c71d3da2af9fd26469829606b6d5fb6f64698086f

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 6575d1ff00898ac268dc2a68a0b14b15343347bb86c93dc92e5da71bf083d3bc
MD5 2f26dae3ccae1b6154030d0558431786
BLAKE2b-256 dc9e46cb72cd58afc5f0106dede67534a4327e4386ff376039d0b73c8f4e4676

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69afe932a836ff7017978d8e5b996cb416f046264f37d592cdbe511221db7013
MD5 0ebf0f54f2db1af9010df3440701d767
BLAKE2b-256 bd88588d90ab021a7bb1a72654c23939cf590caff9de55eb363a0fc20f851340

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 55826c492d4ae9b51ee6645320f13362eb575725d140da396c57624d20eb5e4d
MD5 e50c9c94e7912b89c6823c3382c7dceb
BLAKE2b-256 48ebf224ed00e803a6a6fc32d89c3471821b4a998610577afeb9b9cf79ffb3d4

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: acepython-0.0.8-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 435.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for acepython-0.0.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1192a715340c7e481add3c4687a77da5b5d40a88d3672da16bc2e68bfd17bc5a
MD5 7933a28f51a0ee16d34f89581829a2fb
BLAKE2b-256 69a2629937cc7a5a33022b68292cbcd033ce725c363deda24750a784da7ace62

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 168f58cb564dee705769e27757c2ee48744928a64472a91cf1e882f308ff95ff
MD5 7e79e569cacffddb31004a647a9829c6
BLAKE2b-256 7d9fa89dbee755f3ab0b043a07f5b2a36f3ef965e4ecef137015f9924c5560dd

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d046eaf01f6a4c49fefdb43d8df566e3b8686bdd87cbf95d118f3c2e26093854
MD5 e06a22e21b6a7e27b6002dd3fe459faa
BLAKE2b-256 c45f3cbfb5360625ad13b7944d5f180e7edc8dab2016e80bcfabb56247a087c3

See more details on using hashes here.

File details

Details for the file acepython-0.0.8-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for acepython-0.0.8-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0f8c62f6b8183b5658129e637e855cc65474a0c336de5b03b07912964d690e2a
MD5 696a99a292f6b57ccad09ec60eac7854
BLAKE2b-256 b1eae4a11372ece033d32172ca3597ea2de39558466a2d0c9f1079ad80f23d7a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page