Skip to main content

exomol-opacity

Calculate wavelength-dependent molecular absorption cross sections and pure-species mass opacities from downloaded ExoMol line lists. Includes a Python API, command-line calculator, and plotting tool. This is an independent project, not an official ExoMol software release.

Installation

Requires Python 3.11 or newer. Calculations support macOS and Linux, including Linux under WSL on Windows. A C++17 compiler and bzip2 development headers/library are needed to compile the bundled engine on the first calculation.

macOS (if Command Line Tools are not already installed):

xcode-select --install

Debian/Ubuntu:

sudo apt-get install g++ libbz2-dev

Install the Python package and its Python dependencies:

python -m pip install exomol-opacity

Native Windows calculation is not supported; use WSL. Plotting saved NPZ spectra needs only the Python dependencies, without a compiler or network connection.

Quick start

Calculate H3+ spectra and open separate plot windows:

exomol-opacity 'H3+' --temperatures 300 1000 --plot

Above the H3+ MiZATeP stated 5000 K maximum, calculation continues with a warning:

exomol-opacity 'H3+' --temperatures 6000 --plot

Specify where files are stored, or export plots without interactive windows:

exomol-opacity CO --temperatures 300 --output-dir ./co_results --plot --no-show

By default, downloads, compiled engines and results are stored under ./opacity_output in the current working directory. They are never written into the installed Python package. The first run downloads original ExoMol data; line lists can require gigabytes of disk space. Subsequent matching calculations reuse checked local files. Internet access is needed for uncached source data. The ExoMol line lists themselves are not included in this distribution.

Python API

from exomol_opacity import calculate_opacity, plot_opacity

paths = calculate_opacity(
    molecule="H3+",
    temperatures=[300, 1000, 6000],
    wavelength_range=(0.4, 100),  # micrometres; or "all"
    resolution=10000,
    output_root="./my_opacity_results",
)
plot_opacity(paths, show=True, save=True)

calculate_opacity returns paths to saved NPZ spectra. Each spectrum also has a CSV table and JSON metadata file. Temperatures are in kelvin; wavelength-bin resolving power is approximately lambda/delta-lambda.

Running the source folder

To work from the source distribution instead of installing from PyPI:

python -m pip install -r requirements.txt
python run_opacity.py

Edit the molecule and temperatures at the top of run_opacity.py. The source wrappers preserve storage inside the source folder. The engine sources live in exomol_opacity/src/ and are included in both the wheel and source distribution.

Choosing a Molecule

The editable run_opacity.py source example uses WAVELENGTH_RANGE = "all". This downloads every primary transition file for the selected dataset, scans the actual upper-minus-lower-state line positions, and covers all positive-frequency absorption lines with a margin for Doppler wings. It applies no line-strength threshold. The limits are cached per transition file, keyed to source checksums and scanner code. Zero-probability or zero-statistical-weight entries cannot produce absorption and do not set limits. Lines with negligible thermal populations can still be invisible in a given plot. The numerical range, line counts, and selection mode are recorded in the results.

The initial scan adds work and may require very large downloads. It does not mix isotopologues or add supplementary datasets. For a restricted range, use a pair such as WAVELENGTH_RANGE = (0.46, 100) instead. Command-line equivalent:

exomol-opacity CO --wavelength-range all --resolution 100000 --plot

Presets select the original datasets for H3+ (MiZATeP), H3O+ (eXeL), CO (Li2015), CO2 (UCL-4000), and SiO (SiOUVenIR). These are deliberate presets, not a claim that each is the newest available dataset. Select other ExoMol isotopologues/datasets explicitly when needed:

exomol-opacity H2O --list
exomol-opacity CO --temperatures 100 300 1000 --wavelength-range 1 30 --resolution 100000 --plot

For a molecule without a preset, use the isotopologue and dataset names from --list with --isotopologue NAME --dataset NAME. If there is exactly one available choice, it is selected automatically. Ambiguous choices are never silently resolved to an arbitrary isotope. The master catalogue is cached too.

The reader supports ExoMol datasets with a JSON definition, partition table, and standard bzip2-compressed states/transitions files. It discovers the transition blocks from the official dataset page and checks their count. Supplementary lists such as CO quadrupole transitions are not mixed into the primary dataset. Other file layouts fail explicitly rather than producing a partial calculation. This is not a universal reader for HITRAN, arbitrary CSVs, or every molecule.

Cache and Results

