Conversation
There was a problem hiding this comment.
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
Kernel2DwithConvolverin imports, type annotations, and object instantiation - Updated PSF kernel shape access from
psf.shape_nativetopsf.kernel.shape_nativethroughout the simulator - Migrated all test cases to use the new
ConvolverAPI
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.
| tracer.set_snr_of_snr_light_profiles( | ||
| grid=grid, | ||
| exposure_time=self.exposure_time, | ||
| background_sky_level=self.background_sky_level, | ||
| ) |
There was a problem hiding this comment.
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.
This pull request refactors the handling of point spread functions (PSF) throughout the codebase, replacing the use of
Kernel2Dwith the newConvolverclass. 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:
Kernel2DwithConvolverin the main API, including imports inautolens/__init__.pyand method signatures such asset_snr_of_snr_light_profilesintracer.py. [1] [2]psf.kernel.shape_nativeinstead ofpsf.shape_nativeinsimulator.py. [1] [2] [3]Test suite refactoring:
Kernel2D.from_gaussiantoConvolver.from_gaussianintest_simulate_and_fit_imaging.py. [1] [2] [3] [4] [5] [6] [7] [8]test_tracer.pyto useConvolverwith an explicitArray2Dkernel.These changes modernize the codebase's PSF handling, improve clarity, and ensure compatibility with the new
Convolverclass.