jwspecfit
Resolution-aware emission-line fitting, MCMC sampling, and chemical abundance derivation for JWST NIRSpec spectra.
jwspecfit is a coordinated suite of three Python packages covering the
complete analysis path from 1-D extracted NIRSpec spectra to element
abundances:
jwspecfitLeast-squares Gaussian line fitting with resolution-aware, bin-averaged profiles; broad-Balmer BIC selection; UV doublet tying; Lyα and DLA handling; bootstrap uncertainties.
jwspecmcmcBayesian MCMC replacement for the bootstrap fitter. NUTS (via NumPyro) by default, with emcee and nautilus backends. Full posteriors, asymmetric errors, flux-ratio posteriors, R̂ and ESS diagnostics.
jwspecabundChemical abundances: direct T_e (PyNEB), Bayesian forward model (Cullen+25), strong-line calibrations (Sanders+25); multi-Balmer dust correction anchored on Hα or Hβ; Martinez+25 N/O ICFs; Lyα escape fraction.
Tip
Recommended method. For science-quality measurements the authors
recommend the Bayesian MCMC fitter, jwspecmcmc,
over the least-squares jwspecfit bootstrap. MCMC returns full posteriors,
asymmetric uncertainties, and parameter covariances, and propagates them
correctly into derived quantities (flux ratios, abundances). Use the
least-squares engine for quick looks, initial guesses, and BIC model
selection; use jwspecmcmc for published results.
Getting started
jwspecfit
jwspecmcmc
jwspecabund
Visualisation
Methodology
Methodology
- Chemical Abundance Methodology
- Table of Contents
- 1. Overview
- 2. Dust Correction
- 3. Electron Temperature
- 4. Electron Density
- 5. Oxygen Abundance — 12 + log(O/H)
- 6. Nitrogen-to-Oxygen Ratio — log(N/O)
- 7. Carbon-to-Oxygen Ratio — log(C/O)
- 8. Ionisation Correction Factors
- 9. Strong-Line Calibrations
- 10. Bayesian Forward Model
- 11. Uncertainty Propagation
- 12. Upper Limits for Non-Detected Ions
- 13. References
- Appendix: Zone Assignment Summary
- jwspecabund — Code Workflow and Logic
- Package Structure
- 1. Entry Point:
compute_abundances() - 2. Flux Extraction
- 3. Dust Correction
- 4. SNR Gating:
_filter_low_snr() - 5. Method Selection
- 6. Direct Te Method:
_run_direct()/_run_direct_mcmc() - 7. Forward Model:
forward_model() - 8. Strong-Line Method:
sanders25_metallicity() - 9. Key SNR Parameters
- 10. Complete Function Call Graph
- 11. AbundanceResult Fields
- 12. N/O ICF Label Reference
- References and methodology