Learn R Programming

ProFit (version 1.3.3)

profitBruteConv: Low level brute force image convolution

Description

A low level direct C++ implementation of brute force convolution that takes a user supplied image and point spread function (PSF) as inputs. In most situations users should make convolutions using the higher level profitConvolvePSF provided.

Usage

profitBruteConv(image, psf, calcregion=matrix(1,1,1), docalcregion=FALSE,
 plot = FALSE, ...)

Arguments

image

The image matrix to be convolved by the point spread function (PSF).

psf

The point spread function (PSF) image matrix that ProFit will use to convolve the image (should have odd size in both dimensions to prevent the image becoming offset.

calcregion

Matrix; logical image matrix the same size as the input image matrix. If docalcregion=TRUE, then pixels in calcregion that are TRUE (or 1) will have the convolution calculated, pixels with FALSE (or 0) values will be set to 0. This is included to increase computation speed in situations where only a small region of the full image contains the galaxy of interest for fitting. In this case pixels a long way from the segmentation region for the galaxy will not need to be convolved in order to calculate the correct likelihood within the segmentation.

docalcregion

Logical; should the calcregion logical matrix be used to define a subset of pixels to be convolved.

plot

Logical; should a magimage plot of the output be generated?

Further arguments to be passed to magimage. Only relevant is plot=TRUE.

Value

Matrix; image matrix the same size as the input image matrix.

Details

In the regime where one image is significantly (a factor of a few) smaller than the other image, this tends to be faster than FFT based convolution due to the lack of image padding and other overheads. PSF images tend to be only dozens of pixels and images 100s, so brute force convolution is the default convolution algorithm in ProFit. For this low level function the PSF supplied must have odd size in both dimensions or the image will become offset. To alleviate this issue a higher level function profitConvolvePSF is provided, that will re-interpolate the image to force the required odd sizes.

See Also

profitConvolvePSF, profitMakePointSource, profitMakeModel

Examples

Run this code
# NOT RUN {
model = list(
	sersic = list(
		xcen   = c(180, 60),
		ycen   = c(90, 10),
		mag = c(15, 13),
		re  = c(14, 5),
		nser  = c(3, 10),
		ang  = c(46, 80),
		axrat  = c(0.4, 0.6),
		box = c(0.5,-0.5)
	)
)

model.image=profitMakeModel(model=model, dim=c(200,200))$z

# Without convolution:

magimage(model.image)

# With convolution:

magimage(profitBruteConv(image=model.image, psf=profitMakePointSource()))
# }

Run the code above in your browser using DataLab