Skip to content

research: plan the Keck NIRC2 AO reduction workflow (SHARP context) #9

Description

@Jammy2211

Overview

Plan how PyAutoReduce reduces Keck adaptive-optics (NIRC2) imaging of strong lenses into modeling-ready datasets for PyAutoLens/PyAutoGalaxy, alongside the existing HST (ACS/WFC3) and JWST (NIRCam) phases. The scientific grounding comes from the SHARP programme (Strong-lensing at High Angular Resolution Programme) papers, which are the reference practice for AO strong-lens imaging. Deliverable is a design/plan document (docs/design/keck_ao.md), not code — implementation phases become follow-up prompts.

This run is --auto at effective level supervised (research cap). Plan below per the autonomy contract; judgment forks will be batched as comments here.

Plan

  • Read the SHARP survey papers (Fassnacht, Chen, Vegetti, McKean et al.) plus the standard Keck/NIRC2 reduction references (NIRC2 distortion solutions, the KAI pipeline) and extract what AO imaging demands of a lensing reduction — above all the time-variable, poorly-known AO PSF.
  • Survey existing NIRC2 reduction tooling and decide wrap-vs-implement per PyAutoReduce's "default pipelines first" boundary.
  • Map the AO reduction onto PyAutoReduce's stage architecture (acquire/align/drizzle/noise/psf/package + instruments/ adapters); identify genuinely new stages (sky subtraction, PSF estimation strategy) vs per-stage deltas.
  • Choose a validation anchor: a SHARP lens with public Keck Observatory Archive (KOA) NIRC2 data, with defined quality/parity checks.
  • Write docs/design/keck_ao.md (per-stage deltas vs the HST design, following jwst.md) and update docs/design/roadmap.md.
  • Enumerate implementation phases as follow-up PyAutoMind prompts.

Sequencing note: PyAutoReduce is currently claimed by refactor-post-phase3 (#8, in-place). The research legs are read-only and proceed now, with findings and the draft design content landing on this issue; the repo-write leg (keck_ao.md + roadmap + PR) is parked until that task ships. If the refactor changes the stage/module layout, the design doc adopts the post-refactor names before writing.

Detailed implementation plan

Work Classification

Library (PyAutoReduce) — design doc only, no source changes in this task.

Affected Repositories

  • PyAutoReduce (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoReduce refactor/post-phase3-consolidation clean (claimed in-place by refactor-post-phase3)

Suggested branch: feature/keck-ao-reduction-plan (created only for the write leg, in a task worktree — the main checkout stays with the refactor)
Worktree root: ~/Code/PyAutoLabs-wt/keck-ao-reduction-plan/ (deferred until the write leg unblocks)

Implementation Steps

  1. Literature pass — SHARP series papers (the AO-imaging lens-modelling and H0 papers carry the most reduction detail, esp. PSF handling); NIRC2 geometric-distortion solutions (Yelda et al. 2010, Service et al. 2016); the KAI (Keck AO Imaging) pipeline as the community reduction baseline. Extract per-stage requirements: calibration (darks/flats/bad-pixel), sky subtraction, distortion correction, frame registration + coaddition, noise-map construction, PSF strategy.
  2. Requirements → architecture mapping — table of PyAutoReduce stages vs AO needs: acquire (KOA archive access, e.g. PyKOA/astroquery vs MAST), align/drizzle (dewarp + shift-and-add vs drizzle of dithered frames), noise (read noise + Poisson + sky-dominated regime), psf (the AO-specific problem: field-star PSF, PSF-as-free-model, reconstruction — what the output contract psf.fits/psf_full.fits should mean when the PSF is uncertain), package (unchanged al.Imaging.from_fits contract).
  3. Wrap-vs-implement per stage — deviation from community-standard tooling must be justified by a lensing requirement (repo boundary rule).
  4. Validation anchor — pick a SHARP lens with public KOA NIRC2 narrow-camera data; define checks (astrometric parity vs HST imaging of the same lens, photometric sanity, noise-map statistics, PSF sanity/fit quality).
  5. Write the design docdocs/design/keck_ao.md mirroring jwst.md's "per-stage deltas vs the HST design" pattern + roadmap update. (Parked leg — needs the PyAutoReduce claim.)
  6. Follow-up prompts — phase decomposition for implementation (e.g. instruments/nirc2 adapter, sky stage, PSF stage extension).

Key Files

  • docs/design/keck_ao.md — the deliverable (new)
  • docs/design/roadmap.md — ground-based/AO section update
  • docs/design/hst_acs_pipeline.md — the baseline design the deltas are written against
  • docs/design/jwst.md — the per-stage-delta pattern to follow
  • autoreduce/instruments/ — adapter pattern the plan must respect

Original Prompt

Click to expand starting prompt

Plan the Keck adaptive-optics (NIRC2 AO) data-reduction workflow

Type: research
Target: PyAutoReduce
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised

Original request: "For PyAutoReduce can you plan out how we reduce keck-AO data, read SHARP papers for scientific context."

Plan the Keck adaptive-optics (NIRC2 AO) imaging data-reduction workflow for PyAutoReduce — how raw Keck AO data becomes modeling-ready datasets for PyAutoLens/PyAutoGalaxy, alongside the existing HST (ACS/WFC3) and JWST (NIRCam) phases. Read the SHARP (Strong-lensing High Angular Resolution Programme) papers for scientific context on AO strong-lens imaging — PSF handling (AO PSFs are time-variable and poorly known, unlike HST/JWST), sky subtraction, distortion correction, and coaddition. Deliverable is a design/plan document, not code.

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