Paths below are relative to your output directory (./opacity_output by default).

  • cache/MOLECULE/ISOTOPOLOGUE/DATASET/cache.json: local download inventory.
  • That same folder contains the source files and individual SHA-256 receipts.
  • Completed source files are checked and reused without contacting the server.
  • Interrupted downloads use .part files and resume when the server supports it.
  • results/MOLECULE/ISOTOPOLOGUE/DATASET/SETTINGS_ID/: CSV, NPZ, and JSON spectra.
  • figures/ within that results folder contains the PNG and PDF plots.
  • Different temperatures, ranges, resolutions, source data, or calculation code get separate result folders. Identical completed calculations are reused.

The cache is pinned for reproducibility: it does not silently update a dataset. Remove the relevant cached files and their receipts to intentionally download fresh versions. Do not edit source files in the cache. A lock prevents two runs from writing the same molecule cache at once.

Plot Existing Results

No compiler, source line lists, or internet connection is needed to plot saved NPZ spectra. Install exomol-opacity and share the desired results folder.

exomol-opacity-plot "opacity_output/results/CO/12C-16O/Li2015/SETTINGS_ID"

Replace SETTINGS_ID with the folder printed by the calculation. Add --no-show to save figures without opening windows, or --no-save to only display them. Use --quantity mass-opacity for pure-isotopologue mass opacity. Plots show the upper 14 orders of magnitude, as in the H3+ figures; saved spectra retain the full calculated values.

Physical Scope

The calculation retains the original H3+ engine: LTE populations, Einstein-A line strengths, thermal Doppler profiles, and analytic integrals over logarithmic wavenumber bins. It does not add pressure broadening, continuum opacity, natural isotope mixtures, or instrumental broadening. Bin resolution is approximately lambda/delta-lambda; changing it requires recalculation.

Cross sections are cm^2 per molecule. Mass opacity is cm^2 per gram of the pure chosen isotopologue, not per gram of an atmospheric mixture. Zero kelvin means the formal ground-state, zero-Doppler-width limit. Positive temperatures use the published partition table; H3+ MiZATeP retains the direct state sum used in the original calculation to avoid low-temperature rounding. Requests above the dataset's stated maximum temperature are allowed with a warning before large downloads. The warning explains that line-list completeness and opacity accuracy are not established above that limit; this includes H3+ MiZATeP above 5000 K. The dataset limit and an above-limit flag are saved in each spectrum's metadata, with the warning also recorded for affected spectra and in calculation.json. For example, exomol-opacity 'H3+' --temperatures 6000 --plot calculates a 6000 K spectrum with a warning. The H3+ partition function is still computed from the available states; extending the temperature does not add missing states or transitions. For other datasets using a partition table, temperatures must still be covered by that table; it is not extrapolated. Explicit short-wavelength requests are checked before large downloads. The original H3+ 0.4--100 micron range remains available as an explicit range; "all" instead uses the actual line positions, even outside metadata boundaries. Dataset coverage does not guarantee line-list completeness at every wavelength or temperature.

Source: https://www.exomol.com/ (original source URLs and checksums accompany results).

Tests

python -m unittest discover -s tests -v

Development

python -m unittest discover -s tests -v
python -m pip install build twine
python -m build
python -m twine check dist/*

License

No software license has been specified for this release. ExoMol data are downloaded separately and remain subject to their own terms and citation requirements.

Metadata

Release files for exomol-opacity 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for exomol-opacity 0.1.0
File Size Uploaded Provenance Actions
exomol_opacity-0.1.0.tar.gz 25.0 kB Without provenance Details for exomol_opacity-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for exomol-opacity 0.1.0
File Interpreter ABI Platform Actions
exomol_opacity-0.1.0-py3-none-any.whl Python 3 none any Details for exomol_opacity-0.1.0-py3-none-any.whl

Total release size: 44.6 kB

Release files / exomol_opacity-0.1.0.tar.gz

Download URL exomol_opacity-0.1.0.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e166753e3825aae457c1e8176ab3a868440e0c842a9553f1d18f936850c0ee03
BLAKE2b-256 checksum
How to use checksums
c2949ba63aefb2a1fe2927930d947f8f8f53f4fa8ae41fbd7952df4c161678f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / exomol_opacity-0.1.0-py3-none-any.whl

Download URL exomol_opacity-0.1.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08497e66f288fadc42bcb3591f8ad905c33d1c650438f059215c85fb520e2ee6
BLAKE2b-256 checksum
How to use checksums
01dc8605c8fde7db4de6b83108b844d7ff2e7d826acf9b7b282e33929855a224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for exomol-opacity 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page