Overview
Bootstrap PyAutoReduce — a new PyAutoLabs library that reduces archival HST imaging into the modeling-ready datasets PyAutoLens/PyAutoGalaxy load via al.Imaging.from_fits (data.fits, noise_map.fits, psf.fits, psf_full.fits + provenance). Phase 1 targets ACS/WFC at SLACS quality: drizzled 0.05″/pix mosaics, tiered PSF estimation, RMS noise maps with Poisson counts, and a disk-frugal download→reduce→evict flow. This is a research task: the deliverables are the repo, the design docs, and a de-risking spike — production implementation follows as a separate prompt.
Plan
- Create and register the
PyAutoLabs/PyAutoReduce repo (package autoreduce) in the organism.
- Research SLACS / weak-lensing / AGN literature and STScI tooling to ground the design.
- Write design doc A — the thorough HST/ACS pipeline plan (acquire / align / drizzle / noise / PSF / package / validation), defaults-first with documented lensing deviations.
- Write design doc B — roadmap skeleton (WFC3, JWST, per-exposure
_flt products, instrument adapters).
- Run a spike: one SLACS lens end-to-end (MAST → AstroDrizzle → noise map → PSF → cutout) compared against the existing modeling dataset.
- File one follow-up implementation prompt when the design is validated.
Detailed implementation plan
Affected Repositories
- PyAutoReduce (primary, new)
- PyAutoMind (registry: repos.yaml, active.md)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoReduce |
main (new repo) |
clean |
| ./PyAutoMind |
main |
clean |
Suggested branch: work lands on main directly — the repo is new, pre-release, with no downstream consumers; feature-branch/PR conventions begin with the phase-1 implementation task.
Implementation Steps
gh repo create PyAutoLabs/PyAutoReduce (public, MIT); clone to ~/Code/PyAutoLabs/PyAutoReduce.
- Register in
PyAutoMind/repos.yaml (category: library) and run scripts/repos_sync.py --write so routing tables include the repo.
- Package skeleton:
autoreduce/{acquire,align,drizzle,noise,psf,package,instruments}/, test_autoreduce/ (numpy-only import tests), pyproject.toml (core deps astropy/astroquery/photutils; heavy STScI stack behind an [hst] extra; PSF back-ends behind [psf]), README, AGENTS.md/CLAUDE.md.
docs/design/hst_acs_pipeline.md: per-stage default-vs-deviation design — astroquery.mast _flc acquisition with transient size-capped cache + HAPCut path for survey mosaics; a-priori WCS with TweakReg as a triggered fallback; AstroDrizzle (final_scale=0.05, north-up, final_wht_type=IVM, pixfrac/kernel fixed by parity study); noise map σ=√(N/W+σ²_sky) with correlated-noise correction (Bayer et al. 1803.05952, DrizzlePac handbook); tiered PSF (photutils ePSF → TinyTim+focus per Rhodes et al. 2007 → STARRED/PSFr optional), always drizzle-consistent; packaging with intact WCS/provenance headers.
docs/design/roadmap.md: instrument-adapter obligation, WFC3 (hst-lens notebooks as checklist), JWST (calwebb + STPSF), per-exposure frame products, Euclid explicitly out of scope.
- Spike
prototypes/slacs_f814w_spike.py: one SLACS lens end-to-end; data/noise/PSF ratio comparison against /mnt/c/.../slacs/<lens>/; resolves the units question (e-/s vs e-) and the correlated-noise question empirically.
- Review of design docs + spike results, then file
feature/pyautoreduce/hst_acs_phase1.md as the single follow-up prompt.
Key Files
docs/design/hst_acs_pipeline.md — authoritative phase-1 design
docs/design/roadmap.md — later phases skeleton
autoreduce/instruments/ — adapter boundary all later instruments depend on
prototypes/slacs_f814w_spike.py — de-risking spike
Original Prompt
Click to expand starting prompt
I want to make a new project, PyAutoData (but feel free to suggest better names), which performs all data reductions required for PyAutoLens modeling (and also PyAutoGalaxy). First, the focus will be on HST data reduction, making images comparable to the data I am used to modeling (e.g. /mnt/c/Users/Jammy/Science/subhalo/dataset/slacs). It should therefore drizzle the individual exposures to a common mosaic, do PSF estimation, have an RMS noise map including Poisson counts. Future work will include reducing other HST data (e.g. other wavelengths, WFC3), JWST data and other instruments, and producing individual frames for modeling (e.g. _flt images with cosmic rays). My understanding is you will have to download large HST tiles, but ultimately we only need cut-outs of each strong lens, so the project should have tools which exploit this to avoid too much hard disk space being used to store lots of tiles where possible. Read some strong lensing literature to work out how HST data reduction is performed; this github repo may give guidance albeit I think their reduction pipeline is not as high quality as SLACS (https://github.com/ajshajib/hst-lens) and it may also not do ACS. Do deep research in planning this, make a thorough plan for the HST steps and then a follow-up which we will flesh out later to do JWST (and other instruments). Where possible, we should stick to the default data reduction pipeline of each instrument and only add changes or deviations or customizations when required for specific lensing calculations. You will also benefit from trying to find science publications on weak lensing or AGN modeling which describe detailed PSF modeling.
(Name decided in intake: PyAutoReduce.)
Overview
Bootstrap PyAutoReduce — a new PyAutoLabs library that reduces archival HST imaging into the modeling-ready datasets PyAutoLens/PyAutoGalaxy load via
al.Imaging.from_fits(data.fits,noise_map.fits,psf.fits,psf_full.fits+ provenance). Phase 1 targets ACS/WFC at SLACS quality: drizzled 0.05″/pix mosaics, tiered PSF estimation, RMS noise maps with Poisson counts, and a disk-frugal download→reduce→evict flow. This is a research task: the deliverables are the repo, the design docs, and a de-risking spike — production implementation follows as a separate prompt.Plan
PyAutoLabs/PyAutoReducerepo (packageautoreduce) in the organism._fltproducts, instrument adapters).Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch: work lands on
maindirectly — the repo is new, pre-release, with no downstream consumers; feature-branch/PR conventions begin with the phase-1 implementation task.Implementation Steps
gh repo create PyAutoLabs/PyAutoReduce(public, MIT); clone to~/Code/PyAutoLabs/PyAutoReduce.PyAutoMind/repos.yaml(category: library) and runscripts/repos_sync.py --writeso routing tables include the repo.autoreduce/{acquire,align,drizzle,noise,psf,package,instruments}/,test_autoreduce/(numpy-only import tests),pyproject.toml(core deps astropy/astroquery/photutils; heavy STScI stack behind an[hst]extra; PSF back-ends behind[psf]), README, AGENTS.md/CLAUDE.md.docs/design/hst_acs_pipeline.md: per-stage default-vs-deviation design — astroquery.mast_flcacquisition with transient size-capped cache + HAPCut path for survey mosaics; a-priori WCS with TweakReg as a triggered fallback; AstroDrizzle (final_scale=0.05, north-up,final_wht_type=IVM, pixfrac/kernel fixed by parity study); noise map σ=√(N/W+σ²_sky) with correlated-noise correction (Bayer et al. 1803.05952, DrizzlePac handbook); tiered PSF (photutils ePSF → TinyTim+focus per Rhodes et al. 2007 → STARRED/PSFr optional), always drizzle-consistent; packaging with intact WCS/provenance headers.docs/design/roadmap.md: instrument-adapter obligation, WFC3 (hst-lens notebooks as checklist), JWST (calwebb+ STPSF), per-exposure frame products, Euclid explicitly out of scope.prototypes/slacs_f814w_spike.py: one SLACS lens end-to-end; data/noise/PSF ratio comparison against/mnt/c/.../slacs/<lens>/; resolves the units question (e-/s vs e-) and the correlated-noise question empirically.feature/pyautoreduce/hst_acs_phase1.mdas the single follow-up prompt.Key Files
docs/design/hst_acs_pipeline.md— authoritative phase-1 designdocs/design/roadmap.md— later phases skeletonautoreduce/instruments/— adapter boundary all later instruments depend onprototypes/slacs_f814w_spike.py— de-risking spikeOriginal Prompt
Click to expand starting prompt
I want to make a new project, PyAutoData (but feel free to suggest better names), which performs all data reductions required for PyAutoLens modeling (and also PyAutoGalaxy). First, the focus will be on HST data reduction, making images comparable to the data I am used to modeling (e.g. /mnt/c/Users/Jammy/Science/subhalo/dataset/slacs). It should therefore drizzle the individual exposures to a common mosaic, do PSF estimation, have an RMS noise map including Poisson counts. Future work will include reducing other HST data (e.g. other wavelengths, WFC3), JWST data and other instruments, and producing individual frames for modeling (e.g. _flt images with cosmic rays). My understanding is you will have to download large HST tiles, but ultimately we only need cut-outs of each strong lens, so the project should have tools which exploit this to avoid too much hard disk space being used to store lots of tiles where possible. Read some strong lensing literature to work out how HST data reduction is performed; this github repo may give guidance albeit I think their reduction pipeline is not as high quality as SLACS (https://github.com/ajshajib/hst-lens) and it may also not do ACS. Do deep research in planning this, make a thorough plan for the HST steps and then a follow-up which we will flesh out later to do JWST (and other instruments). Where possible, we should stick to the default data reduction pipeline of each instrument and only add changes or deviations or customizations when required for specific lensing calculations. You will also benefit from trying to find science publications on weak lensing or AGN modeling which describe detailed PSF modeling.
(Name decided in intake: PyAutoReduce.)