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.
- Four short notebooks: FITS, FITS with a stellar template, wavelength/flux arrays, and interactive region selection.
- Parameter descriptions: basic
correct()arguments, followed byAdvancedOptions. - Spectrum, Observation and TheoreticalSpectrum.
- Interactive region selection.
- Full-spectrum speed and residual comparison.
- Before/after and transmission figure scripts.
- Mathematical implementation.
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:
- Molecfit: Smette et al. 2015 and Kausch et al. 2015.
- AER LBLRTM, MT_CKD and HITRAN.
- MIPAS and NOAA GDAS.
- NumPy, SciPy and Astropy.
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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymolfit-0.8.3.tar.gz | 3.0 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymolfit-0.8.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / pymolfit-0.8.3.tar.gz
| Download URL | pymolfit-0.8.3.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
291d8689a68b30acc6389c16d66b4ac95311c13716885cc4abfe35bd404b1757
|
|
BLAKE2b-256 checksum How to use checksums |
7ae86674dac5b060b6505c7bf6fc9f63a980779529e53d42a1acd2aaa5f6b155
|
| 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.3-py3-none-any.whl
| Download URL | pymolfit-0.8.3-py3-none-any.whl |
|---|---|
| Size | 683.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6011bf865a4a80cf8ae8f62b52302daca5fb8485697966a36cf687979cd58c15
|
|
BLAKE2b-256 checksum How to use checksums |
ee07f858218c4d7df143bd876e0709d1eb075525b637115ad9c7463a25dd355a
|
| 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.3
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.