Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/profitConvolvePSF.R
A high level interface to fast convolution that takes a user supplied image and point spread function (PSF) as inputs. This routine calls lower level functions like profitBruteConv
and also implements FFT-based convolution using either R's built-in FFT or the 'fftw' interface to the FFTW library (the latter is usually significantly faster).
1 2 |
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. This can have odd sizes in each dimension. If the dimension has an even size then the function will internally interpolate it onto an odd sized grid 1 element larger. The PSF will be automatically rescaled so it sums to 1 before convolution to ensure flux conservation in the model. |
options |
Additional options for model convolution parsed as a list. option$method inputs allowed are Bruteconv (brute force convolution), FFTconv (FFT convolution using the R |
calcregion |
Logical 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. |
sky |
Numeric scalar; the sky level of the image. This is important to ensure the convolution works well at the edges, since the padded regions outside the image bounds will be effectively set to the sky value. If this is much higher of lower than the true sky then you may see artefacts. |
plot |
Logical; should a |
... |
Further arguments to be passed to |
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 standard approach used in ProFit. This function offers a convenient high level interface to link{profitBruteConv}
, which can only accept odd size dimensions for the PSF.
Matrix; convolved image matrix the same size as the input image matrix.
Aaron Robotham & Dan Taranu
profitBruteConv
, profitMakePointSource
, profitBenchmarkConv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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
psf=profitMakeGaussianPSF()
#Do some benchmarking:
temp=profitBenchmarkConv(model.image, psf=psf)
#Check the best:
temp$best
#And we can use all three:
magimage(profitConvolvePSF(model.image, psf, options=list(method='Bruteconv')))
magimage(profitConvolvePSF(model.image, psf, options=list(method='FFTconv', fft=temp$fft)))
magimage(profitConvolvePSF(model.image, psf, options=list(method='FFTWconv', fft=temp$fft)))
|
Loading required package: FITSio
Loading required package: LaplacesDemon
Loading required package: magicaxis
Loading required package: MASS
Loading required package: plotrix
Loading required package: sm
Package 'sm', version 2.2-5.6: type help(sm) for summary information
Attaching package: 'sm'
The following object is masked from 'package:MASS':
muscle
Loading required package: mapproj
Loading required package: maps
Loading required package: R2Cuba
Loading required package: RColorBrewer
Warning message:
no DISPLAY variable so Tk is not available
[1] "Bruteconv 5.310e+01 ms, FFTconv 2.530e+01 ms, FFTWconv 2.010e+01 ms"
$name
[1] "FFTWconv"
$time
[1] 1.632
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.