Properly implementing a convolution
My response convolves the signal with a non-spherical PSF, which is specified by a field with the same domain as the signal. To avoid issues with periodic boundaries I apply a zero padding, so the exact steps are:
- zero-pad the PSF from the center, apply a Fourier transform and construct a DiagonalOperator from the result
- zero-pad the signal from the right/top and apply a Fourier transform
- apply the PSF-operator to the signal field followed by an inverse Fourier transform
- apply the adjoint signal zero padding operation
- take the real value
The problem with this procedure is that it reduces the flux at the borders of the image, where the PSF smears the additional zeros out to the pixels I'm interested in. I attached two plots to illustrate the problem, on shows how point sources are smeared out to the opposite side of the image without zero padding, the other how the zero padding leaks into the image at the border. The signal contains two point sources which get brighter with with bin number and equally the PSF gets wider.
Has anyone encountered a similar problem before? Or are there any nifty tools to tackle this, I'm not aware of? My approach would be to extend the signal field beyond the data region and to include a mask in the response to account for that. .Or is there a smarter approach?