Skip to content

refactor: consolidate oversampled-PSF helpers (convolver + operate/image) #360

Closed

Description

@Jammy2211

Overview

The oversampled-PSF series refactor (PyAutoMind/issued/oversampling_refactor_followup.md, Refactor Agent verdict: too-large score 11 → conservative cut). Behaviour-preserving: the invariant is that both test suites (PyAutoArray, PyAutoGalaxy) and the ground-truth-pinned tests pass unchanged; API guard: none-expected. Effective autonomy: safe (refactor cap).

Scope (this PR)

  • convolver.py: consolidate the four _convolved_*_over_sampled_{np,jax}_from bodies into shared scatter/convolve/bin helpers (np pair + jax pair each share ~80% of their logic, differing only in trailing dims and kernel choice).
  • operate/image.py (PyAutoGalaxy): extract the thrice-duplicated s>1 evaluation-grid switch into one helper.
  • .gitignore: add test_autoarray/output/ (test-run artifacts leaked into a commit once today).

Deferred (recorded, not done)

  • The convolver/ package split (state / real-space / FFT / over-sample modules): high churn for zero behaviour value right now; revisit if the file keeps growing. The np/jax/FFT method-variant duplication that predates the series is likewise left for that split.
  • Dataset validation-helper placement and mapper matrix parameterization: already minimal after review.

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    Refactor implemented — at the ship checkpoint (Heart YELLOW gates the autonomous ship)

    Two local commits, not pushed: PyAutoArray +124/−155 (net −31: the four oversampled helper bodies → two shared engines + thin wrappers; gitignore fix), PyAutoGalaxy +45/−35 (the thrice-duplicated s>1 switch → one _psf_evaluation_grids_from helper).

    Invariant verification (behaviour-preserving)

    Leg Result
    Witness suites PyAutoArray 863, PyAutoGalaxy 946, PyAutoLens 336 — identical counts to main, zero test edits
    Ground-truth pins s=2 reference values reproduced through the refactored helpers
    np/jax parity image 5.6e-17, mapping matrix 2.2e-16
    Review Verdict: CLEAN; API guard: none-expected, none changed

    Deferred (recorded per the Refactor Agent's too-large verdict)

    • The convolver/ package split and the pre-series np/jax/FFT method-variant duplication — high churn, zero behaviour value today; revisit if the file keeps growing.
    • The linear-lp override's local s>1 branch (importing OperateImage there risks circularity for marginal gain).

    Effective level is safe (refactor cap), but the autonomous-ship gate's Heart leg is YELLOW with no launch acknowledgement — parking for the human ship word alongside the docs PR (#235).

    🤖 Generated with Claude Code

  2. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    🚢 Shipped (human-approved): PyAutoArray#361 + PyAutoGalaxy#484, both pending-release, independent (mergeable in either order). Merge on your word.

    🤖 Generated with Claude Code

  3. Jammy2211 commented on Jul 8, 2026

    @Jammy2211
    CollaboratorAuthor

    ✅ Both merged (mains green): PyAutoArray#361, PyAutoGalaxy#484. Refactor complete; the deferred package split stays recorded above for a future pass.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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