astro-nifty 0.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.
- astro_nifty-0.1.0/.github/workflows/publish.yml +68 -0
- astro_nifty-0.1.0/.gitignore +225 -0
- astro_nifty-0.1.0/BD_NIRCam_MIRI_filters.json +94 -0
- astro_nifty-0.1.0/LICENSE +21 -0
- astro_nifty-0.1.0/PKG-INFO +292 -0
- astro_nifty-0.1.0/README.md +268 -0
- astro_nifty-0.1.0/environment.yml +21 -0
- astro_nifty-0.1.0/nifty_logo_zoom.png +0 -0
- astro_nifty-0.1.0/pyproject.toml +49 -0
- astro_nifty-0.1.0/src/nifty/__init__.py +29 -0
- astro_nifty-0.1.0/src/nifty/_version.py +24 -0
- astro_nifty-0.1.0/src/nifty/build_model.py +676 -0
- astro_nifty-0.1.0/src/nifty/cli/__init__.py +5 -0
- astro_nifty-0.1.0/src/nifty/cli/build_model.py +118 -0
- astro_nifty-0.1.0/src/nifty/cli/nifty.py +503 -0
- astro_nifty-0.1.0/src/nifty/cli/print.py +144 -0
- astro_nifty-0.1.0/src/nifty/load.py +190 -0
- astro_nifty-0.1.0/src/nifty/model.py +619 -0
- astro_nifty-0.1.0/src/nifty/plot.py +316 -0
- astro_nifty-0.1.0/src/nifty/prob.py +193 -0
- astro_nifty-0.1.0/src/nifty/sample.py +257 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Publish Python Package
|
|
2
|
+
|
|
3
|
+
run-name: Publish ${{ github.ref_name }} to PyPI
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
# Prevent two executions for the same tag from publishing simultaneously.
|
|
11
|
+
concurrency:
|
|
12
|
+
group: pypi-${{ github.ref }}
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: Build and verify distributions
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
# The build job only needs to read the repository.
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Check out tagged commit
|
|
25
|
+
uses: actions/checkout@v6
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@v6
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.x"
|
|
31
|
+
|
|
32
|
+
- name: Install build tools
|
|
33
|
+
run: python3 -m pip install --user build twine
|
|
34
|
+
|
|
35
|
+
- name: Build source and wheel distributions
|
|
36
|
+
run: python3 -m build
|
|
37
|
+
|
|
38
|
+
- name: Check distribution integrity
|
|
39
|
+
run: python3 -m twine check --strict dist/*
|
|
40
|
+
|
|
41
|
+
- name: Upload distributions for publishing
|
|
42
|
+
uses: actions/upload-artifact@v5
|
|
43
|
+
with:
|
|
44
|
+
name: python-distributions
|
|
45
|
+
path: dist/
|
|
46
|
+
|
|
47
|
+
publish:
|
|
48
|
+
name: Publish to PyPI
|
|
49
|
+
needs:
|
|
50
|
+
- build
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
url: https://pypi.org/p/astro-nifty
|
|
56
|
+
|
|
57
|
+
permissions:
|
|
58
|
+
id-token: write
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- name: Download verified distributions
|
|
62
|
+
uses: actions/download-artifact@v6
|
|
63
|
+
with:
|
|
64
|
+
name: python-distributions
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
- name: Publish distributions to PyPI
|
|
68
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Based on the GitHub gitignore template for Python
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[codz]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py.cover
|
|
52
|
+
*.lcov
|
|
53
|
+
.hypothesis/
|
|
54
|
+
.pytest_cache/
|
|
55
|
+
cover/
|
|
56
|
+
|
|
57
|
+
# Translations
|
|
58
|
+
*.mo
|
|
59
|
+
*.pot
|
|
60
|
+
|
|
61
|
+
# Django stuff:
|
|
62
|
+
*.log
|
|
63
|
+
local_settings.py
|
|
64
|
+
db.sqlite3
|
|
65
|
+
db.sqlite3-journal
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# PyBuilder
|
|
78
|
+
.pybuilder/
|
|
79
|
+
target/
|
|
80
|
+
|
|
81
|
+
# Jupyter Notebook
|
|
82
|
+
.ipynb_checkpoints
|
|
83
|
+
|
|
84
|
+
# IPython
|
|
85
|
+
profile_default/
|
|
86
|
+
ipython_config.py
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
91
|
+
# .python-version
|
|
92
|
+
|
|
93
|
+
# pipenv
|
|
94
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
95
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
96
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
97
|
+
# install all needed dependencies.
|
|
98
|
+
# Pipfile.lock
|
|
99
|
+
|
|
100
|
+
# UV
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
# uv.lock
|
|
105
|
+
|
|
106
|
+
# poetry
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
108
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
109
|
+
# commonly ignored for libraries.
|
|
110
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
111
|
+
# poetry.lock
|
|
112
|
+
# poetry.toml
|
|
113
|
+
|
|
114
|
+
# pdm
|
|
115
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
116
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
117
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
118
|
+
# pdm.lock
|
|
119
|
+
# pdm.toml
|
|
120
|
+
.pdm-python
|
|
121
|
+
.pdm-build/
|
|
122
|
+
|
|
123
|
+
# pixi
|
|
124
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
125
|
+
# pixi.lock
|
|
126
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
127
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
128
|
+
.pixi/*
|
|
129
|
+
!.pixi/config.toml
|
|
130
|
+
|
|
131
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
132
|
+
__pypackages__/
|
|
133
|
+
|
|
134
|
+
# Celery stuff
|
|
135
|
+
celerybeat-schedule*
|
|
136
|
+
celerybeat.pid
|
|
137
|
+
|
|
138
|
+
# Redis
|
|
139
|
+
*.rdb
|
|
140
|
+
*.aof
|
|
141
|
+
*.pid
|
|
142
|
+
|
|
143
|
+
# RabbitMQ
|
|
144
|
+
mnesia/
|
|
145
|
+
rabbitmq/
|
|
146
|
+
rabbitmq-data/
|
|
147
|
+
|
|
148
|
+
# ActiveMQ
|
|
149
|
+
activemq-data/
|
|
150
|
+
|
|
151
|
+
# SageMath parsed files
|
|
152
|
+
*.sage.py
|
|
153
|
+
|
|
154
|
+
# Environments
|
|
155
|
+
.env
|
|
156
|
+
.envrc
|
|
157
|
+
.venv
|
|
158
|
+
env/
|
|
159
|
+
venv/
|
|
160
|
+
ENV/
|
|
161
|
+
env.bak/
|
|
162
|
+
venv.bak/
|
|
163
|
+
|
|
164
|
+
# Spyder project settings
|
|
165
|
+
.spyderproject
|
|
166
|
+
.spyproject
|
|
167
|
+
|
|
168
|
+
# Rope project settings
|
|
169
|
+
.ropeproject
|
|
170
|
+
|
|
171
|
+
# mkdocs documentation
|
|
172
|
+
/site
|
|
173
|
+
|
|
174
|
+
# mypy
|
|
175
|
+
.mypy_cache/
|
|
176
|
+
.dmypy.json
|
|
177
|
+
dmypy.json
|
|
178
|
+
|
|
179
|
+
# Pyre type checker
|
|
180
|
+
.pyre/
|
|
181
|
+
|
|
182
|
+
# pytype static type analyzer
|
|
183
|
+
.pytype/
|
|
184
|
+
|
|
185
|
+
# Cython debug symbols
|
|
186
|
+
cython_debug/
|
|
187
|
+
|
|
188
|
+
# PyCharm
|
|
189
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
190
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
191
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
192
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
193
|
+
# .idea/
|
|
194
|
+
|
|
195
|
+
# Abstra
|
|
196
|
+
# Abstra is an AI-powered process automation framework.
|
|
197
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
198
|
+
# Learn more at https://abstra.io/docs
|
|
199
|
+
.abstra/
|
|
200
|
+
|
|
201
|
+
# Visual Studio Code
|
|
202
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
203
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
204
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
205
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
206
|
+
# .vscode/
|
|
207
|
+
# Temporary file for partial code execution
|
|
208
|
+
tempCodeRunnerFile.py
|
|
209
|
+
|
|
210
|
+
# Ruff stuff:
|
|
211
|
+
.ruff_cache/
|
|
212
|
+
|
|
213
|
+
# PyPI configuration file
|
|
214
|
+
.pypirc
|
|
215
|
+
|
|
216
|
+
# Marimo
|
|
217
|
+
marimo/_static/
|
|
218
|
+
marimo/_lsp/
|
|
219
|
+
__marimo__/
|
|
220
|
+
|
|
221
|
+
# Streamlit
|
|
222
|
+
.streamlit/secrets.toml
|
|
223
|
+
|
|
224
|
+
.DS_Store
|
|
225
|
+
src/nifty/_version.py
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"filter_columns": {
|
|
3
|
+
"JWST_F090W": {
|
|
4
|
+
"extension": "CIRC",
|
|
5
|
+
"flux": "F090W_CIRC3",
|
|
6
|
+
"error": "F090W_CIRC3_e"
|
|
7
|
+
},
|
|
8
|
+
"JWST_F115W": {
|
|
9
|
+
"extension": "CIRC",
|
|
10
|
+
"flux": "F115W_CIRC3",
|
|
11
|
+
"error": "F115W_CIRC3_e"
|
|
12
|
+
},
|
|
13
|
+
"JWST_F150W": {
|
|
14
|
+
"extension": "CIRC",
|
|
15
|
+
"flux": "F150W_CIRC3",
|
|
16
|
+
"error": "F150W_CIRC3_e"
|
|
17
|
+
},
|
|
18
|
+
"JWST_F162M": {
|
|
19
|
+
"extension": "CIRC",
|
|
20
|
+
"flux": "F162M_CIRC3",
|
|
21
|
+
"error": "F162M_CIRC3_e"
|
|
22
|
+
},
|
|
23
|
+
"JWST_F182M": {
|
|
24
|
+
"extension": "CIRC",
|
|
25
|
+
"flux": "F182M_CIRC3",
|
|
26
|
+
"error": "F182M_CIRC3_e"
|
|
27
|
+
},
|
|
28
|
+
"JWST_F200W": {
|
|
29
|
+
"extension": "CIRC",
|
|
30
|
+
"flux": "F200W_CIRC3",
|
|
31
|
+
"error": "F200W_CIRC3_e"
|
|
32
|
+
},
|
|
33
|
+
"JWST_F210M": {
|
|
34
|
+
"extension": "CIRC",
|
|
35
|
+
"flux": "F210M_CIRC3",
|
|
36
|
+
"error": "F210M_CIRC3_e"
|
|
37
|
+
},
|
|
38
|
+
"JWST_F250M": {
|
|
39
|
+
"extension": "CIRC",
|
|
40
|
+
"flux": "F250M_CIRC3",
|
|
41
|
+
"error": "F250M_CIRC3_e"
|
|
42
|
+
},
|
|
43
|
+
"JWST_F277W": {
|
|
44
|
+
"extension": "CIRC",
|
|
45
|
+
"flux": "F277W_CIRC3",
|
|
46
|
+
"error": "F277W_CIRC3_e"
|
|
47
|
+
},
|
|
48
|
+
"JWST_F300M": {
|
|
49
|
+
"extension": "CIRC",
|
|
50
|
+
"flux": "F300M_CIRC3",
|
|
51
|
+
"error": "F300M_CIRC3_e"
|
|
52
|
+
},
|
|
53
|
+
"JWST_F335M": {
|
|
54
|
+
"extension": "CIRC",
|
|
55
|
+
"flux": "F335M_CIRC3",
|
|
56
|
+
"error": "F335M_CIRC3_e"
|
|
57
|
+
},
|
|
58
|
+
"JWST_F356W": {
|
|
59
|
+
"extension": "CIRC",
|
|
60
|
+
"flux": "F356W_CIRC3",
|
|
61
|
+
"error": "F356W_CIRC3_e"
|
|
62
|
+
},
|
|
63
|
+
"JWST_F410M": {
|
|
64
|
+
"extension": "CIRC",
|
|
65
|
+
"flux": "F410M_CIRC3",
|
|
66
|
+
"error": "F410M_CIRC3_e"
|
|
67
|
+
},
|
|
68
|
+
"JWST_F444W": {
|
|
69
|
+
"extension": "CIRC",
|
|
70
|
+
"flux": "F444W_CIRC3",
|
|
71
|
+
"error": "F444W_CIRC3_e"
|
|
72
|
+
},
|
|
73
|
+
"JWST_F560W": {
|
|
74
|
+
"extension": "MIRI",
|
|
75
|
+
"flux": "F560W_CIRC3",
|
|
76
|
+
"error": "F560W_CIRC3_e"
|
|
77
|
+
},
|
|
78
|
+
"JWST_F770W": {
|
|
79
|
+
"extension": "MIRI",
|
|
80
|
+
"flux": "F770W_CIRC3",
|
|
81
|
+
"error": "F770W_CIRC3_e"
|
|
82
|
+
},
|
|
83
|
+
"JWST_F1000W": {
|
|
84
|
+
"extension": "MIRI",
|
|
85
|
+
"flux": "F1000W_CIRC3",
|
|
86
|
+
"error": "F1000W_CIRC3_e"
|
|
87
|
+
},
|
|
88
|
+
"JWST_F1280W": {
|
|
89
|
+
"extension": "MIRI",
|
|
90
|
+
"flux": "F1280W_CIRC3",
|
|
91
|
+
"error": "F1280W_CIRC3_e"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NIFTY Authors
|
|
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,292 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astro-nifty
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Near-Infrared Fitting for T and Y Dwarfs
|
|
5
|
+
Project-URL: Repository, https://github.com/kevinhainline/NIFTY
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.13
|
|
9
|
+
Requires-Dist: astro-sedpy>=0.4.1
|
|
10
|
+
Requires-Dist: corner>=2.2.3
|
|
11
|
+
Requires-Dist: emcee>=3.1.6
|
|
12
|
+
Requires-Dist: fitsio>=1.4.0
|
|
13
|
+
Requires-Dist: h5py>=3.16
|
|
14
|
+
Requires-Dist: matplotlib>=3.10
|
|
15
|
+
Requires-Dist: nautilus-sampler>=1.0.6
|
|
16
|
+
Requires-Dist: numpy>=2.4
|
|
17
|
+
Requires-Dist: pandas>=3.0.3
|
|
18
|
+
Requires-Dist: scipy>=1.17
|
|
19
|
+
Requires-Dist: tqdm>=4.67
|
|
20
|
+
Provides-Extra: build-model
|
|
21
|
+
Requires-Dist: h5netcdf>=1.8.1; extra == 'build-model'
|
|
22
|
+
Requires-Dist: xarray>=2026.4; extra == 'build-model'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<img src="nifty_logo_zoom.png" alt="NIFTY logo" width="300"/>
|
|
26
|
+
|
|
27
|
+
# NIFTY
|
|
28
|
+
*Near-Infrared Fitting for T and Y Dwarfs*
|
|
29
|
+
|
|
30
|
+
*Kevin Hainline, Jake Helton, and Evan Chen*
|
|
31
|
+
|
|
32
|
+
NIFTY is a code designed to fit JWST NIRCam/MIRI photometry or NIRSpec prism
|
|
33
|
+
spectroscopy of cold brown dwarf candidates with the LOWZ (Meisner et al. 2021),
|
|
34
|
+
ATMO2020 (Phillips et al. 2020), Sonora Elf Owl v2 (Mukherjee et al. 2024,
|
|
35
|
+
Wogan et al. 2025), or earlier Sonora Elf Owl (with PH3, Beiler et al. 2024) atmospheric models, using
|
|
36
|
+
a Bayesian framework with the emcee sampler (https://emcee.readthedocs.io/en/stable/user/sampler/)
|
|
37
|
+
or the Nautilus sampler (https://nautilus-sampler.readthedocs.io/en/latest/).
|
|
38
|
+
This code was described in Hainline et al. (2026) (doi.org/10.48550/arXiv.2510.00111).
|
|
39
|
+
|
|
40
|
+
NIFTY operates in two modes:
|
|
41
|
+
|
|
42
|
+
- `phot` — fit broadband photometry from a catalog of one or more sources.
|
|
43
|
+
- `spec` — fit a single NIRSpec prism spectrum.
|
|
44
|
+
|
|
45
|
+
In both modes, NIFTY produces a corner plot, a best-fit SED or spectrum plot,
|
|
46
|
+
and a text file with the 16th, 50th, and 84th percentiles of all fit parameters.
|
|
47
|
+
Photometry fits typically converge in under 3 minutes per source for ~14
|
|
48
|
+
bands, though convergence time varies, especially at high SNR. Spectroscopic
|
|
49
|
+
fits are slightly longer.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
The installation comes with the NIFTY Python package and the commands `nifty`
|
|
54
|
+
and `build_model`.
|
|
55
|
+
|
|
56
|
+
The easiest way to install NIFTY is through pip:
|
|
57
|
+
```
|
|
58
|
+
pip install astro-nifty
|
|
59
|
+
```
|
|
60
|
+
The main pip installation only includes the dependencies required for sampling.
|
|
61
|
+
If you also want to build your own models, install the optional dependencies:
|
|
62
|
+
```
|
|
63
|
+
pip install astro-nifty[build-model]
|
|
64
|
+
```
|
|
65
|
+
If you are installing with pip, it is recommended that you install within a
|
|
66
|
+
**virtual environment** to keep dependencies clean. See the
|
|
67
|
+
[Python tutorial](https://docs.python.org/3/tutorial/venv.html) on virtual
|
|
68
|
+
environments and packages for more information.
|
|
69
|
+
|
|
70
|
+
Alternatively, you can clone the NIFTY repository and set up an environment
|
|
71
|
+
using conda or micromamba:
|
|
72
|
+
```
|
|
73
|
+
conda env create -f environment.yml
|
|
74
|
+
conda activate NIFTY
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Running NIFTY
|
|
78
|
+
|
|
79
|
+
The easiest way to run NIFTY is through the `nifty` command.
|
|
80
|
+
NIFTY runs in two modes: photometry mode and spectroscopy mode, which require
|
|
81
|
+
slightly different arguments.
|
|
82
|
+
|
|
83
|
+
To see the available arguments, you can run: `nifty phot -h` or `nifty spec -h`
|
|
84
|
+
to display the help message for that mode.
|
|
85
|
+
|
|
86
|
+
### Photometry mode (`nifty phot`)
|
|
87
|
+
|
|
88
|
+
Fit broadband photometry for one or more sources from a catalog.
|
|
89
|
+
|
|
90
|
+
**Single source:**
|
|
91
|
+
```
|
|
92
|
+
nifty phot \
|
|
93
|
+
--model path/to/model_grid.tar.gz \
|
|
94
|
+
--stub JADES-GS \
|
|
95
|
+
--config BD_NIRCam_MIRI_filters.json \
|
|
96
|
+
--id 20541 \
|
|
97
|
+
path/to/photometry_file.fits
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**List of IDs from a file** (one ID per line):
|
|
101
|
+
```
|
|
102
|
+
nifty phot \
|
|
103
|
+
--model path/to/model_grid.tar.gz \
|
|
104
|
+
--stub JADES-GS \
|
|
105
|
+
--config BD_NIRCam_MIRI_filters.json \
|
|
106
|
+
--idlist all_source_IDs.dat \
|
|
107
|
+
path/to/photometry_file.fits
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Multiple IDs:**
|
|
111
|
+
```
|
|
112
|
+
nifty phot \
|
|
113
|
+
--model path/to/model_grid.tar.gz \
|
|
114
|
+
--stub JADES-GS \
|
|
115
|
+
--config BD_NIRCam_MIRI_filters.json \
|
|
116
|
+
--id 20541 --id 452029 --id 430165 \
|
|
117
|
+
path/to/photometry_file.fits
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Spectroscopy mode (`nifty spec`)
|
|
121
|
+
|
|
122
|
+
Fit a single NIRSpec prism spectrum. The spectrum file should be a
|
|
123
|
+
whitespace-delimited text file with three columns: wavelength (microns),
|
|
124
|
+
flux (nJy), and flux error (nJy). The `--id` argument is used only to
|
|
125
|
+
label output files.
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
nifty spec \
|
|
129
|
+
--model path/to/model_grid.tar.gz \
|
|
130
|
+
--stub JADES-GS \
|
|
131
|
+
--id 20541 \
|
|
132
|
+
path/to/spectrum.txt
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Optional arguments
|
|
136
|
+
|
|
137
|
+
| Argument | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `--output` | Output folder (default: `<Model>_output/`) |
|
|
140
|
+
| `--frac_model_floor` | Fractional model flux floor added in quadrature to photometry errors, to account for model systematics (e.g. `0.03` for 3%). Photometry mode only; no floor is applied in spectroscopy mode. |
|
|
141
|
+
| `--sampler` | Sampler used to estimate the posterior. Currently supports `mcmc` and `nautilus` |
|
|
142
|
+
|
|
143
|
+
## Configuration File (`--config`)
|
|
144
|
+
|
|
145
|
+
NIFTY uses a single JSON file to describe all filter information needed for
|
|
146
|
+
photometry fitting. Here is a sample entry:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"filter_columns": {
|
|
151
|
+
"JWST_F115W": {
|
|
152
|
+
"extension": "CIRC",
|
|
153
|
+
"flux": "F115W_CIRC3",
|
|
154
|
+
"error": "F115W_CIRC3_e",
|
|
155
|
+
},
|
|
156
|
+
"JWST_F444W": {
|
|
157
|
+
"extension": "CIRC",
|
|
158
|
+
"flux": "F444W_CIRC3",
|
|
159
|
+
"error": "F444W_CIRC3_e",
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
The filter name must match a [valid sedpy filter](https://github.com/bd-j/sedpy/blob/main/sedpy/data/filters/README.md).
|
|
165
|
+
If no telescope prefix is provided, the prefix is assumed to be "JWST_".
|
|
166
|
+
|
|
167
|
+
- `extension`: the FITS HDU name where this filter's data lives. Ignored for
|
|
168
|
+
plain-text catalogs.
|
|
169
|
+
- `flux` / `error`: exact column names in the photometry file.
|
|
170
|
+
|
|
171
|
+
An example config file for JADES NIRCam + MIRI observations is included as
|
|
172
|
+
`BD_NIRCam_MIRI_filters.json`.
|
|
173
|
+
|
|
174
|
+
## Photometry File Format
|
|
175
|
+
|
|
176
|
+
NIFTY can read:
|
|
177
|
+
|
|
178
|
+
- **FITS** files, with filter fluxes and errors in named HDU extensions and
|
|
179
|
+
columns as specified in the config JSON.
|
|
180
|
+
- **Plain-text** catalogs, whitespace-delimited, one row per object.
|
|
181
|
+
|
|
182
|
+
For plain-text catalogs, include an `ID` column (case-sensitive) and flux/error
|
|
183
|
+
columns whose names match the config JSON exactly. Do not prefix the header
|
|
184
|
+
line with `#`. Example:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
ID F115W_CIRC3 F115W_CIRC3_e F444W_CIRC3 F444W_CIRC3_e
|
|
188
|
+
101 0.123 0.010 0.456 0.025
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
All fluxes and errors should be in nJy. A minimum relative flux error of 5% is
|
|
192
|
+
applied automatically; errors below this floor are inflated to `0.05 * flux`.
|
|
193
|
+
|
|
194
|
+
## Output Files
|
|
195
|
+
|
|
196
|
+
For each fitted source, NIFTY writes the following files to the output directory:
|
|
197
|
+
|
|
198
|
+
Each file name is prefixed with `<stub>_<ID>_<Model>_`.
|
|
199
|
+
| File | Description |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `sampler_backend.h5` | Backend file for sampler (e.g. MCMC chains) |
|
|
202
|
+
| `corner.png` | Corner plot of the posterior |
|
|
203
|
+
| `SED.png` | Best-fit SED or spectrum plot |
|
|
204
|
+
| `SED.txt` | Model spectrum envelope (16th, 50th, 84th percentile flux, in nJy, vs wavelength in microns) |
|
|
205
|
+
| `parameters.txt` | 16th, 50th, and 84th percentile parameter values, plus chi-square. Distance is in parsecs. |
|
|
206
|
+
| `model_photometry.txt` / `model_spectroscopy.txt` | 50th percentile model fit for either spectroscopy or photometry depending on mode.|
|
|
207
|
+
|
|
208
|
+
## Model Parameters
|
|
209
|
+
|
|
210
|
+
| Model | Parameters fit |
|
|
211
|
+
|---|---|
|
|
212
|
+
| `SonoraElfOwl` | Teff, log(g), log(Kzz), [M/H], C/O, distance (pc) |
|
|
213
|
+
| `SonoraElfOwlPH3` | Teff, log(g), log(Kzz), [M/H], C/O, distance (pc) |
|
|
214
|
+
| `ATMO2020` | Teff, log(g), [M/H], distance (pc) |
|
|
215
|
+
| `LOWZ` | Teff, log(g), log(Kzz), [M/H], C/O, distance (pc) |
|
|
216
|
+
|
|
217
|
+
All fits assume a source radius of 1 Jupiter radius. Distances are always
|
|
218
|
+
reported in parsecs.
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
## Creating the ModelGrid Files
|
|
222
|
+
|
|
223
|
+
Before running NIFTY, download the model grids you want to fit against, then
|
|
224
|
+
run `build_model` to build the model grid file that NIFTY uses during fitting.
|
|
225
|
+
|
|
226
|
+
For a more detailed description of parameters, run `build_model -h`.
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
build_model \
|
|
230
|
+
--path path/to/model/files/ \
|
|
231
|
+
--config BD_NIRCam_MIRI_filters.json \
|
|
232
|
+
ModelName
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The valid model names are `SonoraElfOwl`, `SonoraElfOwlPH3`, `ATMO2020`, `LOWZ`.
|
|
236
|
+
|
|
237
|
+
Typically, there are two ModelGrid files outputted. The **raw grid** is the
|
|
238
|
+
grid created by reading in all the points that are part of the model. However,
|
|
239
|
+
many models do not have values at all grid points, so missing points are filled.
|
|
240
|
+
with NaN. The **complete grid** has values for all grid points. If the raw
|
|
241
|
+
grid is missing values, they are filled by a fitting procedure (see code for
|
|
242
|
+
details). If the raw grid is already complete, only the complete grid is saved.
|
|
243
|
+
|
|
244
|
+
By default, the output model grid files are named
|
|
245
|
+
`<Model>_raw_ModelGrid.tar.gz` and `<Model>_complete_ModelGrid.tar.gz`.
|
|
246
|
+
|
|
247
|
+
The Sonora Elf Owl model grid spans several tens of GB and can take a few hours
|
|
248
|
+
to process. The other grids are considerably smaller.
|
|
249
|
+
|
|
250
|
+
### Expected Model File Layouts
|
|
251
|
+
|
|
252
|
+
**SonoraElfOwl** — directory of temperature-range tarballs containing NetCDF
|
|
253
|
+
files:
|
|
254
|
+
```
|
|
255
|
+
Sonora_Elf_Owl_v2/
|
|
256
|
+
teff_275_325.tar.gz
|
|
257
|
+
teff_350_400.tar.gz
|
|
258
|
+
...
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**SonoraElfOwlPH3** — a single `.npz` file:
|
|
262
|
+
```
|
|
263
|
+
elf_owl_disequilibrium_PH3.npz
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**ATMO2020** — per-metallicity subdirectories containing `.dat` files:
|
|
267
|
+
```
|
|
268
|
+
meisner_2023/
|
|
269
|
+
grid_m1.0/
|
|
270
|
+
spec_jwst_t700_g3.5_m1.0_kg_g3.5.dat
|
|
271
|
+
...
|
|
272
|
+
grid_m0.5/
|
|
273
|
+
grid_p0/
|
|
274
|
+
grid_p0.3/
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**LOWZ** — CSV index and models tarball
|
|
278
|
+
```
|
|
279
|
+
LOWZ/
|
|
280
|
+
LOWZ_models_index.csv
|
|
281
|
+
models.tar.gz
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## References
|
|
285
|
+
|
|
286
|
+
- Meisner et al. 2021 (LOWZ): https://doi.org/10.3847/1538-4357/ac013c
|
|
287
|
+
- Phillips et al. 2020 (ATMO2020): https://doi.org/10.1051/0004-6361/201937381
|
|
288
|
+
- Mukherjee et al. 2024 (Sonora Elf Owl): https://doi.org/10.3847/1538-4357/ad18c2
|
|
289
|
+
- Wogan et al. 2025 (Sonora Elf Owl v2): https://doi.org/10.3847/2515-5172/add407
|
|
290
|
+
- Beiler et al. 2024: https://doi.org/10.5281/zenodo.11370829
|
|
291
|
+
- Foreman-Mackey et al. 2013 (emcee): https://doi.org/10.1086/670067
|
|
292
|
+
- Lange 2023 (nautilus): https://doi.org/10.1093/mnras/stad2441
|