LatConvEquation.h

Classes

LatConvEquation -- Implements the convolution equation (full description)

class LatConvEquation: public LinearEquation< Lattice<Float>, Lattice<Float> >

Interface

Public Members
LatConvEquation(Lattice<Float> & psf, Lattice<Float> & dirtyImage)
virtual ~LatConvEquation()
virtual Bool evaluate(Lattice<Float> & result, const LinearModel< Lattice<Float> > & model)
Lattice<Float> * evaluate(const IPosition & position, const Float amplitude, const IPosition & modelShape)
Bool evaluate(Array<Float> & result, const IPosition & position, const Float amplitude, const IPosition & modelShape)
virtual Bool residual(Lattice<Float> & result, const LinearModel< Lattice<Float> > & model)
virtual Bool residual(Lattice<Float> & result, Float & chisq, const LinearModel< Lattice<Float> > & model)
virtual Bool residual(Lattice<Float> & result, Float & chisq, Lattice<Float> & mask, const LinearModel< Lattice<Float> > & model)
IPosition psfSize()
Protected Members
LatConvEquation()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This class implements convolution within the LinearEquation framework.

Synopsis

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.

Example

    PagedArray<Float> psf(2,4,4), dirty(2,20,20), model(2,20,20);
    .... put some meaningful values into these Lattices....
    // create a convolution equation, and a PagedArray model
    LatConvEquation convEqn(psf, dirty);
    LinearModel< Lattice<Float> > myModel(model);
    // now calculate the convolution of the model and the psf
    PagedArray<Float> prediction;
    convEqn.evaluate(myModel, prediction);
    // and calculate the difference between the predicted and actual convolution
    PagedArray<Float> residual;
    convEqn.residual(mymodel, residual)
    

Motivation

This class was designed with deconvolution in mind.

To Do

Member Description

LatConvEquation(Lattice<Float> & psf, Lattice<Float> & dirtyImage)

Construct the LatConvEquation setting the psf and measured data

virtual ~LatConvEquation()

destroy

virtual Bool evaluate(Lattice<Float> & result, const LinearModel< Lattice<Float> > & model)

Do the convolution of the model supplied by the LinearModel class with the internal psf. Return the answer in result .

Lattice<Float> * evaluate(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.

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. Return the answer in result, which is an array Calling this will result in throwing away creating a new PSF owned by this object;

virtual Bool residual(Lattice<Float> & result, const LinearModel< Lattice<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(Lattice<Float> & result, Float & chisq, const LinearModel< Lattice<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. Also return chisq.

virtual Bool residual(Lattice<Float> & result, Float & chisq, Lattice<Float> & mask, const LinearModel< Lattice<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. Also return chisq, considering mask

IPosition psfSize()

return the psf size used in the convolution. The returned size does not include any zero padding

LatConvEquation()

Don't use this one, due to the Lattice &