Skip to main content

PyMolFit

A Python framework for model-based telluric absorption correction. PyMolFit builds an atmospheric transmission model, fits it to selected observed pixels, and corrects the spectrum on its original wavelength grid. It does not execute Molecfit or LBLRTM.

Install

Requires Python 3.10 or later:

python -m pip install "pymolfit[plot]"

To use the unpublished development version, run this inside your checkout:

python -m pip install -e ".[plot]"

The first correction may download the AER molecular catalogue and atmospheric data. Later runs reuse downloaded data. A HITRAN account is not required.

Correct a spectrum

from pymolfit import correct

result = correct(
    input_path="spectrum.fits",
    output_path="corrected.ecsv",
    show_plot=True,
)

The returned result and saved ECSV contain the observed and corrected spectra, transmission, fitted model, masks and diagnostics. Reopen the product without fitting again:

from pymolfit import load_fit_product, plot_fit

result = load_fit_product("corrected.ecsv")
plot_fit(result, show=True)

Input files need reliable wavelength units, air/vacuum convention and observing metadata. Ambiguous FITS extensions or wavelength conventions require an explicit choice. Array users attach their observing conditions to a Spectrum object. A supplied stellar template defines fitting exclusions; it is not subtracted from the observation. Additive sky emission is not corrected by this absorption model.

Documentation

Start with the documentation index.

Upgrading to 0.8

This release removes deprecated calling conventions. Pass a path or a Spectrum as correct(input_path=...); put wavelength/flux arrays and an Observation on that Spectrum. Put fitting overrides in advanced=AdvancedOptions(...) and cache settings in cache=CacheConfig(...). Use show_interactive_window=True to open the region editor. The old spectrum= alias, flat correction keywords and synthetic demo options are no longer accepted. Low-level correct_file() and correct_arrays() remain available for custom atmospheric and spectroscopic inputs.

Development

python -m pip install -e ".[dev,plot]"
python -m pytest -q
python -m ruff check src tests tools docs/figure_examples docs/troubleshooting paper_validation

See CONTRIBUTING.md. Report problems through the issue tracker.

Scientific basis

PyMolFit uses established telluric-modelling methods. Publications should acknowledge the relevant upstream resources:

License

Original Python code uses the BSD 3-Clause License. Scientific datasets and derived coefficient tables retain their upstream terms and attribution requirements; see THIRD_PARTY_NOTICES.md and the example-data provenance.

Metadata

Release files for pymolfit 0.8.2

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

Source distribution (sdist)

Source distribution for pymolfit 0.8.2
File Size Uploaded Provenance
pymolfit-0.8.2.tar.gz 3.0 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pymolfit 0.8.2
File Interpreter ABI Platform
pymolfit-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 3.7 MB

Release files / pymolfit-0.8.2.tar.gz

Download URL pymolfit-0.8.2.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
6e73eb5e2935775df16bd9dc33ae8975004da3cb7d3a593d7de2855893ed22f3
BLAKE2b-256 checksum
How to use checksums
322c864d3047e1fe7676d7d922bc2ab35a08b44f2e16ba8ba0381433f184f265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / pymolfit-0.8.2-py3-none-any.whl

Download URL pymolfit-0.8.2-py3-none-any.whl
Size 683.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5625fc504c5b463547d8e2d421cf7aa4ad98efb78a99f169d2a0bcac372e60e6
BLAKE2b-256 checksum
How to use checksums
6017ae432c58b7640d743fbb9b15be4dbe746e5f5e931165809f7b8b4eb367b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for pymolfit 0.8.2

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.

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