jwspecfit 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. jwspecfit-1.1.0/.github/workflows/publish.yml +50 -0
  2. jwspecfit-1.1.0/.gitignore +34 -0
  3. jwspecfit-1.1.0/.readthedocs.yaml +22 -0
  4. jwspecfit-1.1.0/CITATION.cff +48 -0
  5. jwspecfit-1.1.0/LICENCE +21 -0
  6. jwspecfit-1.1.0/PKG-INFO +165 -0
  7. jwspecfit-1.1.0/README.md +116 -0
  8. jwspecfit-1.1.0/data/borg-v4_prism-clear_1747_732.spec.fits +2335 -7
  9. jwspecfit-1.1.0/data/excels-uds04-v4_g395m-f290lp_3543_63107.spec.fits +5210 -21
  10. jwspecfit-1.1.0/data/gds-udeep-v4_prism-clear_3215_20128771.spec.fits +1431 -4
  11. jwspecfit-1.1.0/data/inoue2014_table2.txt +40 -0
  12. jwspecfit-1.1.0/data/stark-rxcj2248-v4_g140m-f100lp_2478_3.spec.fits +7812 -32
  13. jwspecfit-1.1.0/data/stark-rxcj2248-v4_g235m-f170lp_2478_3.spec.fits +7909 -22
  14. jwspecfit-1.1.0/data/stark-rxcj2248-v4_g395m-f290lp_2478_3.spec.fits +4245 -13
  15. jwspecfit-1.1.0/docs/_static/logos/_render_pngs.py +71 -0
  16. jwspecfit-1.1.0/docs/_static/logos/logo-128.png +0 -0
  17. jwspecfit-1.1.0/docs/_static/logos/logo-16.png +0 -0
  18. jwspecfit-1.1.0/docs/_static/logos/logo-256.png +0 -0
  19. jwspecfit-1.1.0/docs/_static/logos/logo-32.png +0 -0
  20. jwspecfit-1.1.0/docs/_static/logos/logo-64.png +0 -0
  21. jwspecfit-1.1.0/docs/_static/logos/logo.svg +11 -0
  22. jwspecfit-1.1.0/docs/abundance.md +541 -0
  23. jwspecfit-1.1.0/docs/abundance_methodology.md +813 -0
  24. jwspecfit-1.1.0/docs/api.md +1789 -0
  25. jwspecfit-1.1.0/docs/api_reference/index.rst +13 -0
  26. jwspecfit-1.1.0/docs/changelog.md +94 -0
  27. jwspecfit-1.1.0/docs/citation.md +63 -0
  28. jwspecfit-1.1.0/docs/conf.py +118 -0
  29. jwspecfit-1.1.0/docs/index.md +102 -0
  30. jwspecfit-1.1.0/docs/installation.md +63 -0
  31. jwspecfit-1.1.0/docs/notebooks/01_prism_fit.ipynb +1871 -0
  32. jwspecfit-1.1.0/docs/notebooks/02_grating_broad.ipynb +2950 -0
  33. jwspecfit-1.1.0/docs/notebooks/03_mcmc_prism.ipynb +1865 -0
  34. jwspecfit-1.1.0/docs/notebooks/04_mcmc_grating.ipynb +4927 -0
  35. jwspecfit-1.1.0/docs/notebooks/05_metallicity.ipynb +1772 -0
  36. jwspecfit-1.1.0/docs/notebooks/06_abundances.ipynb +3026 -0
  37. jwspecfit-1.1.0/docs/notebooks/07_dla_fit.ipynb +410 -0
  38. jwspecfit-1.1.0/docs/notebooks/08_redshift_fit.ipynb +575 -0
  39. jwspecfit-1.1.0/docs/quickstart.md +155 -0
  40. jwspecfit-1.1.0/docs/references.md +965 -0
  41. jwspecfit-1.1.0/docs/requirements.txt +6 -0
  42. jwspecfit-1.1.0/docs/superpowers/specs/2026-04-09-dla-column-density-fitter-design.md +226 -0
  43. jwspecfit-1.1.0/docs/superpowers/specs/2026-04-20-balmer-anchor-design.md +128 -0
  44. jwspecfit-1.1.0/docs/superpowers/specs/2026-05-14-fit_redshift-design.md +206 -0
  45. jwspecfit-1.1.0/docs/user_guide/jwspecabund.md +118 -0
  46. jwspecfit-1.1.0/docs/user_guide/jwspecfit.md +232 -0
  47. jwspecfit-1.1.0/docs/user_guide/jwspecmcmc.md +101 -0
  48. jwspecfit-1.1.0/pyproject.toml +86 -0
  49. jwspecfit-1.1.0/setup.cfg +4 -0
  50. jwspecfit-1.1.0/src/jwspecabund/__init__.py +97 -0
  51. jwspecfit-1.1.0/src/jwspecabund/_core.py +2769 -0
  52. jwspecfit-1.1.0/src/jwspecabund/direct.py +1234 -0
  53. jwspecfit-1.1.0/src/jwspecabund/dust.py +802 -0
  54. jwspecfit-1.1.0/src/jwspecabund/forward.py +964 -0
  55. jwspecfit-1.1.0/src/jwspecabund/icf.py +154 -0
  56. jwspecfit-1.1.0/src/jwspecabund/martinez25_icf.py +542 -0
  57. jwspecfit-1.1.0/src/jwspecabund/result.py +398 -0
  58. jwspecfit-1.1.0/src/jwspecabund/strong_line.py +328 -0
  59. jwspecfit-1.1.0/src/jwspecfit/__init__.py +429 -0
  60. jwspecfit-1.1.0/src/jwspecfit/broad.py +1326 -0
  61. jwspecfit-1.1.0/src/jwspecfit/constraints.py +425 -0
  62. jwspecfit-1.1.0/src/jwspecfit/continuum.py +255 -0
  63. jwspecfit-1.1.0/src/jwspecfit/data/__init__.py +0 -0
  64. jwspecfit-1.1.0/src/jwspecfit/data/inoue2014_table2.txt +40 -0
  65. jwspecfit-1.1.0/src/jwspecfit/dla.py +1434 -0
  66. jwspecfit-1.1.0/src/jwspecfit/fitter.py +1236 -0
  67. jwspecfit-1.1.0/src/jwspecfit/io.py +655 -0
  68. jwspecfit-1.1.0/src/jwspecfit/lines.py +403 -0
  69. jwspecfit-1.1.0/src/jwspecfit/lyman_alpha.py +218 -0
  70. jwspecfit-1.1.0/src/jwspecfit/models.py +230 -0
  71. jwspecfit-1.1.0/src/jwspecfit/plotting.py +1579 -0
  72. jwspecfit-1.1.0/src/jwspecfit/redshift.py +694 -0
  73. jwspecfit-1.1.0/src/jwspecfit/resolution.py +208 -0
  74. jwspecfit-1.1.0/src/jwspecfit.egg-info/PKG-INFO +165 -0
  75. jwspecfit-1.1.0/src/jwspecfit.egg-info/SOURCES.txt +101 -0
  76. jwspecfit-1.1.0/src/jwspecfit.egg-info/dependency_links.txt +1 -0
  77. jwspecfit-1.1.0/src/jwspecfit.egg-info/requires.txt +28 -0
  78. jwspecfit-1.1.0/src/jwspecfit.egg-info/top_level.txt +3 -0
  79. jwspecfit-1.1.0/src/jwspecmcmc/__init__.py +434 -0
  80. jwspecfit-1.1.0/src/jwspecmcmc/_engine.py +1087 -0
  81. jwspecfit-1.1.0/src/jwspecmcmc/diagnostics.py +123 -0
  82. jwspecfit-1.1.0/src/jwspecmcmc/io.py +262 -0
  83. jwspecfit-1.1.0/src/jwspecmcmc/jax_likelihood.py +306 -0
  84. jwspecfit-1.1.0/src/jwspecmcmc/likelihood.py +128 -0
  85. jwspecfit-1.1.0/src/jwspecmcmc/plotting.py +228 -0
  86. jwspecfit-1.1.0/src/jwspecmcmc/priors.py +222 -0
  87. jwspecfit-1.1.0/src/jwspecmcmc/result.py +573 -0
  88. jwspecfit-1.1.0/src/jwspecmcmc/samplers.py +529 -0
  89. jwspecfit-1.1.0/tests/__init__.py +0 -0
  90. jwspecfit-1.1.0/tests/conftest.py +174 -0
  91. jwspecfit-1.1.0/tests/test_abundances.py +1910 -0
  92. jwspecfit-1.1.0/tests/test_broad.py +99 -0
  93. jwspecfit-1.1.0/tests/test_dla.py +615 -0
  94. jwspecfit-1.1.0/tests/test_dust_correctness.py +419 -0
  95. jwspecfit-1.1.0/tests/test_dust_invariance.py +539 -0
  96. jwspecfit-1.1.0/tests/test_fitter.py +102 -0
  97. jwspecfit-1.1.0/tests/test_io.py +327 -0
  98. jwspecfit-1.1.0/tests/test_lyman_alpha.py +172 -0
  99. jwspecfit-1.1.0/tests/test_models.py +119 -0
  100. jwspecfit-1.1.0/tests/test_nuts.py +155 -0
  101. jwspecfit-1.1.0/tests/test_redshift.py +367 -0
  102. jwspecfit-1.1.0/tests/test_resolution.py +107 -0
  103. jwspecfit-1.1.0/tests/test_uv_doublets.py +670 -0
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ # Fires on every published GitHub Release. Uses OIDC trusted publishing —
4
+ # no API tokens stored anywhere. Setup:
5
+ # 1. Register pending publisher on PyPI:
6
+ # https://pypi.org/manage/account/publishing/
7
+ # project name: jwspecfit | owner: raunaq-rai | repo: jwspecfit
8
+ # workflow: publish.yml | environment: pypi
9
+ # 2. Create GitHub Environment named "pypi" under repo Settings.
10
+ on:
11
+ release:
12
+ types: [published, released]
13
+ workflow_dispatch: # allows manual runs from the Actions tab
14
+
15
+ jobs:
16
+ build:
17
+ name: Build sdist and wheel
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.11"
25
+
26
+ - run: python -m pip install --upgrade pip build
27
+
28
+ - run: python -m build
29
+
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: dist/
34
+
35
+ publish:
36
+ name: Publish to PyPI
37
+ needs: build
38
+ runs-on: ubuntu-latest
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/p/jwspecfit
42
+ permissions:
43
+ id-token: write # required for OIDC trusted publishing
44
+ steps:
45
+ - uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,34 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ *.eggs/
6
+ dist/
7
+ build/
8
+ .eggs/
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+
14
+ # IDE
15
+ .idea/
16
+ .vscode/
17
+ *.swp
18
+ *.swo
19
+
20
+ # OS
21
+ .DS_Store
22
+ Thumbs.db
23
+
24
+ # Jupyter
25
+ .ipynb_checkpoints/
26
+
27
+ # Sphinx / ReadTheDocs build artefacts
28
+ docs/_build/
29
+ docs/api_reference/generated/
30
+
31
+ # Keep FITS data in repo (small test files)
32
+ # !data/*.fits
33
+ # !data/*.npz
34
+ # !data/*.txt
@@ -0,0 +1,22 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.11"
7
+
8
+ sphinx:
9
+ configuration: docs/conf.py
10
+ fail_on_warning: false
11
+
12
+ python:
13
+ install:
14
+ - requirements: docs/requirements.txt
15
+ - method: pip
16
+ path: .
17
+ extra_requirements:
18
+ - abund
19
+
20
+ formats:
21
+ - pdf
22
+ - htmlzip
@@ -0,0 +1,48 @@
1
+ cff-version: 1.2.0
2
+ message: >
3
+ If you use this software in a publication, please cite it using the
4
+ metadata below. To mint a permanent DOI, enable the repository on
5
+ Zenodo and create a GitHub release — see the README for the full
6
+ procedure.
7
+ title: "jwspecfit: resolution-aware emission-line fitting, MCMC sampling, and chemical abundances for JWST NIRSpec"
8
+ abstract: >
9
+ jwspecfit is a coordinated suite of three Python packages for the
10
+ analysis of JWST NIRSpec spectra: least-squares Gaussian line fitting
11
+ with resolution-aware bin-averaged profiles (jwspecfit), Bayesian MCMC
12
+ fitting via NUTS, emcee, or nautilus (jwspecmcmc), and chemical
13
+ abundance derivation via direct-Te (PyNEB), Bayesian forward model
14
+ (Cullen+25), or strong-line calibrations (Sanders+25) with
15
+ Balmer-decrement dust correction anchored on Halpha or Hbeta
16
+ (jwspecabund).
17
+ type: software
18
+ authors:
19
+ - family-names: "Rai"
20
+ given-names: "Raunaq"
21
+ affiliation: "UCL Department of Physics & Astronomy"
22
+ email: "raunaq.rai.22@ucl.ac.uk"
23
+ version: "1.1.0"
24
+ date-released: "2026-05-20"
25
+ license: MIT
26
+ repository-code: "https://github.com/raunaq-rai/jwspecfit"
27
+ url: "https://jwspecfit.readthedocs.io/"
28
+ keywords:
29
+ - astronomy
30
+ - astrophysics
31
+ - JWST
32
+ - NIRSpec
33
+ - spectroscopy
34
+ - emission-line fitting
35
+ - chemical abundances
36
+ - high-redshift galaxies
37
+ - Python
38
+ doi: "10.5281/zenodo.19679794"
39
+ # Once a companion paper is published, add it here:
40
+ # preferred-citation:
41
+ # type: article
42
+ # authors:
43
+ # - family-names: "Rai"
44
+ # given-names: "Raunaq"
45
+ # title: "..."
46
+ # journal: "MNRAS"
47
+ # year: 2026
48
+ # doi: "10.1093/mnras/XXXXXXX"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Raunaq Rai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: jwspecfit
3
+ Version: 1.1.0
4
+ Summary: JWST NIRSpec emission-line fitting with resolution-aware Gaussian models
5
+ Author-email: Raunaq Rai <raunaq.rai.22@ucl.ac.uk>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/raunaq-rai/jwspecfit
8
+ Project-URL: Documentation, https://jwspecfit.readthedocs.io/
9
+ Project-URL: Source, https://github.com/raunaq-rai/jwspecfit
10
+ Project-URL: Issues, https://github.com/raunaq-rai/jwspecfit/issues
11
+ Project-URL: Changelog, https://github.com/raunaq-rai/jwspecfit/blob/main/docs/changelog.md
12
+ Keywords: astronomy,astrophysics,JWST,NIRSpec,spectroscopy,emission-line fitting,chemical abundances,MCMC,high-redshift galaxies
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENCE
25
+ Requires-Dist: numpy>=1.24
26
+ Requires-Dist: scipy>=1.10
27
+ Requires-Dist: astropy>=5.3
28
+ Requires-Dist: matplotlib>=3.7
29
+ Requires-Dist: tqdm>=4.60
30
+ Requires-Dist: joblib>=1.3
31
+ Requires-Dist: plotly>=5.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.1; extra == "dev"
35
+ Provides-Extra: mcmc
36
+ Requires-Dist: emcee>=3.1; extra == "mcmc"
37
+ Requires-Dist: nautilus-sampler>=0.7; extra == "mcmc"
38
+ Requires-Dist: corner>=2.2; extra == "mcmc"
39
+ Requires-Dist: h5py>=3.8; extra == "mcmc"
40
+ Provides-Extra: nuts
41
+ Requires-Dist: jax>=0.4; extra == "nuts"
42
+ Requires-Dist: jaxlib>=0.4; extra == "nuts"
43
+ Requires-Dist: numpyro>=0.13; extra == "nuts"
44
+ Provides-Extra: abund
45
+ Requires-Dist: pyneb>=1.1.25; extra == "abund"
46
+ Provides-Extra: dla
47
+ Requires-Dist: dynesty>=2.1; extra == "dla"
48
+ Dynamic: license-file
49
+
50
+ <p align="center">
51
+ <img src="docs/_static/logos/logo.svg" alt="jwspecfit logo" width="128"/>
52
+ </p>
53
+
54
+ # jwspecfit
55
+
56
+ **Emission-line fitting, MCMC, and chemical abundances for JWST NIRSpec spectra.**
57
+
58
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
59
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENCE)
60
+ [![Tests](https://img.shields.io/badge/tests-pytest-lightgrey.svg)](tests/)
61
+ [![Docs](https://readthedocs.org/projects/jwspecfit/badge/?version=latest)](https://jwspecfit.readthedocs.io/en/latest/)
62
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19679794.svg)](https://doi.org/10.5281/zenodo.19679794)
63
+
64
+ Three packages, one pipeline — from 1-D NIRSpec spectra to element abundances.
65
+
66
+ | Package | What it does |
67
+ | ------------------- | ------------------------------------------------------------------ |
68
+ | **`jwspecfit`** | Resolution-aware Gaussian line fitting with bootstrap errors |
69
+ | **`jwspecmcmc`** | Bayesian MCMC fitting (NUTS · emcee · nautilus) |
70
+ | **`jwspecabund`** | Chemical abundances — direct T_e · forward model · strong-line |
71
+
72
+ ## Key features
73
+
74
+ - **Resolution-aware line profiles**: bin-averaged Gaussians via erf — correct for prism, gratings, and stacks.
75
+ - **Broad-Balmer detection**: BIC-based selection across four nested models.
76
+ - **UV doublets**: flux-ratio and kinematic tying for C IV, N V, N III], O III], C III], N IV].
77
+ - **Lyα + DLA**: skewed Gaussian + IGM transmission + dynesty N_HI retrieval.
78
+ - **Dust correction**: multi-Balmer A_V anchored on Hβ **or** Hα, Salim+18 or Cardelli+89 curves.
79
+ - **Abundances**: direct T_e ([O III] 4363 or UV 1666), Cullen+25 forward model, Sanders+25 strong-line.
80
+ - **ICFs**: Martinez+25 (N/O) · Izotov+06 (S, Ne, Ar) · Garnett+97 (C/O).
81
+ - **Lyα escape fraction** with Monte Carlo propagation of A_V uncertainty.
82
+
83
+ ## Install
84
+
85
+ ```bash
86
+ git clone https://github.com/raunaq-rai/jwspecfit.git
87
+ cd jwspecfit
88
+ pip install -e ".[dev,nuts,mcmc,abund]"
89
+ ```
90
+
91
+ Requires Python ≥ 3.10. See the [installation guide](https://jwspecfit.readthedocs.io/en/latest/installation.html) for individual extras.
92
+
93
+ ## Example
94
+
95
+ ```python
96
+ import jwspecfit, jwspecabund
97
+
98
+ spec = jwspecfit.read_fits("spectrum.fits", z=6.0)
99
+ result = jwspecfit.fit_lines(spec, z=6.0)
100
+ abund = jwspecabund.compute_abundances(result, z=6.0)
101
+
102
+ print(abund.summary())
103
+ ```
104
+
105
+ ## Documentation
106
+
107
+ Usage guides, API reference, and methodology:
108
+ **https://jwspecfit.readthedocs.io/**
109
+
110
+ Worked examples: [`docs/notebooks/`](docs/notebooks/).
111
+
112
+ ## Tests
113
+
114
+ ```bash
115
+ pytest tests/
116
+ ```
117
+
118
+ ## Citation
119
+
120
+ If you use `jwspecfit` in your research, **please cite it**. Choose
121
+ whichever format your reference manager or journal prefers.
122
+
123
+ > ### 📖 DOI: [10.5281/zenodo.19679794](https://doi.org/10.5281/zenodo.19679794)
124
+ >
125
+ > Concept DOI — always resolves to the latest Zenodo-archived release.
126
+
127
+ ### Plain text
128
+
129
+ > Rai, R. (2026). *jwspecfit: Resolution-aware emission-line fitting,
130
+ > MCMC sampling, and chemical abundances for JWST NIRSpec* (v1.0.1).
131
+ > Zenodo. <https://doi.org/10.5281/zenodo.19679794>
132
+
133
+ ### BibTeX
134
+
135
+ ```bibtex
136
+ @software{rai_jwspecfit,
137
+ author = {Rai, Raunaq},
138
+ title = {{jwspecfit}: Resolution-aware emission-line fitting,
139
+ MCMC sampling, and chemical abundances for JWST NIRSpec},
140
+ year = {2026},
141
+ version = {1.0.1},
142
+ publisher = {Zenodo},
143
+ doi = {10.5281/zenodo.19679794},
144
+ url = {https://doi.org/10.5281/zenodo.19679794},
145
+ }
146
+ ```
147
+
148
+ ### Other formats
149
+
150
+ APA · Chicago · IEEE · Harvard · MLA · CSL-JSON · DataCite XML are all
151
+ available from the [Zenodo record page](https://zenodo.org/records/19679794)
152
+ (Export panel on the right).
153
+
154
+ GitHub's **"Cite this repository"** button (top-right of the repo page)
155
+ reads [`CITATION.cff`](CITATION.cff) and produces APA/BibTeX on the fly.
156
+
157
+ ### Pinning a specific version
158
+
159
+ The concept DOI above always points to the latest release. If a paper
160
+ needs to cite the *exact* code version used for reproducibility, pick
161
+ the per-version DOI from the "Versions" list on the Zenodo page.
162
+
163
+ ## Licence
164
+
165
+ MIT — see [LICENCE](LICENCE).
@@ -0,0 +1,116 @@
1
+ <p align="center">
2
+ <img src="docs/_static/logos/logo.svg" alt="jwspecfit logo" width="128"/>
3
+ </p>
4
+
5
+ # jwspecfit
6
+
7
+ **Emission-line fitting, MCMC, and chemical abundances for JWST NIRSpec spectra.**
8
+
9
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENCE)
11
+ [![Tests](https://img.shields.io/badge/tests-pytest-lightgrey.svg)](tests/)
12
+ [![Docs](https://readthedocs.org/projects/jwspecfit/badge/?version=latest)](https://jwspecfit.readthedocs.io/en/latest/)
13
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19679794.svg)](https://doi.org/10.5281/zenodo.19679794)
14
+
15
+ Three packages, one pipeline — from 1-D NIRSpec spectra to element abundances.
16
+
17
+ | Package | What it does |
18
+ | ------------------- | ------------------------------------------------------------------ |
19
+ | **`jwspecfit`** | Resolution-aware Gaussian line fitting with bootstrap errors |
20
+ | **`jwspecmcmc`** | Bayesian MCMC fitting (NUTS · emcee · nautilus) |
21
+ | **`jwspecabund`** | Chemical abundances — direct T_e · forward model · strong-line |
22
+
23
+ ## Key features
24
+
25
+ - **Resolution-aware line profiles**: bin-averaged Gaussians via erf — correct for prism, gratings, and stacks.
26
+ - **Broad-Balmer detection**: BIC-based selection across four nested models.
27
+ - **UV doublets**: flux-ratio and kinematic tying for C IV, N V, N III], O III], C III], N IV].
28
+ - **Lyα + DLA**: skewed Gaussian + IGM transmission + dynesty N_HI retrieval.
29
+ - **Dust correction**: multi-Balmer A_V anchored on Hβ **or** Hα, Salim+18 or Cardelli+89 curves.
30
+ - **Abundances**: direct T_e ([O III] 4363 or UV 1666), Cullen+25 forward model, Sanders+25 strong-line.
31
+ - **ICFs**: Martinez+25 (N/O) · Izotov+06 (S, Ne, Ar) · Garnett+97 (C/O).
32
+ - **Lyα escape fraction** with Monte Carlo propagation of A_V uncertainty.
33
+
34
+ ## Install
35
+
36
+ ```bash
37
+ git clone https://github.com/raunaq-rai/jwspecfit.git
38
+ cd jwspecfit
39
+ pip install -e ".[dev,nuts,mcmc,abund]"
40
+ ```
41
+
42
+ Requires Python ≥ 3.10. See the [installation guide](https://jwspecfit.readthedocs.io/en/latest/installation.html) for individual extras.
43
+
44
+ ## Example
45
+
46
+ ```python
47
+ import jwspecfit, jwspecabund
48
+
49
+ spec = jwspecfit.read_fits("spectrum.fits", z=6.0)
50
+ result = jwspecfit.fit_lines(spec, z=6.0)
51
+ abund = jwspecabund.compute_abundances(result, z=6.0)
52
+
53
+ print(abund.summary())
54
+ ```
55
+
56
+ ## Documentation
57
+
58
+ Usage guides, API reference, and methodology:
59
+ **https://jwspecfit.readthedocs.io/**
60
+
61
+ Worked examples: [`docs/notebooks/`](docs/notebooks/).
62
+
63
+ ## Tests
64
+
65
+ ```bash
66
+ pytest tests/
67
+ ```
68
+
69
+ ## Citation
70
+
71
+ If you use `jwspecfit` in your research, **please cite it**. Choose
72
+ whichever format your reference manager or journal prefers.
73
+
74
+ > ### 📖 DOI: [10.5281/zenodo.19679794](https://doi.org/10.5281/zenodo.19679794)
75
+ >
76
+ > Concept DOI — always resolves to the latest Zenodo-archived release.
77
+
78
+ ### Plain text
79
+
80
+ > Rai, R. (2026). *jwspecfit: Resolution-aware emission-line fitting,
81
+ > MCMC sampling, and chemical abundances for JWST NIRSpec* (v1.0.1).
82
+ > Zenodo. <https://doi.org/10.5281/zenodo.19679794>
83
+
84
+ ### BibTeX
85
+
86
+ ```bibtex
87
+ @software{rai_jwspecfit,
88
+ author = {Rai, Raunaq},
89
+ title = {{jwspecfit}: Resolution-aware emission-line fitting,
90
+ MCMC sampling, and chemical abundances for JWST NIRSpec},
91
+ year = {2026},
92
+ version = {1.0.1},
93
+ publisher = {Zenodo},
94
+ doi = {10.5281/zenodo.19679794},
95
+ url = {https://doi.org/10.5281/zenodo.19679794},
96
+ }
97
+ ```
98
+
99
+ ### Other formats
100
+
101
+ APA · Chicago · IEEE · Harvard · MLA · CSL-JSON · DataCite XML are all
102
+ available from the [Zenodo record page](https://zenodo.org/records/19679794)
103
+ (Export panel on the right).
104
+
105
+ GitHub's **"Cite this repository"** button (top-right of the repo page)
106
+ reads [`CITATION.cff`](CITATION.cff) and produces APA/BibTeX on the fly.
107
+
108
+ ### Pinning a specific version
109
+
110
+ The concept DOI above always points to the latest release. If a paper
111
+ needs to cite the *exact* code version used for reproducibility, pick
112
+ the per-version DOI from the "Versions" list on the Zenodo page.
113
+
114
+ ## Licence
115
+
116
+ MIT — see [LICENCE](LICENCE).