Skip to content

feat: HST/ACS reduction pipeline (phase 1) #2

Description

@Jammy2211

Overview

Implement the HST/ACS reduction pipeline designed and spike-validated under #1, turning prototypes/slacs_f814w_spike.py into production autoreduce code behind the ACS/WFC instrument adapter. docs/design/hst_acs_pipeline.md is the authoritative spec. Autonomous run (--auto, effective level supervised): plan recorded here, mechanical stretches proceed, judgment gates arrive as batched questions, the run parks at ship sign-off — merge stays human.

Routing note: the Brain Feature Agent's heuristic suggested re-homing as research; overridden in-session because the research phase (design docs + parity spike) completed under #1 with user approval — this task is implementation.

Plan

  • Target spec + pipeline orchestrator: a per-target declaration (name, coords, filter, cutout size, dials) driving acquire → align → drizzle → noise → psf → package.
  • Acquire: filtered MAST query (direct CAL-2 observations, HAP skycells excluded), _flc download, CRDS best-references sync, size-capped transient cache with manifest + eviction.
  • Drizzle: AstroDrizzle wrapper with user-facing pixfrac/kernel dials, WHT-uniformity diagnostic + correlated-noise factor R reported per run; single-exposure branch (single-image drizzle, CR handling via DQ + L.A. Cosmic-style masking decision recorded).
  • Noise: σ = √(N/W + σ²_sky) with R applied; loud failure on NaN/zero weights inside the cutout.
  • PSF: tier-1 empirical ePSF (star selection + photutils EPSFBuilder) with quality diagnostics; tier-2 fallback interface (STScI focus-diverse ePSF grid / TinyTim) — implemented if mechanical, else parked as a batched question.
  • Package: WCS-intact cutouts + reduction.json provenance.
  • Tests: numpy/astropy-only unit tests (noise math, R factor, cache manifest/eviction, cutout geometry, adapter registry, star filters on synthetic data); network/drizzlepac integration lives in scripts/.
  • Acceptance: re-reduce slacs0008-0004 through the production pipeline; parity vs legacy dataset; chase the spike's ~7% flux offset with visit-filtered exposure set + sub-pixel registration. Comparative PyAutoLens fits are expected to park as a sign-off question (long runs).
Detailed implementation plan

Affected Repositories

  • PyAutoReduce (primary, only)

Branch Survey

Repository Current Branch Dirty?
./PyAutoReduce main clean

Suggested branch: feature/hst-acs-phase1 (in-place — single-repo task, new repo, no parallel claims; precedent: clone-mitosis-agent)

Implementation Steps

  1. autoreduce/target.pyTargetSpec (name, ra, dec, instrument, filter, cutout_shape, pixfrac, kernel, final_scale, proposal filter) loadable from YAML; autoreduce/pipeline.py — stage orchestrator with per-stage provenance accumulation.
  2. autoreduce/instruments/acs_wfc.py — adapter: native scale, product suffix (_flc), jref env key, default drizzle params, zero-point/units helpers; instruments/__init__.py registry; nothing outside the adapter names a detector.
  3. autoreduce/acquire/mast.py — query (direct calib-level-2 obs only, proposal/visit grouping), FLC product filter, download; acquire/crds.py — bestrefs sync into cache; acquire/cache.py — manifest, size cap, per-target eviction sparing references.
  4. autoreduce/align/diagnostics.py — a-priori WCS acceptance check; TweakReg call behind a trigger flag.
  5. autoreduce/drizzle/combine.py — AstroDrizzle wrapper (dials, cps, IVM, north-up 0.05″), single-exposure branch, WHT RMS/median diagnostic, R computation (Casertano) recorded.
  6. autoreduce/noise/rms.py — sigma map from SCI+WHT+EXPTIME with R applied; NaN/zero-weight loud failure; blank-sky empirical check helper.
  7. autoreduce/psf/stars.py + psf/epsf.py — star selection (unsaturated, uncrowded, DQ-clean, point-like) + EPSFBuilder wrapper emitting 21×21 + 61×61 kernels, odd/centred/normalised, diagnostics to provenance; psf/fallback.py — tier-2 interface.
  8. autoreduce/package/cutout.py + package/provenance.py — WCS-correct cutouts, reduction.json.
  9. test_autoreduce/ — unit tests per module (numpy/astropy only; drizzlepac/astroquery imports guarded so the suite runs without them).
  10. scripts/reduce_slacs0008.py — integration: production pipeline end-to-end on slacs0008-0004 + parity report vs legacy dataset.

Key Files

  • docs/design/hst_acs_pipeline.md — the spec, incl. deviation table + parity appendix
  • prototypes/slacs_f814w_spike.py — validated reference implementation

Original Prompt

Click to expand starting prompt

See PyAutoMind/issued/hst_acs_phase1.md (filed from feature/pyautoreduce/hst_acs_phase1.md) — scope: production implementation of the design-doc pipeline, user-facing pixfrac/kernel dials, SLACS-V single-exposure branch, parity acceptance on 2–3 SLACS lenses including PyAutoLens fits agreeing on both reductions, numpy-only unit tests, ~/venv/PyAuto extension under constraints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions