Skip to content

Feature/psf convolution refactor#389

Merged
Jammy2211 merged 1 commit intomainfrom
feature/psf_convolution_refactor
Feb 23, 2026
Merged

Feature/psf convolution refactor#389
Jammy2211 merged 1 commit intomainfrom
feature/psf_convolution_refactor

Conversation

@Jammy2211
Copy link
Owner

This pull request refactors the handling of point spread functions (PSF) throughout the codebase, replacing the use of Kernel2D with the new Convolver class. The changes affect both core modules and test files, ensuring consistent PSF usage and updating method signatures and import statements accordingly.

Core API and PSF handling updates:

  • Replaced all usages of Kernel2D with Convolver in the main API, including imports in autolens/__init__.py and method signatures such as set_snr_of_snr_light_profiles in tracer.py. [1] [2]
  • Updated all references to PSF shape extraction to use psf.kernel.shape_native instead of psf.shape_native in simulator.py. [1] [2] [3]

Test suite refactoring:

  • Replaced all test PSF constructions from Kernel2D.from_gaussian to Convolver.from_gaussian in test_simulate_and_fit_imaging.py. [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated PSF creation in test_tracer.py to use Convolver with an explicit Array2D kernel.

These changes modernize the codebase's PSF handling, improve clarity, and ensure compatibility with the new Convolver class.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the point spread function (PSF) handling throughout the autolens codebase, replacing the deprecated Kernel2D class with the new Convolver class. This is an architectural improvement that modernizes the PSF handling and aligns with changes in the underlying autoarray library.

Changes:

  • Replaced Kernel2D with Convolver in imports, type annotations, and object instantiation
  • Updated PSF kernel shape access from psf.shape_native to psf.kernel.shape_native throughout the simulator
  • Migrated all test cases to use the new Convolver API

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
autolens/init.py Added Convolver import and removed deprecated Kernel2D import
autolens/lens/tracer.py Updated set_snr_of_snr_light_profiles method signature to accept Convolver instead of Kernel2D
autolens/imaging/simulator.py Updated all PSF kernel shape accesses to use psf.kernel.shape_native instead of psf.shape_native
test_autolens/lens/test_tracer.py Updated test to create PSF using Convolver(kernel=Array2D(...)) pattern
test_autolens/imaging/test_simulate_and_fit_imaging.py Migrated all 8 tests to use Convolver.from_gaussian instead of Kernel2D.from_gaussian

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 39 to 43
tracer.set_snr_of_snr_light_profiles(
grid=grid,
exposure_time=self.exposure_time,
background_sky_level=self.background_sky_level,
)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PSF should be passed to set_snr_of_snr_light_profiles to account for PSF convolution effects on signal-to-noise ratio calculations. The method signature accepts an optional psf parameter (as shown in tracer.py line 1162), and the PSF is available as self.psf (used on lines 46 and 56). According to the method's docstring, the PSF "can change the S/N of the light profile due to spreading out the emission." Add psf=self.psf to the method call.

Copilot uses AI. Check for mistakes.
@Jammy2211 Jammy2211 merged commit dc49594 into main Feb 23, 2026
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants