JWST NIRSpec emission-line fitting with resolution-aware Gaussian models
Project description
jwspecfit
Emission-line fitting, MCMC, and chemical abundances for JWST NIRSpec spectra.
Three packages, one pipeline — from 1-D NIRSpec spectra to element abundances.
| Package | What it does |
|---|---|
jwspecfit |
Resolution-aware Gaussian line fitting with bootstrap errors |
jwspecmcmc |
Bayesian MCMC fitting (NUTS · emcee · nautilus) |
jwspecabund |
Chemical abundances — direct T_e · forward model · strong-line |
Key features
- Resolution-aware line profiles: bin-averaged Gaussians via erf — correct for prism, gratings, and stacks.
- Broad-Balmer detection: BIC-based selection across four nested models.
- UV doublets: flux-ratio and kinematic tying for C IV, N V, N III], O III], C III], N IV].
- Lyα + DLA: skewed Gaussian + IGM transmission + dynesty N_HI retrieval.
- Dust correction: multi-Balmer A_V anchored on Hβ or Hα, Salim+18 or Cardelli+89 curves.
- Abundances: direct T_e ([O III] 4363 or UV 1666), Cullen+25 forward model, Sanders+25 strong-line.
- ICFs: Martinez+25 (N/O) · Izotov+06 (S, Ne, Ar) · Garnett+97 (C/O).
- Lyα escape fraction with Monte Carlo propagation of A_V uncertainty.
Install
git clone https://github.com/raunaq-rai/jwspecfit.git
cd jwspecfit
pip install -e ".[dev,nuts,mcmc,abund]"
Requires Python ≥ 3.10. See the installation guide for individual extras.
Example
import jwspecfit, jwspecabund
spec = jwspecfit.read_fits("spectrum.fits", z=6.0)
result = jwspecfit.fit_lines(spec, z=6.0)
abund = jwspecabund.compute_abundances(result, z=6.0)
print(abund.summary())
Documentation
Usage guides, API reference, and methodology: https://jwspecfit.readthedocs.io/
Worked examples: docs/notebooks/.
Tests
pytest tests/
Citation
If you use jwspecfit in your research, please cite it. Choose
whichever format your reference manager or journal prefers.
📖 DOI: 10.5281/zenodo.19679794
Concept DOI — always resolves to the latest Zenodo-archived release.
Plain text
Rai, R. (2026). jwspecfit: Resolution-aware emission-line fitting, MCMC sampling, and chemical abundances for JWST NIRSpec (v1.0.1). Zenodo. https://doi.org/10.5281/zenodo.19679794
BibTeX
@software{rai_jwspecfit,
author = {Rai, Raunaq},
title = {{jwspecfit}: Resolution-aware emission-line fitting,
MCMC sampling, and chemical abundances for JWST NIRSpec},
year = {2026},
version = {1.0.1},
publisher = {Zenodo},
doi = {10.5281/zenodo.19679794},
url = {https://doi.org/10.5281/zenodo.19679794},
}
Other formats
APA · Chicago · IEEE · Harvard · MLA · CSL-JSON · DataCite XML are all available from the Zenodo record page (Export panel on the right).
GitHub's "Cite this repository" button (top-right of the repo page)
reads CITATION.cff and produces APA/BibTeX on the fly.
Pinning a specific version
The concept DOI above always points to the latest release. If a paper needs to cite the exact code version used for reproducibility, pick the per-version DOI from the "Versions" list on the Zenodo page.
Licence
MIT — see LICENCE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jwspecfit-1.1.0.tar.gz.
File metadata
- Download URL: jwspecfit-1.1.0.tar.gz
- Upload date:
- Size: 13.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
687fdd8de000cd1ae74ea7b6c7244a74503bf226becb7330dc4e408755229079
|
|
| MD5 |
65357f66c5e1cddb6334d5be5cebd9e5
|
|
| BLAKE2b-256 |
464bf84cb1628663fc69c67dc802a3accdd1306680bc6fc440c4ef81f181466f
|
Provenance
The following attestation bundles were made for jwspecfit-1.1.0.tar.gz:
Publisher:
publish.yml on raunaq-rai/jwspecfit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jwspecfit-1.1.0.tar.gz -
Subject digest:
687fdd8de000cd1ae74ea7b6c7244a74503bf226becb7330dc4e408755229079 - Sigstore transparency entry: 1582810653
- Sigstore integration time:
-
Permalink:
raunaq-rai/jwspecfit@113edad389ff546bf3dbf90a6f16ce18f659a2a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/raunaq-rai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@113edad389ff546bf3dbf90a6f16ce18f659a2a4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file jwspecfit-1.1.0-py3-none-any.whl.
File metadata
- Download URL: jwspecfit-1.1.0-py3-none-any.whl
- Upload date:
- Size: 203.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e9c00806c13e25d609be8332abf26e8a39b69a2f4f0481ad00a7511f64177ec
|
|
| MD5 |
07e3a333b11cbca5c91067b371b634c3
|
|
| BLAKE2b-256 |
a9b15eb6b49e87c8246ca91f57c6be68d171bd38cfb01d36ea5bfb1296d93e12
|
Provenance
The following attestation bundles were made for jwspecfit-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on raunaq-rai/jwspecfit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jwspecfit-1.1.0-py3-none-any.whl -
Subject digest:
2e9c00806c13e25d609be8332abf26e8a39b69a2f4f0481ad00a7511f64177ec - Sigstore transparency entry: 1582811237
- Sigstore integration time:
-
Permalink:
raunaq-rai/jwspecfit@113edad389ff546bf3dbf90a6f16ce18f659a2a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/raunaq-rai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@113edad389ff546bf3dbf90a6f16ce18f659a2a4 -
Trigger Event:
workflow_dispatch
-
Statement type: