Skip to content

feat: jax.jit(analysis.fit_from) for FitPointDataset (point-source) #457

Closed

Description

@Jammy2211

Overview

Extend Path A (jax.jit-wrapped analysis.fit_from) to FitPointDataset.
The imaging and interferometer MGE variants are already shipped; this is the
point-source analogue, which has a structurally different data layer (positions
instead of pixel/visibility arrays) and a PointSolver iterative root-finder.

Plan

  • Add _register_fit_point_pytrees in PyAutoLens/autolens/point/model/analysis.py mirroring the imaging wiring
  • Scaffold autolens_workspace_test/scripts/jax_likelihood_functions/point_source/point_pytree.py from mge_pytree.py + reference point_source/point.py
  • Register surfacing types: FitPointDataset, PointDataset, PointSolver (aux — internal solver state is static)
  • If the position solver surfaces a non-JIT-safe op, stop and write up the blocker
Detailed implementation plan

Affected Repositories

  • autolens_workspace_test (primary — new PoC script)
  • PyAutoLens (new _register_fit_point_pytrees site + FitPointDataset registration)

Work Classification

Both — library + workspace.

Branch

Suggested branch: feature/fit-point-pytree
Worktree root: ~/Code/PyAutoLabs-wt/fit-point-pytree/

Implementation Steps

  1. Scaffold autolens_workspace_test/scripts/jax_likelihood_functions/point_source/point_pytree.py from reference point_source/point.py
  2. Add _register_fit_point_pytrees in PyAutoLens/autolens/point/model/analysis.py mirroring autolens/imaging/model/analysis.py
  3. Run the PoC; iterate pytree registration on each failing type
  4. Run PyAutoLens test suite inside the worktree

Key Files

  • PyAutoLens/autolens/point/model/analysis.py — new registration site
  • PyAutoLens/autolens/point/fit/fit_point_dataset.py — FitPointDataset class
  • PyAutoLens/autolens/point/solver/ — PointSolver (likely aux)

Original Prompt

Click to expand starting prompt

See admin_jammy/prompt/issued/fit_point_pytree.md.

Activity

  1. Jammy2211 commented on Apr 19, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped — 2026-04-19

    PRs

    Summary

    Enabled jax.jit(analysis.fit_from)(instance) for AnalysisPoint. Registered FitPointDataset, Tracer, and FitPositionsImagePair[All|Repeat|Pair] as JAX pytrees via a new _register_fit_point_pytrees classmethod called from fit_from when use_jax=True. Round-trip agreement verified against NumPy.

    Session Notes

    • ps.Point / ps.PointFlux are handled by autofit.jax.pytrees.register_model; registering them a second time raises Duplicate custom PyTreeDef type registration. Left to the existing path.
    • _data / _noise_map on FitPositionsImagePair* are ArrayIrregular (NumPy-only). Treating them as per-analysis constants (no_flatten) is correct because the observed positions come from the on-disk PointDataset, not from traced model output.
    • Solver state is already aux (no_flatten on each FitPositions*); no iterative-solver blockers surfaced.
  2. Jammy2211 commented on May 28, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped via #458. Closing.

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