@@ -20,6 +20,7 @@ def __init__(
2020 background_sky_level : float = 0.0 ,
2121 subtract_background_sky : bool = True ,
2222 psf : Kernel2D = None ,
23+ use_real_space_convolution : bool = True ,
2324 normalize_psf : bool = True ,
2425 add_poisson_noise_to_data : bool = True ,
2526 include_poisson_noise_in_noise_map : bool = True ,
@@ -69,7 +70,12 @@ def __init__(
6970 subtract_background_sky
7071 If `True`, the background sky level is subtracted from the simulated dataset, otherwise it is left in.
7172 psf
72- An array describing the PSF kernel of the image.
73+ An array describing the PSF kernel of the image, if None no PSF convolution is applied.
74+ use_real_space_convolution
75+ If `True`, the PSF convolution is performed in real space, if `False` it is performed in Fourier space.
76+ Real space convolution avoids aliasing effects that can occur in Fourier space convolution, but is slower.
77+ If the PSF kernel is small (e.g. 11x11) then real space convolution is recommended, whereas if the PSF
78+ kernel is large (e.g. 51x51) then Fourier space convolution with care to pad the image to avoid aliasing is recommended.
7379 normalize_psf
7480 If `True`, the PSF kernel is normalized so all values sum to 1.0.
7581 add_poisson_noise_to_data
@@ -91,6 +97,7 @@ def __init__(
9197 else :
9298 self .psf = Kernel2D .no_blur (pixel_scales = 1.0 )
9399
100+ self .use_real_space_convolution = use_real_space_convolution
94101 self .exposure_time = exposure_time
95102 self .background_sky_level = background_sky_level
96103 self .subtract_background_sky = subtract_background_sky
@@ -129,7 +136,12 @@ def via_image_from(
129136 pixel_scales = image .pixel_scales ,
130137 )
131138
132- image = self .psf .convolved_image_from (image = image , blurring_image = None , xp = xp )
139+ if self .use_real_space_convolution :
140+ image = self .psf .convolved_image_via_real_space_from (
141+ image = image , blurring_image = None , xp = xp ,
142+ )
143+ else :
144+ image = self .psf .convolved_image_from (image = image , blurring_image = None , xp = xp )
133145
134146 image = image + background_sky_map
135147
0 commit comments