Ticket #1198 (closed enhancement)
Convolution is too slow with a spatially varying Linear Combination Kernel that has many basis kernels
Reported by: | rowen | Owned by: | rowen |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | afw | Keywords: | |
Cc: | becker, rhl, rowen, bick, fergal | Blocked By: | |
Blocking: | Project: | LSST | |
Version Number: | |||
How to repeat: |
Description (last modified by rowen) (diff)
Convolution is too slow with a spatially varying Linear Combination Kernel that has many basis kernels. Convolution with a spatially varying Linear Combination Kernel always proceeds by convolving the input image by each basis kernel separately and adding the resulting convolved images together in the appropriate linear combination. This technique is appropriate for a small number of basis kernels, but will be slower than simply computing the kernel image at each point if the number of basis kernels is too large.
This is slowing down difference imaging using the Alard-Lupton basis kernels.
Furthermore, we should consider techniques such as only computing the kernel image at a grid of points (e.g. spaced as far apart as the kernel width) that would further speed up convolution.
We may be able to get through DC3b by simply limiting the number of basis kernels used, but in the long run I think we need some ability to tune the convolution algorithm.
Change History
comment:2 Changed 9 years ago by rowen
- Status changed from new to assigned
- Description modified (diff)
comment:3 Changed 9 years ago by rowen
I will implement linear interpolation, as suggested by Mike Jarvis.
comment:5 Changed 9 years ago by rowen
- Status changed from inTicketWork to closed
Fixed on the trunk in revision 15035. Thanks to Mike Jarvis for the basic algorithm! Changes include:
- Added class afw::math::ConvolutionControl?. This includes the parameter maxInterpolationError which controls how accurate the interpolated kernel must be for interpolation to be used. The default value of 1.0e-9 appears to give output images good to within 1% or so based on the unit tests.
- Added a new version of the afw:;math::convolve function that takes a ConvolutionControl?. The old version of this function still exists for backwards compatibility, but is deprecated.
- Added function afw::math::scaledPlus(outImage, coeff0, inImage0, coeff1, inImage1)
- Moved afw::math::basicConvolve into afw::math::detail; if you used this function you will have to modify your code.