Skip to content

feat: add point-source light profiles #561

Description

@Jammy2211

Overview

Add a discrete point-source light profile to PyAutoGalaxy for unresolved image-plane emission such as an AGN or star. The standard profile will carry a fitted flux-like intensity and the linear variant will solve that intensity through the existing inversion machinery.

The original prompt's PSF blocker is now gone: PyAutoGalaxy and PyAutoArray support oversampled PSF convolution. The implementation must preserve total point-source flux across ordinary grid binning, adaptive oversampling, PSF convolution, and linear inversion.

Plan

  • Add standard and linear point-source light profiles to the public ag.lp and ag.lp_linear namespaces.
  • Render the point as a discrete delta at the nearest subpixel while preserving total flux when values are binned.
  • Route oversampled PSF evaluation through an unbinned path that retains the parent Grid2D metadata needed by a discrete profile.
  • Cover ordinary, masked, oversampled-PSF, and linear-inversion behavior with focused tests.
  • Keep lensed point-source solving out of scope: ag.ps.PointFlux plus PointSolver remains the API for multiple lensed images.
Detailed implementation plan

Affected Repositories

  • PyAutoGalaxy (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoGalaxy main clean

No existing PyAutoMind task claims PyAutoGalaxy, and no open PR conflict was found.

Suggested branch: feature/point-source-light

Work Classification: Library

Implementation Steps

  1. Add autogalaxy/profiles/light/standard/point_source.py with PointSource(LightProfile).

    • Parameters: centre and intensity.
    • Treat intensity as the total discrete point-source flux.
    • For a Grid2D, find the unmasked detector pixel containing the centre, choose its nearest over-sampled coordinate, and give that coordinate a value scaled by the local subpixel count so subsequent mean-binning preserves intensity.
    • Return zero when the centre lies outside the grid or inside a masked pixel.
    • Keep the calculation xp-compatible and avoid Python branching on model parameters.
  2. Add autogalaxy/profiles/light/linear/point_source.py.

    • Subclass the standard point source plus LightProfileLinear.
    • Omit the free intensity parameter and use the existing unit-intensity mapping-column behavior.
    • Verify conversion back to the standard profile with the solved intensity.
  3. Retain grid metadata during oversampled PSF evaluation.

    • Add a narrow unbinned image-evaluation path for light objects rather than passing bare grid.over_sampled coordinates everywhere.
    • Use the existing AutoArray binned=False decorator contract for ordinary analytic profiles.
    • Update OperateImage and LightProfileLinearObjFuncList.operated_mapping_matrix_override so both standard and linear point sources reach the oversampled Convolver with flux-correct fine-grid values.
    • Do not change PyAutoArray unless implementation proves the existing contract insufficient.
  4. Wire the public/config surface.

    • Export PointSource from the standard and linear light-profile packages, exposing ag.lp.PointSource and ag.lp_linear.PointSource.
    • Add standard and linear prior YAML entries for the centre and standard intensity.
    • Document that this is direct image-plane emission and not a replacement for ag.ps.PointFlux / PointSolver.
  5. Add focused tests.

    • A point at a pixel centre occupies exactly one binned pixel and preserves intensity.
    • Subpixel position and adaptive over-sampling preserve total flux.
    • A centre outside the unmasked region contributes zero.
    • A delta PSF returns the unblurred point.
    • A normalized oversampled PSF gives the expected shifted kernel and preserves total flux.
    • The linear mapping column matches the unit-intensity standard point and the recovered linear intensity converts correctly.
    • Add an end-to-end FitImaging linear-flux recovery test if the focused inversion test does not already exercise the whole path.
  6. Validate.

    • Run the new focused tests.
    • Run python -m pytest test_autogalaxy/.
    • State the public API addition explicitly in the PR.

Key Files

  • autogalaxy/profiles/light/standard/point_source.py — standard discrete profile.
  • autogalaxy/profiles/light/linear/point_source.py — linear variant.
  • autogalaxy/operate/image.py — ordinary and oversampled PSF operation path.
  • autogalaxy/profiles/light/linear/abstract.py — linear operated mapping matrix.
  • autogalaxy/profiles/light/{standard,linear}/__init__.py — public exports.
  • autogalaxy/config/priors/light/{standard,linear}/point_source.yaml — model priors.
  • test_autogalaxy/profiles/light/ and test_autogalaxy/operate/test_image.py — focused coverage.

Scope guard

This task models direct image-plane unresolved emission. Rendering multiple lensed point images still requires the lens equation and remains the responsibility of ag.ps.PointFlux plus the PyAutoLens PointSolver.

Original Prompt

Click to expand starting prompt

We currently does not have implemented a point source of

Type: feature
Target: PyAutoGalaxy
Difficulty: small
Autonomy: safe
Priority: normal
Status: formalised

We currently does not have implemented a point source of light, light profile, which would be a delta function
implemneted in a single pixel in the image. This should be easy to addd, and would be added in the light/profiles
module of autogalaxy.

First it would be added as a standard light profile, and then variants for linear would be added.

For point sources of light, 2d convolution is tricky, as it really requires 2D subsampling of the PSF and convoluiton,
which are features that will be added relatively soon. Thikn about if there are simple approaches we can use to
add this now, but its fine to defer until we have full support for over sampled PSF convolution. In that case,
add some sort of a warning when this light profile is used for modeling.

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