jwstflow 0.2.0__tar.gz → 0.2.2__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.
- {jwstflow-0.2.0 → jwstflow-0.2.2}/PKG-INFO +55 -13
- {jwstflow-0.2.0 → jwstflow-0.2.2}/README.md +54 -12
- jwstflow-0.2.2/pyproject.toml +104 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/pyproject.toml.orig +35 -16
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/__init__.py +9 -4
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/cli.py +17 -12
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/loader.py +25 -5
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/miri_imaging.yaml +2 -2
- jwstflow-0.2.2/src/jwstflow/config/presets/nircam_imaging.yaml +53 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/nirspec_mos.yaml +1 -1
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/schema.py +5 -3
- jwstflow-0.2.2/src/jwstflow/cubes/__init__.py +71 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/__init__.py +102 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/compare.py +54 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/detector.py +67 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/product.py +99 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/regions.py +132 -0
- jwstflow-0.2.2/src/jwstflow/cubes/clusters/steps.py +298 -0
- jwstflow-0.2.2/src/jwstflow/cubes/detector.py +109 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/__init__.py +112 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/compare.py +79 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/coverage.py +146 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/edges.py +123 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/groups.py +54 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/product.py +85 -0
- jwstflow-0.2.2/src/jwstflow/cubes/gaps/steps.py +254 -0
- jwstflow-0.2.2/src/jwstflow/cubes/instrument.py +18 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/cubes}/masks.py +18 -122
- jwstflow-0.2.2/src/jwstflow/cubes/morphology.py +42 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/__init__.py +132 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/engines.py +203 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/grid.py +70 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/instrument.py +187 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/neighbour.py +747 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/product.py +387 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/steps.py +718 -0
- jwstflow-0.2.2/src/jwstflow/cubes/psf/subtraction.py +145 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/__init__.py +166 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/grid.py +278 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/matched.py +77 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/measure.py +328 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/product.py +168 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/regrid.py +271 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/segments.py +112 -0
- jwstflow-0.2.2/src/jwstflow/cubes/stitching/steps.py +510 -0
- jwstflow-0.2.2/src/jwstflow/cubes/wcs.py +131 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/data/discovery.py +11 -2
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/data/download.py +25 -2
- jwstflow-0.2.0/src/jwstflow/contrib/nirspec.py → jwstflow-0.2.2/src/jwstflow/data/msa.py +2 -2
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/engine}/associations.py +23 -8
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/engine}/crds.py +1 -1
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/engine}/dagviz.py +3 -3
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/engine/executor.py +20 -2
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/engine/runner.py +20 -20
- jwstflow-0.2.2/src/jwstflow/images/__init__.py +22 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/__init__.py +102 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/catalogs.py +201 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/gaia.py +202 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/match.py +187 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/product.py +87 -0
- jwstflow-0.2.2/src/jwstflow/images/astrometry/steps.py +270 -0
- jwstflow-0.2.2/src/jwstflow/images/filters.py +167 -0
- jwstflow-0.2.2/src/jwstflow/images/io.py +164 -0
- jwstflow-0.2.2/src/jwstflow/qa/__init__.py +43 -0
- jwstflow-0.2.2/src/jwstflow/qa/annotation.py +176 -0
- jwstflow-0.2.2/src/jwstflow/qa/frames.py +528 -0
- jwstflow-0.2.2/src/jwstflow/qa/io.py +219 -0
- jwstflow-0.2.2/src/jwstflow/qa/labels.py +198 -0
- jwstflow-0.2.2/src/jwstflow/qa/layout.py +721 -0
- jwstflow-0.2.2/src/jwstflow/qa/lines.py +280 -0
- jwstflow-0.2.2/src/jwstflow/qa/placement.py +132 -0
- jwstflow-0.2.2/src/jwstflow/qa/plots.py +181 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/__init__.py +55 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/archival.py +173 -0
- {jwstflow-0.2.0/src/jwstflow/contrib → jwstflow-0.2.2/src/jwstflow/qa/steps}/clusters.py +28 -29
- jwstflow-0.2.2/src/jwstflow/qa/steps/cube_stitch.py +270 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/cubes.py +206 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/gaps.py +84 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/images.py +500 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/mast_compare.py +353 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/psf.py +263 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/spectra.py +326 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/stitch.py +370 -0
- jwstflow-0.2.2/src/jwstflow/qa/steps/summary.py +52 -0
- jwstflow-0.2.2/src/jwstflow/qa/style.py +371 -0
- jwstflow-0.2.2/src/jwstflow/qa/units.py +36 -0
- jwstflow-0.2.2/src/jwstflow/refdata/filters/jwst_imaging_filters.ecsv +71 -0
- jwstflow-0.2.2/src/jwstflow/refdata/filters/jwst_imaging_throughputs.ecsv +10815 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/refdata/spectral_features/gas_lines.ecsv +51 -50
- jwstflow-0.2.2/src/jwstflow/refdata/spectral_features/gas_lines_extended.ecsv +192 -0
- jwstflow-0.2.2/src/jwstflow/refdata/spectral_features/photospheric_lines.ecsv +88 -0
- jwstflow-0.2.2/src/jwstflow/scaffold/__init__.py +14 -0
- jwstflow-0.2.0/src/jwstflow/scaffold.py → jwstflow-0.2.2/src/jwstflow/scaffold/package.py +30 -18
- jwstflow-0.2.2/src/jwstflow/scaffold/step.py +82 -0
- jwstflow-0.2.2/src/jwstflow/spectra/__init__.py +39 -0
- jwstflow-0.2.2/src/jwstflow/spectra/archival.py +169 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/spectra}/features.py +17 -10
- jwstflow-0.2.2/src/jwstflow/spectra/lines.py +353 -0
- jwstflow-0.2.2/src/jwstflow/spectra/overlaps.py +281 -0
- jwstflow-0.2.2/src/jwstflow/spectra/stitching.py +423 -0
- jwstflow-0.2.0/src/jwstflow/spectra.py → jwstflow-0.2.2/src/jwstflow/spectra/x1d.py +1 -16
- jwstflow-0.2.2/src/jwstflow/steps/__init__.py +106 -0
- jwstflow-0.2.2/src/jwstflow/steps/adapters.py +158 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/steps/descriptions.py +62 -5
- jwstflow-0.2.2/src/jwstflow/steps/interface.py +356 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/steps}/naming.py +7 -2
- jwstflow-0.2.2/src/jwstflow/steps/plugins.py +126 -0
- jwstflow-0.2.2/src/jwstflow/steps/registry.py +247 -0
- jwstflow-0.2.2/src/jwstflow/testing/__init__.py +29 -0
- jwstflow-0.2.2/src/jwstflow/testing/audit.py +93 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/__init__.py +127 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/detector.py +92 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/instruments.py +26 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/observations.py +332 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/scene.py +159 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/stubs.py +556 -0
- jwstflow-0.2.2/src/jwstflow/testing/mock/workflow.py +63 -0
- jwstflow-0.2.2/src/jwstflow/testing/run.py +41 -0
- jwstflow-0.2.2/src/jwstflow/testing/synthetic.py +126 -0
- jwstflow-0.2.0/pyproject.toml +0 -88
- jwstflow-0.2.0/src/jwstflow/clusters.py +0 -724
- jwstflow-0.2.0/src/jwstflow/contrib/__init__.py +0 -1
- jwstflow-0.2.0/src/jwstflow/contrib/mast_compare.py +0 -200
- jwstflow-0.2.0/src/jwstflow/contrib/psf.py +0 -239
- jwstflow-0.2.0/src/jwstflow/contrib/qa.py +0 -690
- jwstflow-0.2.0/src/jwstflow/psf.py +0 -769
- jwstflow-0.2.0/src/jwstflow/qafig.py +0 -391
- jwstflow-0.2.0/src/jwstflow/steps/__init__.py +0 -46
- jwstflow-0.2.0/src/jwstflow/steps/base.py +0 -845
- jwstflow-0.2.0/src/jwstflow/stitching.py +0 -382
- jwstflow-0.2.0/src/jwstflow/testing/__init__.py +0 -290
- jwstflow-0.2.0/src/jwstflow/testing/mock.py +0 -1164
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/__init__.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/miri_lrs.yaml +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/miri_mrs.yaml +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/nirspec_fs.yaml +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/config/presets/nirspec_ifu.yaml +0 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/config}/project.py +0 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/cubes}/apcorr.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/data/__init__.py +0 -0
- {jwstflow-0.2.0/src/jwstflow → jwstflow-0.2.2/src/jwstflow/data}/targets.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/engine/__init__.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/engine/graph.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/engine/state.py +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/py.typed +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/refdata/spectral_features/ice_bands.ecsv +0 -0
- {jwstflow-0.2.0 → jwstflow-0.2.2}/src/jwstflow/refdata/spectral_features/pah_bands.ecsv +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: jwstflow
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Lightweight YAML-driven orchestrator for the official JWST calibration pipeline (NIRSpec + MIRI).
|
|
5
5
|
Keywords: jwst,nirspec,miri,pipeline,stpipe,astronomy
|
|
6
6
|
Author: Lukas Welzel
|
|
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
<p align="center">
|
|
38
38
|
<a href="https://github.com/spacetelescope/jwst"><img alt="jwst" src="https://img.shields.io/badge/jwst-3.x-blue"></a>
|
|
39
39
|
<img alt="python" src="https://img.shields.io/badge/python-%E2%89%A53.12-blue">
|
|
40
|
-
<img alt="tests" src="https://img.shields.io/badge/tests-
|
|
40
|
+
<img alt="tests" src="https://img.shields.io/badge/tests-300%20passing-brightgreen">
|
|
41
41
|
<img alt="status" src="https://img.shields.io/badge/status-alpha-orange">
|
|
42
42
|
</p>
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ Description-Content-Type: text/markdown
|
|
|
45
45
|
jwstflow (pronounced <i>"justflow"</i>) orchestrates the official STScI <a href="https://github.com/spacetelescope/jwst"><code>jwst</code></a>
|
|
46
46
|
calibration pipeline and automates everything around it: data, references, execution, provenance.</p>
|
|
47
47
|
|
|
48
|
-
<img src="docs/jwstflow_logo.png" alt="jwstflow logo" width="240" align="left" hspace="18">
|
|
48
|
+
<img src="https://raw.githubusercontent.com/lwelzel/jwstflow/main/docs/jwstflow_logo.png" alt="jwstflow logo" width="240" align="left" hspace="18">
|
|
49
49
|
|
|
50
50
|
You describe your reduction in one YAML file; the target, where its data
|
|
51
51
|
comes from, and the pipeline stages with their parameters, and jwstflow
|
|
@@ -63,7 +63,11 @@ defend, with every calibration decision one visible line of YAML.
|
|
|
63
63
|
What a reduction looks like, in one (simplified) picture:
|
|
64
64
|
|
|
65
65
|
<p align="center">
|
|
66
|
-
<a href="
|
|
66
|
+
<a href="https://github.com/lwelzel/jwstflow/blob/main/docs/overview_dag.png">
|
|
67
|
+
<img src="https://raw.githubusercontent.com/lwelzel/jwstflow/main/docs/overview_dag.png"
|
|
68
|
+
alt="a simplified jwstflow workflow with its capabilities annotated"
|
|
69
|
+
width="100%">
|
|
70
|
+
</a>
|
|
67
71
|
</p>
|
|
68
72
|
|
|
69
73
|
Every run starts by drawing its own version of this figure, with the
|
|
@@ -73,11 +77,11 @@ so you can inspect what a workflow does before and after it runs.
|
|
|
73
77
|
## Installation
|
|
74
78
|
|
|
75
79
|
```bash
|
|
76
|
-
uv
|
|
80
|
+
uv add jwstflow # core: jwstflow + the official jwst pipeline
|
|
77
81
|
```
|
|
78
82
|
The `psf` extra (`"jwstflow[psf]"`) adds [stpsf](https://stpsf.readthedocs.io)
|
|
79
83
|
for the `psf_cube` step -- per-observation PSF cubes for model comparison
|
|
80
|
-
(see [docs/psf_cubes.md](docs/psf_cubes.md)).
|
|
84
|
+
(see [docs/psf_cubes.md](https://github.com/lwelzel/jwstflow/blob/main/docs/psf_cubes.md)).
|
|
81
85
|
Contributed step packages are separate distributions that register their steps
|
|
82
86
|
with jwstflow on install -- add the ones you have access to:
|
|
83
87
|
```bash
|
|
@@ -85,7 +89,7 @@ uv pip install jwstflow-midas # public contribu
|
|
|
85
89
|
uv pip install git+ssh://git@github.com/<org>/jwstflow-joys # proprietary, e.g. JOYS+
|
|
86
90
|
```
|
|
87
91
|
Your reductions live in a project repository of their own that depends on
|
|
88
|
-
jwstflow (see [docs/guide.md](docs/guide.md), "Projects, targets, runs").
|
|
92
|
+
jwstflow (see [docs/guide.md](https://github.com/lwelzel/jwstflow/blob/main/docs/guide.md), "Projects, targets, runs").
|
|
89
93
|
|
|
90
94
|
Put your credentials in the project root (they are found automatically):
|
|
91
95
|
`.env.crds` with `CRDS_PATH=...`, and `CRDS_SERVER_URL=...`, as well as `.env.mast` with `MAST_API_TOKEN=...`
|
|
@@ -125,8 +129,8 @@ stages:
|
|
|
125
129
|
Outputs land in `reductions/<target>/<run>/` split by calibration level
|
|
126
130
|
(`stage1/ ... stage4/`, `qa/`), raw data is shared per target, and stage
|
|
127
131
|
names come from the steps themselves so every run looks the same everywhere.
|
|
128
|
-
Start from a preset (`extends: preset:nirspec_ifu`; also `
|
|
129
|
-
`miri_mrs`, `miri_imaging`) and override only what your data needs.
|
|
132
|
+
Start from a preset (`extends: preset:nirspec_ifu`; also `nirspec_fs`,
|
|
133
|
+
`nirspec_mos`, `miri_mrs`, `miri_lrs`, `miri_imaging`, `nircam_imaging`) and override only what your data needs.
|
|
130
134
|
|
|
131
135
|
### The rest of the interface
|
|
132
136
|
|
|
@@ -146,8 +150,9 @@ Start from a preset (`extends: preset:nirspec_ifu`; also `nirspec_mos`,
|
|
|
146
150
|
| `init [preset]` | write a starter workflow |
|
|
147
151
|
|
|
148
152
|
Everything is also a Python API (`load_config`, `Runner`); see
|
|
149
|
-
[docs/guide.md](docs/guide.md)
|
|
150
|
-
|
|
153
|
+
[docs/guide.md](https://github.com/lwelzel/jwstflow/blob/main/docs/guide.md)
|
|
154
|
+
for the run model, naming rules, the full YAML reference,
|
|
155
|
+
associations, checkpointing and parallelism.
|
|
151
156
|
|
|
152
157
|
## Custom steps
|
|
153
158
|
|
|
@@ -174,6 +179,43 @@ official products); `jwstflow new-step` scaffolds a step with a passing test
|
|
|
174
179
|
and `jwstflow.testing` runs steps on synthetic data without CRDS or real
|
|
175
180
|
observations.
|
|
176
181
|
|
|
182
|
+
## Coverage
|
|
183
|
+
|
|
184
|
+
By default, jwstflow calibrates nothing itself: every calibration step is the `jwst` pipeline's, so in
|
|
185
|
+
principle it can do anything that `jwst` contains. What it adds around the steps (finding and
|
|
186
|
+
downloading the exposures, building the associations, naming the products, the QA) is where
|
|
187
|
+
a mode is either supported by construction or has been tested by the developers. The table keeps the two
|
|
188
|
+
apart:
|
|
189
|
+
|
|
190
|
+
- **technical**: what the orchestration supports by construction. Pipelines have aliases
|
|
191
|
+
(`detector1`, `image2`, `spec2`, `image3`, `spec3`, `tso3`, `coron3`, `dark`) and any other
|
|
192
|
+
`jwst` pipeline or step runs by its dotted path (e.g. `jwst.pipeline:Ami3Pipeline`);
|
|
193
|
+
downloads take NIRSpec, MIRI, NIRCam and NIRISS; associations are built per exposure or
|
|
194
|
+
grouped by header keywords, with member rules for `background`, `imprint`, `psf`,
|
|
195
|
+
`target_acquisition`, `selfcal` and `sourcecat` exposures; a preset where one exists;
|
|
196
|
+
- **verified**: reduced end to end on real data, the products compared with MAST's
|
|
197
|
+
(`mast_compare`), in [jwstflow-reducer](https://github.com/lwelzel/jwstflow-reducer).
|
|
198
|
+
|
|
199
|
+
| Instrument | Mode | Verified | Technical |
|
|
200
|
+
|---|---|---|---|
|
|
201
|
+
| NIRSpec | IFU | yes | preset `nirspec_ifu` |
|
|
202
|
+
| NIRSpec | fixed slit | -- | preset `nirspec_fs` |
|
|
203
|
+
| NIRSpec | MOS | -- | preset `nirspec_mos` (with the MSA metadata) |
|
|
204
|
+
| NIRSpec | BOTS (time series) | -- | `detector1` -> `spec2` -> `tso3`; no preset |
|
|
205
|
+
| MIRI | MRS | yes | preset `miri_mrs` |
|
|
206
|
+
| MIRI | imaging | yes | preset `miri_imaging` |
|
|
207
|
+
| MIRI | LRS | -- | preset `miri_lrs` (slit); slitless time series via `tso3` |
|
|
208
|
+
| MIRI | coronagraphy | -- | `coron3` with `psf` members |
|
|
209
|
+
| NIRCam | imaging | yes (full frame and subarrays) | preset `nircam_imaging` |
|
|
210
|
+
| NIRCam | coronagraphy | -- | `coron3` with `psf` members |
|
|
211
|
+
| NIRCam | grism and imaging time series | -- | `tso3` |
|
|
212
|
+
| NIRCam | WFSS | -- | no: `spec2` needs direct-image and segmentation-map members that the associations do not build |
|
|
213
|
+
| NIRISS | imaging | -- | `image2` -> `image3` |
|
|
214
|
+
| NIRISS | SOSS | -- | `spec2` -> `tso3` |
|
|
215
|
+
| NIRISS | AMI | -- | `jwst.pipeline:Ami3Pipeline` by its dotted path, with `psf` members |
|
|
216
|
+
| NIRISS | WFSS | -- | no (as for NIRCam) |
|
|
217
|
+
| FGS | -- | -- | no (not a download instrument) |
|
|
218
|
+
|
|
177
219
|
## Citing
|
|
178
220
|
|
|
179
221
|
There is no jwstflow publication yet. If jwstflow contributed to your
|
|
@@ -196,6 +238,6 @@ Issues and contributions are welcome; run `python -m pytest` before a PR
|
|
|
196
238
|
`scripts/test-all.sh` runs every sibling repo's suite from a flat checkout).
|
|
197
239
|
The testing strategy -- unit steps, engine semantics, and complete mock
|
|
198
240
|
ESO-Ha 569 workflows through the real engine with stubbed official pipelines
|
|
199
|
-
(`jwstflow.testing.mock`) -- is described in [docs/testing.md](docs/testing.md).
|
|
241
|
+
(`jwstflow.testing.mock`) -- is described in [docs/testing.md](https://github.com/lwelzel/jwstflow/blob/main/docs/testing.md).
|
|
200
242
|
|
|
201
|
-
License: BSD 3-Clause (see [LICENSE](LICENSE)).
|
|
243
|
+
License: BSD 3-Clause (see [LICENSE](https://github.com/lwelzel/jwstflow/blob/main/LICENSE)).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://github.com/spacetelescope/jwst"><img alt="jwst" src="https://img.shields.io/badge/jwst-3.x-blue"></a>
|
|
5
5
|
<img alt="python" src="https://img.shields.io/badge/python-%E2%89%A53.12-blue">
|
|
6
|
-
<img alt="tests" src="https://img.shields.io/badge/tests-
|
|
6
|
+
<img alt="tests" src="https://img.shields.io/badge/tests-300%20passing-brightgreen">
|
|
7
7
|
<img alt="status" src="https://img.shields.io/badge/status-alpha-orange">
|
|
8
8
|
</p>
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
jwstflow (pronounced <i>"justflow"</i>) orchestrates the official STScI <a href="https://github.com/spacetelescope/jwst"><code>jwst</code></a>
|
|
12
12
|
calibration pipeline and automates everything around it: data, references, execution, provenance.</p>
|
|
13
13
|
|
|
14
|
-
<img src="docs/jwstflow_logo.png" alt="jwstflow logo" width="240" align="left" hspace="18">
|
|
14
|
+
<img src="https://raw.githubusercontent.com/lwelzel/jwstflow/main/docs/jwstflow_logo.png" alt="jwstflow logo" width="240" align="left" hspace="18">
|
|
15
15
|
|
|
16
16
|
You describe your reduction in one YAML file; the target, where its data
|
|
17
17
|
comes from, and the pipeline stages with their parameters, and jwstflow
|
|
@@ -29,7 +29,11 @@ defend, with every calibration decision one visible line of YAML.
|
|
|
29
29
|
What a reduction looks like, in one (simplified) picture:
|
|
30
30
|
|
|
31
31
|
<p align="center">
|
|
32
|
-
<a href="
|
|
32
|
+
<a href="https://github.com/lwelzel/jwstflow/blob/main/docs/overview_dag.png">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/lwelzel/jwstflow/main/docs/overview_dag.png"
|
|
34
|
+
alt="a simplified jwstflow workflow with its capabilities annotated"
|
|
35
|
+
width="100%">
|
|
36
|
+
</a>
|
|
33
37
|
</p>
|
|
34
38
|
|
|
35
39
|
Every run starts by drawing its own version of this figure, with the
|
|
@@ -39,11 +43,11 @@ so you can inspect what a workflow does before and after it runs.
|
|
|
39
43
|
## Installation
|
|
40
44
|
|
|
41
45
|
```bash
|
|
42
|
-
uv
|
|
46
|
+
uv add jwstflow # core: jwstflow + the official jwst pipeline
|
|
43
47
|
```
|
|
44
48
|
The `psf` extra (`"jwstflow[psf]"`) adds [stpsf](https://stpsf.readthedocs.io)
|
|
45
49
|
for the `psf_cube` step -- per-observation PSF cubes for model comparison
|
|
46
|
-
(see [docs/psf_cubes.md](docs/psf_cubes.md)).
|
|
50
|
+
(see [docs/psf_cubes.md](https://github.com/lwelzel/jwstflow/blob/main/docs/psf_cubes.md)).
|
|
47
51
|
Contributed step packages are separate distributions that register their steps
|
|
48
52
|
with jwstflow on install -- add the ones you have access to:
|
|
49
53
|
```bash
|
|
@@ -51,7 +55,7 @@ uv pip install jwstflow-midas # public contribu
|
|
|
51
55
|
uv pip install git+ssh://git@github.com/<org>/jwstflow-joys # proprietary, e.g. JOYS+
|
|
52
56
|
```
|
|
53
57
|
Your reductions live in a project repository of their own that depends on
|
|
54
|
-
jwstflow (see [docs/guide.md](docs/guide.md), "Projects, targets, runs").
|
|
58
|
+
jwstflow (see [docs/guide.md](https://github.com/lwelzel/jwstflow/blob/main/docs/guide.md), "Projects, targets, runs").
|
|
55
59
|
|
|
56
60
|
Put your credentials in the project root (they are found automatically):
|
|
57
61
|
`.env.crds` with `CRDS_PATH=...`, and `CRDS_SERVER_URL=...`, as well as `.env.mast` with `MAST_API_TOKEN=...`
|
|
@@ -91,8 +95,8 @@ stages:
|
|
|
91
95
|
Outputs land in `reductions/<target>/<run>/` split by calibration level
|
|
92
96
|
(`stage1/ ... stage4/`, `qa/`), raw data is shared per target, and stage
|
|
93
97
|
names come from the steps themselves so every run looks the same everywhere.
|
|
94
|
-
Start from a preset (`extends: preset:nirspec_ifu`; also `
|
|
95
|
-
`miri_mrs`, `miri_imaging`) and override only what your data needs.
|
|
98
|
+
Start from a preset (`extends: preset:nirspec_ifu`; also `nirspec_fs`,
|
|
99
|
+
`nirspec_mos`, `miri_mrs`, `miri_lrs`, `miri_imaging`, `nircam_imaging`) and override only what your data needs.
|
|
96
100
|
|
|
97
101
|
### The rest of the interface
|
|
98
102
|
|
|
@@ -112,8 +116,9 @@ Start from a preset (`extends: preset:nirspec_ifu`; also `nirspec_mos`,
|
|
|
112
116
|
| `init [preset]` | write a starter workflow |
|
|
113
117
|
|
|
114
118
|
Everything is also a Python API (`load_config`, `Runner`); see
|
|
115
|
-
[docs/guide.md](docs/guide.md)
|
|
116
|
-
|
|
119
|
+
[docs/guide.md](https://github.com/lwelzel/jwstflow/blob/main/docs/guide.md)
|
|
120
|
+
for the run model, naming rules, the full YAML reference,
|
|
121
|
+
associations, checkpointing and parallelism.
|
|
117
122
|
|
|
118
123
|
## Custom steps
|
|
119
124
|
|
|
@@ -140,6 +145,43 @@ official products); `jwstflow new-step` scaffolds a step with a passing test
|
|
|
140
145
|
and `jwstflow.testing` runs steps on synthetic data without CRDS or real
|
|
141
146
|
observations.
|
|
142
147
|
|
|
148
|
+
## Coverage
|
|
149
|
+
|
|
150
|
+
By default, jwstflow calibrates nothing itself: every calibration step is the `jwst` pipeline's, so in
|
|
151
|
+
principle it can do anything that `jwst` contains. What it adds around the steps (finding and
|
|
152
|
+
downloading the exposures, building the associations, naming the products, the QA) is where
|
|
153
|
+
a mode is either supported by construction or has been tested by the developers. The table keeps the two
|
|
154
|
+
apart:
|
|
155
|
+
|
|
156
|
+
- **technical**: what the orchestration supports by construction. Pipelines have aliases
|
|
157
|
+
(`detector1`, `image2`, `spec2`, `image3`, `spec3`, `tso3`, `coron3`, `dark`) and any other
|
|
158
|
+
`jwst` pipeline or step runs by its dotted path (e.g. `jwst.pipeline:Ami3Pipeline`);
|
|
159
|
+
downloads take NIRSpec, MIRI, NIRCam and NIRISS; associations are built per exposure or
|
|
160
|
+
grouped by header keywords, with member rules for `background`, `imprint`, `psf`,
|
|
161
|
+
`target_acquisition`, `selfcal` and `sourcecat` exposures; a preset where one exists;
|
|
162
|
+
- **verified**: reduced end to end on real data, the products compared with MAST's
|
|
163
|
+
(`mast_compare`), in [jwstflow-reducer](https://github.com/lwelzel/jwstflow-reducer).
|
|
164
|
+
|
|
165
|
+
| Instrument | Mode | Verified | Technical |
|
|
166
|
+
|---|---|---|---|
|
|
167
|
+
| NIRSpec | IFU | yes | preset `nirspec_ifu` |
|
|
168
|
+
| NIRSpec | fixed slit | -- | preset `nirspec_fs` |
|
|
169
|
+
| NIRSpec | MOS | -- | preset `nirspec_mos` (with the MSA metadata) |
|
|
170
|
+
| NIRSpec | BOTS (time series) | -- | `detector1` -> `spec2` -> `tso3`; no preset |
|
|
171
|
+
| MIRI | MRS | yes | preset `miri_mrs` |
|
|
172
|
+
| MIRI | imaging | yes | preset `miri_imaging` |
|
|
173
|
+
| MIRI | LRS | -- | preset `miri_lrs` (slit); slitless time series via `tso3` |
|
|
174
|
+
| MIRI | coronagraphy | -- | `coron3` with `psf` members |
|
|
175
|
+
| NIRCam | imaging | yes (full frame and subarrays) | preset `nircam_imaging` |
|
|
176
|
+
| NIRCam | coronagraphy | -- | `coron3` with `psf` members |
|
|
177
|
+
| NIRCam | grism and imaging time series | -- | `tso3` |
|
|
178
|
+
| NIRCam | WFSS | -- | no: `spec2` needs direct-image and segmentation-map members that the associations do not build |
|
|
179
|
+
| NIRISS | imaging | -- | `image2` -> `image3` |
|
|
180
|
+
| NIRISS | SOSS | -- | `spec2` -> `tso3` |
|
|
181
|
+
| NIRISS | AMI | -- | `jwst.pipeline:Ami3Pipeline` by its dotted path, with `psf` members |
|
|
182
|
+
| NIRISS | WFSS | -- | no (as for NIRCam) |
|
|
183
|
+
| FGS | -- | -- | no (not a download instrument) |
|
|
184
|
+
|
|
143
185
|
## Citing
|
|
144
186
|
|
|
145
187
|
There is no jwstflow publication yet. If jwstflow contributed to your
|
|
@@ -162,6 +204,6 @@ Issues and contributions are welcome; run `python -m pytest` before a PR
|
|
|
162
204
|
`scripts/test-all.sh` runs every sibling repo's suite from a flat checkout).
|
|
163
205
|
The testing strategy -- unit steps, engine semantics, and complete mock
|
|
164
206
|
ESO-Ha 569 workflows through the real engine with stubbed official pipelines
|
|
165
|
-
(`jwstflow.testing.mock`) -- is described in [docs/testing.md](docs/testing.md).
|
|
207
|
+
(`jwstflow.testing.mock`) -- is described in [docs/testing.md](https://github.com/lwelzel/jwstflow/blob/main/docs/testing.md).
|
|
166
208
|
|
|
167
|
-
License: BSD 3-Clause (see [LICENSE](LICENSE)).
|
|
209
|
+
License: BSD 3-Clause (see [LICENSE](https://github.com/lwelzel/jwstflow/blob/main/LICENSE)).
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "jwstflow"
|
|
3
|
+
version = "0.2.2"
|
|
4
|
+
description = "Lightweight YAML-driven orchestrator for the official JWST calibration pipeline (NIRSpec + MIRI)."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
keywords = [
|
|
8
|
+
"jwst",
|
|
9
|
+
"nirspec",
|
|
10
|
+
"miri",
|
|
11
|
+
"pipeline",
|
|
12
|
+
"stpipe",
|
|
13
|
+
"astronomy",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"astropy>=8.0.1",
|
|
23
|
+
"astroquery>=0.4.11",
|
|
24
|
+
"cmasher>=1.9.2",
|
|
25
|
+
"dask>=2026.8.0",
|
|
26
|
+
"distributed>=2026.8.0",
|
|
27
|
+
"jwst>=3.0.0",
|
|
28
|
+
"matplotlib>=3.11.1",
|
|
29
|
+
"numpy>=2.5.2",
|
|
30
|
+
"pandas>=3.0.5",
|
|
31
|
+
"pydantic>=2.13.4",
|
|
32
|
+
"python-dotenv>=1.2.3",
|
|
33
|
+
"pyyaml>=6.0.3",
|
|
34
|
+
"rich>=15.0.0",
|
|
35
|
+
"scipy>=1.18.1",
|
|
36
|
+
"typer>=0.27.1",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[[project.authors]]
|
|
40
|
+
name = "Lukas Welzel"
|
|
41
|
+
email = "welzel@strw.leidenuniv.nl"
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
psf = ["stpsf>=2.0"]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/lwelzel/jwstflow"
|
|
48
|
+
Repository = "https://github.com/lwelzel/jwstflow"
|
|
49
|
+
Issues = "https://github.com/lwelzel/jwstflow/issues"
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
jwstflow = "jwstflow.cli:app"
|
|
53
|
+
|
|
54
|
+
[project.entry-points."jwstflow.steps"]
|
|
55
|
+
stitch_segments = "jwstflow.spectra.stitching:StitchSegments"
|
|
56
|
+
psf_cube = "jwstflow.cubes.psf.steps:PsfCube"
|
|
57
|
+
subtract_psf_neighbour = "jwstflow.cubes.psf.steps:SubtractPsfNeighbour"
|
|
58
|
+
flag_spaxel_clusters = "jwstflow.cubes.clusters.steps:FlagSpaxelClusters"
|
|
59
|
+
propagate_cluster_flags = "jwstflow.cubes.clusters.steps:PropagateClusterFlags"
|
|
60
|
+
flag_gap_outliers = "jwstflow.cubes.gaps.steps:FlagGapOutliers"
|
|
61
|
+
image_astrometry = "jwstflow.images.astrometry.steps:ImageAstrometry"
|
|
62
|
+
stitch_cubes = "jwstflow.cubes.stitching.steps:StitchCubes"
|
|
63
|
+
cube_build_matched = "jwstflow.cubes.stitching.matched:CubeBuildMatched"
|
|
64
|
+
fix_msa_metafile = "jwstflow.data.msa:fix_msa_metafile"
|
|
65
|
+
plot_spectrum = "jwstflow.qa.steps.spectra:PlotSpectrum"
|
|
66
|
+
plot_spectrum_apertures = "jwstflow.qa.steps.spectra:PlotSpectrumApertures"
|
|
67
|
+
plot_archival = "jwstflow.qa.steps.archival:PlotArchival"
|
|
68
|
+
plot_snr = "jwstflow.qa.steps.spectra:PlotSnr"
|
|
69
|
+
plot_spectrum_stages = "jwstflow.qa.steps.spectra:PlotSpectrumStages"
|
|
70
|
+
plot_stitch = "jwstflow.qa.steps.stitch:PlotStitch"
|
|
71
|
+
plot_stitch_overlaps = "jwstflow.qa.steps.stitch:PlotStitchOverlaps"
|
|
72
|
+
plot_stitch_background = "jwstflow.qa.steps.stitch:PlotStitchBackground"
|
|
73
|
+
quicklook_image = "jwstflow.qa.steps.images:QuicklookImage"
|
|
74
|
+
qa_image_summary = "jwstflow.qa.steps.images:QaImageSummary"
|
|
75
|
+
qa_image_astrometry = "jwstflow.qa.steps.images:QaImageAstrometry"
|
|
76
|
+
qa_cube_summary = "jwstflow.qa.steps.cubes:QaCubeSummary"
|
|
77
|
+
qa_cube_slices = "jwstflow.qa.steps.cubes:QaCubeSlices"
|
|
78
|
+
qa_psf_cube = "jwstflow.qa.steps.psf:QaPsfCube"
|
|
79
|
+
qa_psf_neighbour = "jwstflow.qa.steps.psf:QaPsfNeighbour"
|
|
80
|
+
qa_spaxel_clusters = "jwstflow.qa.steps.clusters:QaSpaxelClusters"
|
|
81
|
+
qa_gap_coverage = "jwstflow.qa.steps.gaps:QaGapCoverage"
|
|
82
|
+
qa_cube_stitch = "jwstflow.qa.steps.cube_stitch:QaCubeStitch"
|
|
83
|
+
mast_compare = "jwstflow.qa.steps.mast_compare:MastCompare"
|
|
84
|
+
header_summary = "jwstflow.qa.steps.summary:HeaderSummary"
|
|
85
|
+
|
|
86
|
+
[build-system]
|
|
87
|
+
requires = ["uv_build>=0.12.1,<0.13.0"]
|
|
88
|
+
build-backend = "uv_build"
|
|
89
|
+
|
|
90
|
+
[tool.uv]
|
|
91
|
+
link-mode = "copy"
|
|
92
|
+
|
|
93
|
+
[tool.pytest.ini_options]
|
|
94
|
+
testpaths = [
|
|
95
|
+
"tests",
|
|
96
|
+
"examples",
|
|
97
|
+
]
|
|
98
|
+
markers = ["integration: complete mock-observation workflow through the engine (seconds, offline; deselect with -m 'not integration')"]
|
|
99
|
+
|
|
100
|
+
[dependency-groups]
|
|
101
|
+
dev = [
|
|
102
|
+
"pytest>=9.1.1",
|
|
103
|
+
"ruff>=0.16.4",
|
|
104
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jwstflow"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Lightweight YAML-driven orchestrator for the official JWST calibration pipeline (NIRSpec + MIRI)."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -53,22 +53,41 @@ Issues = "https://github.com/lwelzel/jwstflow/issues"
|
|
|
53
53
|
[project.scripts]
|
|
54
54
|
jwstflow = "jwstflow.cli:app"
|
|
55
55
|
|
|
56
|
-
#
|
|
56
|
+
# jwstflow's own steps, by name: this is the one list. Each entry names the module that *defines* the
|
|
57
|
+
# step (that file is hashed into the task ids and read for `jwstflow steps`).
|
|
57
58
|
[project.entry-points."jwstflow.steps"]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
# data steps: each lives with the feature it implements
|
|
60
|
+
stitch_segments = "jwstflow.spectra.stitching:StitchSegments"
|
|
61
|
+
psf_cube = "jwstflow.cubes.psf.steps:PsfCube"
|
|
62
|
+
subtract_psf_neighbour = "jwstflow.cubes.psf.steps:SubtractPsfNeighbour"
|
|
63
|
+
flag_spaxel_clusters = "jwstflow.cubes.clusters.steps:FlagSpaxelClusters"
|
|
64
|
+
propagate_cluster_flags = "jwstflow.cubes.clusters.steps:PropagateClusterFlags"
|
|
65
|
+
flag_gap_outliers = "jwstflow.cubes.gaps.steps:FlagGapOutliers"
|
|
66
|
+
image_astrometry = "jwstflow.images.astrometry.steps:ImageAstrometry"
|
|
67
|
+
stitch_cubes = "jwstflow.cubes.stitching.steps:StitchCubes"
|
|
68
|
+
cube_build_matched = "jwstflow.cubes.stitching.matched:CubeBuildMatched"
|
|
69
|
+
fix_msa_metafile = "jwstflow.data.msa:fix_msa_metafile"
|
|
70
|
+
# QA steps: jwstflow.qa.steps
|
|
71
|
+
plot_spectrum = "jwstflow.qa.steps.spectra:PlotSpectrum"
|
|
72
|
+
plot_spectrum_apertures = "jwstflow.qa.steps.spectra:PlotSpectrumApertures"
|
|
73
|
+
plot_archival = "jwstflow.qa.steps.archival:PlotArchival"
|
|
74
|
+
plot_snr = "jwstflow.qa.steps.spectra:PlotSnr"
|
|
75
|
+
plot_spectrum_stages = "jwstflow.qa.steps.spectra:PlotSpectrumStages"
|
|
76
|
+
plot_stitch = "jwstflow.qa.steps.stitch:PlotStitch"
|
|
77
|
+
plot_stitch_overlaps = "jwstflow.qa.steps.stitch:PlotStitchOverlaps"
|
|
78
|
+
plot_stitch_background = "jwstflow.qa.steps.stitch:PlotStitchBackground"
|
|
79
|
+
quicklook_image = "jwstflow.qa.steps.images:QuicklookImage"
|
|
80
|
+
qa_image_summary = "jwstflow.qa.steps.images:QaImageSummary"
|
|
81
|
+
qa_image_astrometry = "jwstflow.qa.steps.images:QaImageAstrometry"
|
|
82
|
+
qa_cube_summary = "jwstflow.qa.steps.cubes:QaCubeSummary"
|
|
83
|
+
qa_cube_slices = "jwstflow.qa.steps.cubes:QaCubeSlices"
|
|
84
|
+
qa_psf_cube = "jwstflow.qa.steps.psf:QaPsfCube"
|
|
85
|
+
qa_psf_neighbour = "jwstflow.qa.steps.psf:QaPsfNeighbour"
|
|
86
|
+
qa_spaxel_clusters = "jwstflow.qa.steps.clusters:QaSpaxelClusters"
|
|
87
|
+
qa_gap_coverage = "jwstflow.qa.steps.gaps:QaGapCoverage"
|
|
88
|
+
qa_cube_stitch = "jwstflow.qa.steps.cube_stitch:QaCubeStitch"
|
|
89
|
+
mast_compare = "jwstflow.qa.steps.mast_compare:MastCompare"
|
|
90
|
+
header_summary = "jwstflow.qa.steps.summary:HeaderSummary"
|
|
72
91
|
|
|
73
92
|
[build-system]
|
|
74
93
|
requires = ["uv_build>=0.12.1,<0.13.0"]
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"""jwstflow: a lightweight, YAML-driven orchestrator for the JWST calibration pipeline."""
|
|
2
2
|
|
|
3
|
-
from . import
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from . import qa
|
|
4
6
|
from .config import Config, ConfigError, config_from_dict, load_config
|
|
5
7
|
from .engine.runner import Runner, run_config
|
|
6
|
-
from .steps
|
|
8
|
+
from .steps import RunContext, Step, StepParams, register_step
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version("jwstflow")
|
|
12
|
+
except PackageNotFoundError: # a bare source checkout on PYTHONPATH, not an install
|
|
13
|
+
__version__ = "0+unknown"
|
|
9
14
|
|
|
10
15
|
__all__ = [
|
|
11
16
|
"Config",
|
|
@@ -17,7 +22,7 @@ __all__ = [
|
|
|
17
22
|
"__version__",
|
|
18
23
|
"config_from_dict",
|
|
19
24
|
"load_config",
|
|
20
|
-
"
|
|
25
|
+
"qa",
|
|
21
26
|
"register_step",
|
|
22
27
|
"run_config",
|
|
23
28
|
]
|
|
@@ -21,7 +21,7 @@ from .config import Config, ConfigError, list_presets, load_config, preset_path
|
|
|
21
21
|
from .engine.graph import select_stages
|
|
22
22
|
from .engine.runner import Runner
|
|
23
23
|
from .engine.state import StateStore
|
|
24
|
-
from .steps
|
|
24
|
+
from .steps import activate_plugins, describe_target, registered_steps
|
|
25
25
|
|
|
26
26
|
app = typer.Typer(
|
|
27
27
|
help="Lightweight YAML-driven orchestrator for the JWST calibration pipeline.",
|
|
@@ -61,11 +61,15 @@ def _load(config: Path, overrides: list[str] | None) -> Config:
|
|
|
61
61
|
raise typer.Exit(2) from None
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
@app.callback()
|
|
65
|
-
def _main(
|
|
64
|
+
@app.callback(invoke_without_command=True)
|
|
65
|
+
def _main(ctx: typer.Context,
|
|
66
|
+
version: Annotated[bool, typer.Option("--version", help="Show version and exit.")] = False) -> None:
|
|
66
67
|
if version:
|
|
67
68
|
console.print(f"jwstflow {__version__}")
|
|
68
69
|
raise typer.Exit()
|
|
70
|
+
if ctx.invoked_subcommand is None: # options but no command
|
|
71
|
+
console.print(ctx.get_help())
|
|
72
|
+
raise typer.Exit(2)
|
|
69
73
|
|
|
70
74
|
|
|
71
75
|
# ---------------------------------------------------------------------------
|
|
@@ -232,7 +236,7 @@ def asn(config: ConfigArg, stage: Annotated[str, typer.Argument(help="Stage with
|
|
|
232
236
|
if st.association is None:
|
|
233
237
|
err.print(f"[red]stage {stage!r} has no association section[/red]")
|
|
234
238
|
raise typer.Exit(2)
|
|
235
|
-
from .associations import summarize
|
|
239
|
+
from .engine.associations import summarize
|
|
236
240
|
|
|
237
241
|
tasks = runner.plan_stage(st)
|
|
238
242
|
for t in tasks:
|
|
@@ -300,8 +304,8 @@ def graph(
|
|
|
300
304
|
set_: Annotated[list[str] | None, typer.Option("--set", help="Override config values (key=value).")] = None,
|
|
301
305
|
) -> None:
|
|
302
306
|
"""Render the workflow DAG (data patterns -> steps -> products) without running anything."""
|
|
303
|
-
from .dagviz import render
|
|
304
|
-
from .steps
|
|
307
|
+
from .engine.dagviz import render
|
|
308
|
+
from .steps import LEVEL_DIRS
|
|
305
309
|
|
|
306
310
|
setup_logging("WARNING")
|
|
307
311
|
cfg = _load(config, set_)
|
|
@@ -365,10 +369,10 @@ def new_step(
|
|
|
365
369
|
suffix: Annotated[str | None, typer.Option("--suffix", help="Product suffix written (lowercase alphanumeric)")] = None,
|
|
366
370
|
) -> None:
|
|
367
371
|
"""Scaffold a custom step (documented class + a passing test) following the step contract."""
|
|
368
|
-
from .
|
|
372
|
+
from .scaffold import scaffold_step
|
|
369
373
|
|
|
370
374
|
lvl: int | str = int(level) if level.isdigit() else level
|
|
371
|
-
for f in
|
|
375
|
+
for f in scaffold_step(class_name, directory, level=lvl, inputs=inputs, suffix=suffix):
|
|
372
376
|
console.print(f"wrote {f}")
|
|
373
377
|
console.print(f"next: edit the run() method, then `python -m pytest {directory}` and `jwstflow check-step {directory}/<module>.py:{class_name}`")
|
|
374
378
|
|
|
@@ -381,8 +385,9 @@ def new_package(
|
|
|
381
385
|
private: Annotated[bool, typer.Option("--private", help="Proprietary flavour: restrictive LICENSE, 'Private :: Do Not Upload' classifier, private-repo instructions")] = False,
|
|
382
386
|
git: Annotated[bool, typer.Option("--git/--no-git", help="Initialise a git repository with an initial commit")] = True,
|
|
383
387
|
) -> None:
|
|
384
|
-
"""Scaffold a contributed step package: pyproject with `jwstflow.steps` entry points, src layout
|
|
385
|
-
step stubs, a passing declaration test, README (with a
|
|
388
|
+
"""Scaffold a contributed step package: pyproject with `jwstflow.steps` entry points, src layout
|
|
389
|
+
(`steps/` with one module per step), step stubs, a passing declaration test, README (with a
|
|
390
|
+
publish-to-GitHub walkthrough), CI and git.
|
|
386
391
|
Only scaffolding is generated -- each step's run() awaits your science."""
|
|
387
392
|
from .scaffold import scaffold_package
|
|
388
393
|
|
|
@@ -400,7 +405,7 @@ def new_package(
|
|
|
400
405
|
f"\nnext:\n"
|
|
401
406
|
f" cd {root}\n"
|
|
402
407
|
f" uv sync && uv run python -m pytest # green before any science exists\n"
|
|
403
|
-
f" edit src/{name.replace('-', '_')}/steps
|
|
408
|
+
f" edit src/{name.replace('-', '_')}/steps/<step>.py # one module per step: implement its run()\n"
|
|
404
409
|
f" README.md walks through publishing to GitHub ({'private' if private else 'public'})"
|
|
405
410
|
)
|
|
406
411
|
|
|
@@ -419,7 +424,7 @@ def steps(
|
|
|
419
424
|
from rich.padding import Padding
|
|
420
425
|
from rich.text import Text
|
|
421
426
|
|
|
422
|
-
from .steps
|
|
427
|
+
from .steps import step_description
|
|
423
428
|
|
|
424
429
|
known = registered_steps()
|
|
425
430
|
if name is not None:
|
|
@@ -31,7 +31,7 @@ from typing import Any
|
|
|
31
31
|
import yaml
|
|
32
32
|
from pydantic import ValidationError
|
|
33
33
|
|
|
34
|
-
from ..steps
|
|
34
|
+
from ..steps import activate_plugins, step_identity
|
|
35
35
|
from .schema import RAW_STAGE, Config, slugify
|
|
36
36
|
|
|
37
37
|
EXTENDS_KEY = "extends"
|
|
@@ -259,8 +259,28 @@ def _as_list(value: Any) -> list[Any]:
|
|
|
259
259
|
return list(value) if isinstance(value, (list, tuple)) else [value]
|
|
260
260
|
|
|
261
261
|
|
|
262
|
+
def _env_in_path(value: Any) -> Any:
|
|
263
|
+
"""``${env:VAR}`` / ``${env:VAR,default}`` in a path field resolved before the path is anchored
|
|
264
|
+
(``root``, ``workspace`` and ``download.dest`` are fixed before the rest is interpolated)."""
|
|
265
|
+
if not isinstance(value, str) or "${env:" not in value:
|
|
266
|
+
return value
|
|
267
|
+
|
|
268
|
+
def one(m: re.Match[str]) -> str:
|
|
269
|
+
ref = m.group(1)
|
|
270
|
+
if not ref.startswith("env:"):
|
|
271
|
+
raise ConfigError(f"only ${{env:...}} can be used in a path that is fixed before interpolation: ${{{ref}}}")
|
|
272
|
+
name, comma, default = ref[4:].partition(",")
|
|
273
|
+
if name in os.environ:
|
|
274
|
+
return os.environ[name]
|
|
275
|
+
if comma:
|
|
276
|
+
return default
|
|
277
|
+
raise ConfigError(f"environment variable {name!r} is not set (used as ${{{ref}}})")
|
|
278
|
+
|
|
279
|
+
return _INTERP.sub(one, value)
|
|
280
|
+
|
|
281
|
+
|
|
262
282
|
def _absolute(value: Any, base_dir: Path | None) -> str:
|
|
263
|
-
path = Path(str(value)).expanduser()
|
|
283
|
+
path = Path(str(_env_in_path(value))).expanduser()
|
|
264
284
|
if base_dir is not None and not path.is_absolute():
|
|
265
285
|
path = base_dir / path
|
|
266
286
|
return str(path.resolve())
|
|
@@ -286,7 +306,7 @@ def load_env_files(
|
|
|
286
306
|
"""
|
|
287
307
|
from dotenv import dotenv_values
|
|
288
308
|
|
|
289
|
-
from
|
|
309
|
+
from .project import candidate_env_files
|
|
290
310
|
|
|
291
311
|
candidates: list[tuple[Path, str]] = candidate_env_files(base_dir)
|
|
292
312
|
explicit_paths: list[tuple[Path, str]] = []
|
|
@@ -339,7 +359,7 @@ def _derive_stage_identity(stages: list[Any]) -> None:
|
|
|
339
359
|
|
|
340
360
|
def config_from_dict(data: dict[str, Any], *, base_dir: Path | None = None) -> Config:
|
|
341
361
|
"""Validate an already-composed dict (e.g. from OmegaConf/Hydra)."""
|
|
342
|
-
from
|
|
362
|
+
from .project import find_project_root
|
|
343
363
|
|
|
344
364
|
data = dict(data)
|
|
345
365
|
project_root = find_project_root(base_dir or Path.cwd())
|
|
@@ -386,7 +406,7 @@ def _check_step_parameters(cfg: Config) -> None:
|
|
|
386
406
|
a jwstflow Step that declares one (jwst steps validate their own parameters when they run)."""
|
|
387
407
|
import inspect
|
|
388
408
|
|
|
389
|
-
from ..steps
|
|
409
|
+
from ..steps import BUILTIN_ALIASES, Step, resolve_target
|
|
390
410
|
|
|
391
411
|
for stage in cfg.stages:
|
|
392
412
|
if stage.step in BUILTIN_ALIASES:
|
|
@@ -35,8 +35,8 @@ stages:
|
|
|
35
35
|
association:
|
|
36
36
|
mode: group
|
|
37
37
|
level: 3
|
|
38
|
-
group_by: [PROGRAM, OBSERVTN, FILTER]
|
|
39
|
-
product_name: "jw{PROGRAM}-o{OBSERVTN}_{TARGID}_miri_{
|
|
38
|
+
group_by: [PROGRAM, OBSERVTN, FILTER, SUBARRAY]
|
|
39
|
+
product_name: "jw{PROGRAM}-o{OBSERVTN}_{TARGID}_miri_{OPTELEM}{SUBARRAY_SUFFIX}" # f770w, f770w-brightsky
|
|
40
40
|
parameters:
|
|
41
41
|
steps:
|
|
42
42
|
tweakreg: {skip: false}
|