casa
$Rev:20696$
|
Implements the convolution equation. More...
#include <ConvolutionEquation.h>
Public Member Functions | |
ConvolutionEquation () | |
Construct the ConvolutionEquation. | |
ConvolutionEquation (const Array< Float > &psf, const Array< Float > &dirtyImage) | |
Construct the ConvolutionEquation setting the psf and measured data. | |
ConvolutionEquation (const Array< Float > &psf, const MaskedArray< Float > &dirtyImage) | |
Construct the ConvolutionEquation setting the psf and measured data Even though a MaskedArray is used as an arguement the mask is discarded internally and hence not used by residual(). | |
~ConvolutionEquation () | |
Somewhere I read that a destructor should alway be defined even if it does nothing (as this one does). | |
virtual Bool | evaluate (Array< Float > &result, const LinearModel< Array< Float > > &model) |
Do the convolution of the model supplied by the LinearModel class with the internal psf. | |
Bool | evaluate (Array< Float > &result, const LinearModel< MaskedArray< Float > > &model) |
Do the convolution of the model supplied by the LinearModel class with the internal psf. | |
Bool | evaluate (MaskedArray< Float > &result, const LinearModel< MaskedArray< Float > > &model) |
Do the convolution of the model supplied by the LinearModel class with the internal psf. | |
Bool | evaluate (Array< Float > &result, const IPosition &position, const Float amplitude, const IPosition &modelShape) |
Do the convolution of the a point source model at position 'position' with amplitude 'amplitude' and the internal psf. | |
virtual Bool | residual (Array< Float > &result, const LinearModel< Array< Float > > &model) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution. | |
virtual Bool | residual (Array< Float > &result, Float &chisq, const LinearModel< Array< Float > > &model) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution. | |
virtual Bool | residual (Array< Float > &result, Float &chisq, Array< Float > &mask, const LinearModel< Array< Float > > &model) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution. | |
Bool | residual (Array< Float > &result, const LinearModel< MaskedArray< Float > > &model) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution. | |
Bool | residual (MaskedArray< Float > &result, const LinearModel< MaskedArray< Float > > &model) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution. | |
IPosition | psfSize () |
return the psf size used in the convolution. | |
void | flushPsf () |
release the storage associated with the cached psf. | |
Private Attributes | |
Array< Float > | theMeas |
Array< Float > | thePsf |
IPosition | theRealPsfSize |
IPosition | thePsfOrigin |
Convolver< Float > | theConv |
Implements the convolution equation.
Internal
<h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl>
This class implements convolution within the LinearEquation framework.
This class is used in conjunction with classes like HogbomCleanModel to implement deconvolution algorithms. This class contains the point spread function (psf) and the convolved data (dirty image), and is able to convolve a supplied model with the psf to produce a predicted output (using the evaluate() function), or to subtract the convolved data and produce a residual (using the residual() function).
See the documentation for HogbomCleanModel for an example of how this class can be used to perform deconvolution.
This class also contains specialised functions (like the version of evaluate() for a point source model) that speed up the calculation of the convolution. This specialised version of evaluate() does not need to actually perform the convolution and instead returns a suitable part of the psf (zero padded if necessary). When this function is called this class will get the psf from the convolver and cache it, on the assumption that many evaluations of this function will be requested (as occurs in Clean algorithms).
The size and shape of the psf and the supplied model may be different. The only restriction is that the dimension of the psf must be less than or equal to the dimension of the model. If the dimension of the model is larger than the dimension of the psf then the convolution will be repeated along the slowest moving (last) axis. The dirty image and the supplied model must be the same size and shape.
This class can also operate on MaskedArrays (and models representable by MaskedArrays). But the mask is currently discarded and the convolution performed on the entire supplied model. This may change in the future.
Matrix<Float> psf(4,4), dirty(20,20), model(20,20); .... put some meaningful values into these Arrays...\. // create a convolution equation, and an array model ConvolutionEquation convEqn(psf, dirty); ArrayModel<Float> myModel(model); // now calculate the convolution of the model and the psf Matrix<Float> prediction; convEqn.evaluate(myModel, prediction); // and calculate the difference between the predicted and actual convolution Matrix<Float> residual; convEqn.residual(mymodel, residual)
This class was designed with deconvolution in mind.
Definition at line 123 of file ConvolutionEquation.h.
Construct the ConvolutionEquation.
Until I write some functions for setting the private data the default constructor is essentially useless
casa::ConvolutionEquation::ConvolutionEquation | ( | const Array< Float > & | psf, |
const Array< Float > & | dirtyImage | ||
) |
Construct the ConvolutionEquation setting the psf and measured data.
casa::ConvolutionEquation::ConvolutionEquation | ( | const Array< Float > & | psf, |
const MaskedArray< Float > & | dirtyImage | ||
) |
Construct the ConvolutionEquation setting the psf and measured data Even though a MaskedArray is used as an arguement the mask is discarded internally and hence not used by residual().
Somewhere I read that a destructor should alway be defined even if it does nothing (as this one does).
virtual Bool casa::ConvolutionEquation::evaluate | ( | Array< Float > & | result, |
const LinearModel< Array< Float > > & | model | ||
) | [virtual] |
Do the convolution of the model supplied by the LinearModel class with the internal psf.
Return the answer in result .
Implements casa::LinearEquation< Array< Float >, Array< Float > >.
Bool casa::ConvolutionEquation::evaluate | ( | Array< Float > & | result, |
const LinearModel< MaskedArray< Float > > & | model | ||
) |
Do the convolution of the model supplied by the LinearModel class with the internal psf.
Return the answer in result. This version uses Masked arrays. but the mask is currently discarded internally.
Bool casa::ConvolutionEquation::evaluate | ( | MaskedArray< Float > & | result, |
const LinearModel< MaskedArray< Float > > & | model | ||
) |
Do the convolution of the model supplied by the LinearModel class with the internal psf.
Return the answer in result. This version uses MaskedArrays, but the mask is not currently used. However the model mask is transfered to the result unchanged.
Bool casa::ConvolutionEquation::evaluate | ( | Array< Float > & | result, |
const IPosition & | position, | ||
const Float | amplitude, | ||
const IPosition & | modelShape | ||
) |
Do the convolution of the a point source model at position 'position' with amplitude 'amplitude' and the internal psf.
Return the answer in result.
void casa::ConvolutionEquation::flushPsf | ( | ) |
release the storage associated with the cached psf.
The psf can however still be recovered from the Convolver object
return the psf size used in the convolution.
The returned size does not include any zero padding
virtual Bool casa::ConvolutionEquation::residual | ( | Array< Float > & | result, |
const LinearModel< Array< Float > > & | model | ||
) | [virtual] |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution.
Implements casa::LinearEquation< Array< Float >, Array< Float > >.
virtual Bool casa::ConvolutionEquation::residual | ( | Array< Float > & | result, |
Float & | chisq, | ||
const LinearModel< Array< Float > > & | model | ||
) | [virtual] |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution.
Also return chisq.
Implements casa::LinearEquation< Array< Float >, Array< Float > >.
virtual Bool casa::ConvolutionEquation::residual | ( | Array< Float > & | result, |
Float & | chisq, | ||
Array< Float > & | mask, | ||
const LinearModel< Array< Float > > & | model | ||
) | [virtual] |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution.
Also return chisq, considering a mask image
Implements casa::LinearEquation< Array< Float >, Array< Float > >.
Bool casa::ConvolutionEquation::residual | ( | Array< Float > & | result, |
const LinearModel< MaskedArray< Float > > & | model | ||
) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution.
This version uses Masked arrays. but the mask is currently discarded internally.
Bool casa::ConvolutionEquation::residual | ( | MaskedArray< Float > & | result, |
const LinearModel< MaskedArray< Float > > & | model | ||
) |
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the difference between this and the supplied (presumably measured) convolution.
This version uses Masked arrays. but the mask is currently discarded in the calculations and transfered unchanged from the model to the result.
Convolver<Float> casa::ConvolutionEquation::theConv [private] |
Definition at line 218 of file ConvolutionEquation.h.
Array<Float> casa::ConvolutionEquation::theMeas [private] |
Definition at line 214 of file ConvolutionEquation.h.
Array<Float> casa::ConvolutionEquation::thePsf [private] |
Definition at line 215 of file ConvolutionEquation.h.
Definition at line 217 of file ConvolutionEquation.h.
Definition at line 216 of file ConvolutionEquation.h.