Skip to main content

A Python package for generating molecular and atomic spectra and cross sections

Project description

PyExoCross

A Python framework for LTE and non-LTE spectroscopic post-processing of atomic and molecular line lists

PyPI PyPI Total Downloads PyPI Monthly Downloads PyPI Status

Python Code Documentation License

CUDA GPU acceleration with PyTorch and CuPy MPS GPU acceleration with PyTorch

DOI arXiv

Description

PyExoCross is a Python adaptation of the ExoCross Fortran application.

PyExoCross is designed for postprocessing the huge molecular line lists generated by the ExoMol project and other similar initiatives such as the HITRAN and HITEMP. PyExoCross generates absorption and emission spectra and other properties (partition functions, specific heats, cooling functions, lifetimes, oscillator strengths, and stick spectra) based on molecular line lists. PyExoCross calculates cross sections with four line profiles: Doppler, Gaussian, Lorentzian, and Voigt; a number of options are available for computing Voigt profiles. PyExoCross can convert data format between ExoMol and HITRAN. PyExoCross supports importing and exporting line lists in the ExoMol and HITRAN/HITEMP formats.

PyExoCross Python Package

PyExoCross PyPI : https://pypi.org/project/pyexocross/

PyExoCross API Reference : https://pyexocross.readthedocs.io/en/latest/python_api/index.html

Install from PyPI (Python package)

pip install pyexocross

Use as a Python package

import pyexocross as px

print(px.__version__)

For detailed usage, see the Python API Reference in the documentation: https://pyexocross.readthedocs.io/en/latest/python_api/index.html

PyExoCross Python Program

PyExoCross GitHub : https://github.com/Beryl-Jingxin/PyExoCross

PyExoCross Manual : https://pyexocross.readthedocs.io

PyExoCross Wiki : https://github.com/Beryl-Jingxin/PyExoCross/wiki

PyExoCross NASA EMAC: https://emac.gsfc.nasa.gov?cid=2407-003

Download program

Download PyExoCross program by command:

git clone https://github.com/Beryl-Jingxin/PyExoCross.git

Install Python packages

pip install -r requirements.txt

Python packages version (see requirements.txt for installable bounds; tested on Python 3.8–3.12):

Python packages Version range
python_version 3.8, 3.9, 3.10, 3.11, 3.12
numpy >=1.20, <2.0
pandas >=1.4, <3.0
scipy >=1.7, <2.0
numexpr >=2.7.0,<3.0.0
matplotlib >=3.5, <4.0
tqdm >=4.64.0,<5.0.0
tabulate >=0.8.9,<1.0.0
requests >=2.25.1,<3.0.0
astropy >=5.0.0,<7.0.0
dask >=2022.5, <2025
pandarallel >=1.6.5,<2.0.0

Optional GPU Acceleration

PyExoCross now supports selectable compute mode:

  • RunMode CPU (default)
  • RunMode GPU (uses CUDA backend when available)

GPU mode is optional and automatically falls back to CPU if CUDA runtime packages or devices are unavailable. To keep GPU memory usage bounded, use:

  • GPUBatchLines (default 8192)
  • GPUBatchGrid (default 256)

When using API kwargs, the equivalent parameters are run_mode, gpu_batch_lines, and gpu_batch_grid.

Runtime packages (optional):

  • CUDA: install torch (preferred) or cupy with CUDA support.

Note: macOS MPS GPU can use GPU mode but it only uses float32 which lacks precision, so please use Nvidia GPU (CUDA) or use macOS CPU mode instead for high precision calculations.

Run PyExoCross program

In the terminal, use the following commands to run PyExoCross:

python run.py -p input_filepath

If the input filepath is /home/username/PyExoCross/input/H2O_exomol.inp

python run.py -p ./input/H2O_exomol.inp
# OR 
python run.py -p /home/username/PyExoCross/input/H2O_exomol.inp

If you want to run program in conda environment which is named as 'exomol', please use command:

/home/username/anaconda3/envs/exomol/bin/python run.py -p ./input/H2O_exomol.inp

If you need to run program in background, please use command:

# Recommended: Without log file (the program will record log automatically)
nohup python -u run.py -p ./input/H2O_exomol.inp > /dev/null 2>&1
# Save log file
nohup python -u run.py -p ./input/H2O_exomol.inp > ./output/H2O_exomol.out 2>&1 &
# OR 
nohup /home/username/anaconda3/envs/exomol/bin/python -u run.py -p ./input/H2O_exomol.inp > ./output/H2O_exomol.out 2>&1 &

Notes for input file

All information can be written in the input file. Just change the information you will use.You don't need to change any other unnecessary information.Please do not change the first column strings.

Citation

PyExoCross Paper

PyExoCross Published Paper : https://doi.org/10.1093/rasti/rzae016

PyExoCross arXiv Preprint : https://arxiv.org/abs/2406.03977

Please cite PyExoCross paper 💚

Cite

Jingxin Zhang, Jonathan Tennyson, Sergei N Yurchenko, PyExoCross: a Python program for generating spectra and cross-sections from molecular line lists, RAS Techniques and Instruments, Volume 3, Issue 1, January 2024, Pages 257–287, https://doi.org/10.1093/rasti/rzae016

Bibtex

@article{pyexocross,
    author   = {Zhang, Jingxin and Tennyson, Jonathan and Yurchenko, Sergei N},
    title    = {{PyExoCross: a Python program for generating spectra and cross-sections from molecular line lists}},
    journal  = {RAS Techniques and Instruments},
    volume   = {3},
    number   = {1},
    pages    = {257-287},
    year     = {2024},
    month    = {04},
    issn     = {2752-8200},
    doi      = {10.1093/rasti/rzae016},
    url      = {https://doi.org/10.1093/rasti/rzae016},
    eprint   = {https://academic.oup.com/rasti/article-pdf/3/1/257/61224370/rzae016.pdf},
}

Support databases

✅ ExoMol

✅ ExoMolHR

✅ ExoAtom

✅ HITRAN

✅ HITEMP

⏳ Databases from VAMDC

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

pyexocross-1.1.6.tar.gz (290.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyexocross-1.1.6-py3-none-any.whl (219.2 kB view details)

Uploaded Python 3

File details

Details for the file pyexocross-1.1.6.tar.gz.

File metadata

  • Download URL: pyexocross-1.1.6.tar.gz
  • Upload date:
  • Size: 290.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for pyexocross-1.1.6.tar.gz
Algorithm Hash digest
SHA256 93520cbe0e62a45e8832b164ada549dc7c7cfa4f085f8f32a88ba7dea264d10c
MD5 50dbdbc6ea5aa83e7046140580e495e7
BLAKE2b-256 27273ce21dcb7a41fa8639cd478c9ae8ed09dd3ce2b904bbbaaa05704e88dc04

See more details on using hashes here.

File details

Details for the file pyexocross-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: pyexocross-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 219.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for pyexocross-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f1987b072f363caae64455cd87383b6b91103b9e9dede8d2b80c9e63726972f5
MD5 d71d02799f320f0aed2ee1708a33874a
BLAKE2b-256 d3855b795da5c8e977fcd2fcab0e00b9de5d3624666e3b53d57c0a15b8f09bfc

See more details on using hashes here.

Supported by

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