casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
casacore::LatticeCleaner< T > Class Template Reference

A class for doing multi-dimensional cleaning. More...

#include <LatticeCleaner.h>

Inheritance diagram for casacore::LatticeCleaner< T >:
casacore::MultiTermLatticeCleaner< T >

Public Member Functions

 LatticeCleaner ()
 Create a cleaner : default constructor. More...
 
 LatticeCleaner (const Lattice< T > &psf, const Lattice< T > &dirty)
 Create a cleaner for a specific dirty image and PSF. More...
 
 LatticeCleaner (const LatticeCleaner< T > &other)
 The copy constructor uses reference semantics. More...
 
LatticeCleaner< T > & operator= (const LatticeCleaner< T > &other)
 The assignment operator also uses reference semantics. More...
 
 ~LatticeCleaner ()
 The destructor does nothing special. More...
 
void update (const Lattice< T > &dirty)
 Update the dirty image only. More...
 
Bool setscales (const Int nscales, const Float scaleInc=1.0)
 Set a number of scale sizes. More...
 
Bool setscales (const Vector< Float > &scales)
 Set a specific set of scales. More...
 
Bool setcontrol (CleanEnums::CleanType cleanType, const Int niter, const Float gain, const Quantity &aThreshold, const Quantity &fThreshold, const Bool choose=True)
 Set up control parameters cleanType - type of the cleaning algorithm to use (HOGBOM, MULTISCALE) niter - number of iterations gain - loop gain used in cleaning (a fraction of the maximum subtracted at every iteration) aThreshold - absolute threshold to stop iterations fThreshold - fractional threshold (i.e. More...
 
Bool setcontrol (CleanEnums::CleanType cleanType, const Int niter, const Float gain, const Quantity &threshold, const Bool choose=True)
 This version of the method disables stopping on fractional threshold. More...
 
Int iteration () const
 return how many iterations we did do More...
 
Int numberIterations () const
 
void startingIteration (const Int starting=0)
 what iteration number to start on More...
 
Int clean (Lattice< T > &model, LatticeCleanProgress *progress=0)
 Clean an image. More...
 
void setMask (Lattice< T > &mask, const T &maskThreshold=T(0.9))
 Set the mask mask - input mask lattice maskThreshold - if positive, the value is treated as a threshold value to determine whether a pixel is good (mask value is greater than the threshold) or has to be masked (mask value is below the threshold). More...
 
void ignoreCenterBox (Bool huh)
 Tell the algorithm to NOT clean just the inner quarter (This is useful when multiscale clean is being used inside a major cycle for MF or WF algorithms) if True, the full image deconvolution will be attempted. More...
 
void setSmallScaleBias (const Float x=0.5)
 Consider the case of a point source: the flux on all scales is the same, and the first scale will be chosen. More...
 
void stopAtLargeScaleNegative ()
 During early iterations of a cycled MS Clean in mosaicing, it common to come across an ocsilatory pattern going between positive and negative in the large scale. More...
 
void stopPointMode (Int nStopPointMode)
 Some algorithms require that the cycles be terminated when the image is dominated by point sources; if we get nStopPointMode of the smallest scale components in a row, we terminate the cycles. More...
 
Bool queryStopPointMode () const
 After completion of cycle, querry this to find out if we stopped because of stopPointMode. More...
 
void speedup (const Float Ndouble)
 speedup() will speed the clean iteration by raising the threshold. More...
 
Lattice< T > * residual ()
 Look at what WE think the residuals look like Assumes the first scale is zero-sized. More...
 
Float threshold () const
 Method to return threshold, including any speedup factors. More...
 
strengthOptimum () const
 Method to return the strength optimum achieved at the last clean iteration The output of this method makes sense only if it is called after clean. More...
 

Static Public Member Functions

static void addTo (Lattice< T > &to, const Lattice< T > &add)
 Helper function to optimize adding. More...
 

Protected Member Functions

Bool validatePsf (const Lattice< T > &psf)
 Make sure that the peak of the Psf is within the image. More...
 
void makeScale (Lattice< T > &scale, const Float &scaleSize)
 Make an lattice of the specified scale. More...
 
Float spheroidal (Float nu)
 Make Spheroidal function for scale images. More...
 
Bool findMaxAbsMaskLattice (const Lattice< T > &lattice, const Lattice< T > &mask, T &maxAbs, IPosition &posMax)
 Find the Peak of the lattice, applying a mask. More...
 

Static Protected Member Functions

static Bool findMaxAbsLattice (const Lattice< T > &lattice, T &maxAbs, IPosition &posMax)
 Find the Peak of the Lattice. More...
 
static void makeBoxesSameSize (IPosition &blc1, IPosition &trc1, IPosition &blc2, IPosition &trc2)
 Helper function to reduce the box sizes until the have the same size keeping the centers intact. More...
 

Protected Attributes

CleanEnums::CleanType itsCleanType
 
Float itsGain
 
Int itsMaxNiter
 
Quantum< DoubleitsThreshold
 
TempLattice< T > * itsMask
 
IPosition itsPositionPeakPsf
 

Private Member Functions

Int index (const Int scale, const Int otherscale)
 Calculate index into PsfConvScales. More...
 
Bool destroyScales ()
 
Bool destroyMasks ()
 
Bool makeScaleMasks ()
 

Private Attributes

TempLattice< T > * itsDirty
 
TempLattice< Complex > * itsXfr
 
Int itsNscales
 
Vector< FloatitsScaleSizes
 
PtrBlock< TempLattice< T > * > itsScales
 
PtrBlock< TempLattice< Complex > * > itsScaleXfrs
 
PtrBlock< TempLattice< T > * > itsPsfConvScales
 
PtrBlock< TempLattice< T > * > itsDirtyConvScales
 
PtrBlock< TempLattice< T > * > itsScaleMasks
 
Bool itsScalesValid
 
Int itsIteration
 
Int itsStartingIter
 
Quantum< DoubleitsFracThreshold
 
Float itsMaximumResidual
 
itsStrengthOptimum
 
Vector< FloatitsTotalFluxScale
 
Float itsTotalFlux
 
Double itsMemoryMB
 Memory to be allocated per TempLattice. More...
 
Bool itsChoose
 Let the user choose whether to stop. More...
 
Bool itsDoSpeedup
 Threshold speedup factors: More...
 
Float itsNDouble
 
Bool itsIgnoreCenterBox
 
Float itsSmallScaleBias
 
Bool itsStopAtLargeScaleNegative
 
Int itsStopPointMode
 
Bool itsDidStopPointMode
 
Bool itsJustStarting
 
itsMaskThreshold
 threshold for masks. More...
 

Detailed Description

template<class T>
class casacore::LatticeCleaner< T >

A class for doing multi-dimensional cleaning.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tLatticeCleaner

Prerequisite

Etymology

The LatticeCleaner class will deconvolve Lattices.

Synopsis

This class will perform various types of Clean deconvolution on Lattices.

Example

Motivation

Thrown Exceptions

To Do

Definition at line 103 of file LatticeCleaner.h.

Constructor & Destructor Documentation

template<class T>
casacore::LatticeCleaner< T >::LatticeCleaner ( )

Create a cleaner : default constructor.

template<class T>
casacore::LatticeCleaner< T >::LatticeCleaner ( const Lattice< T > &  psf,
const Lattice< T > &  dirty 
)

Create a cleaner for a specific dirty image and PSF.

template<class T>
casacore::LatticeCleaner< T >::LatticeCleaner ( const LatticeCleaner< T > &  other)

The copy constructor uses reference semantics.

template<class T>
casacore::LatticeCleaner< T >::~LatticeCleaner ( )

The destructor does nothing special.

Member Function Documentation

template<class T>
static void casacore::LatticeCleaner< T >::addTo ( Lattice< T > &  to,
const Lattice< T > &  add 
)
static

Helper function to optimize adding.

template<class T>
Int casacore::LatticeCleaner< T >::clean ( Lattice< T > &  model,
LatticeCleanProgress progress = 0 
)

Clean an image.

return value gives you a hint of what's happening 1 = converged 0 = not converged but behaving normally -1 = not converged and stopped on cleaning consecutive smallest scale -2 = not converged and either large scale hit negative or diverging -3 = clean is diverging rather than converging

template<class T>
Bool casacore::LatticeCleaner< T >::destroyMasks ( )
private
template<class T>
Bool casacore::LatticeCleaner< T >::destroyScales ( )
private
template<class T>
static Bool casacore::LatticeCleaner< T >::findMaxAbsLattice ( const Lattice< T > &  lattice,
T &  maxAbs,
IPosition posMax 
)
staticprotected

Find the Peak of the Lattice.

template<class T>
Bool casacore::LatticeCleaner< T >::findMaxAbsMaskLattice ( const Lattice< T > &  lattice,
const Lattice< T > &  mask,
T &  maxAbs,
IPosition posMax 
)
protected

Find the Peak of the lattice, applying a mask.

template<class T>
void casacore::LatticeCleaner< T >::ignoreCenterBox ( Bool  huh)
inline

Tell the algorithm to NOT clean just the inner quarter (This is useful when multiscale clean is being used inside a major cycle for MF or WF algorithms) if True, the full image deconvolution will be attempted.

Definition at line 184 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsIgnoreCenterBox.

template<class T>
Int casacore::LatticeCleaner< T >::index ( const Int  scale,
const Int  otherscale 
)
private

Calculate index into PsfConvScales.

template<class T>
Int casacore::LatticeCleaner< T >::iteration ( ) const
inline

return how many iterations we did do

Definition at line 154 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsIteration.

template<class T>
static void casacore::LatticeCleaner< T >::makeBoxesSameSize ( IPosition blc1,
IPosition trc1,
IPosition blc2,
IPosition trc2 
)
staticprotected

Helper function to reduce the box sizes until the have the same size keeping the centers intact.

template<class T>
void casacore::LatticeCleaner< T >::makeScale ( Lattice< T > &  scale,
const Float scaleSize 
)
protected

Make an lattice of the specified scale.

template<class T>
Bool casacore::LatticeCleaner< T >::makeScaleMasks ( )
private
template<class T>
Int casacore::LatticeCleaner< T >::numberIterations ( ) const
inline

Definition at line 155 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsIteration.

template<class T>
LatticeCleaner<T>& casacore::LatticeCleaner< T >::operator= ( const LatticeCleaner< T > &  other)

The assignment operator also uses reference semantics.

template<class T>
Bool casacore::LatticeCleaner< T >::queryStopPointMode ( ) const
inline

After completion of cycle, querry this to find out if we stopped because of stopPointMode.

Definition at line 209 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsDidStopPointMode.

template<class T>
Lattice<T>* casacore::LatticeCleaner< T >::residual ( )
inline

Look at what WE think the residuals look like Assumes the first scale is zero-sized.

Definition at line 223 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsDirtyConvScales.

template<class T>
Bool casacore::LatticeCleaner< T >::setcontrol ( CleanEnums::CleanType  cleanType,
const Int  niter,
const Float  gain,
const Quantity aThreshold,
const Quantity fThreshold,
const Bool  choose = True 
)

Set up control parameters cleanType - type of the cleaning algorithm to use (HOGBOM, MULTISCALE) niter - number of iterations gain - loop gain used in cleaning (a fraction of the maximum subtracted at every iteration) aThreshold - absolute threshold to stop iterations fThreshold - fractional threshold (i.e.

given w.r.t. maximum residual) to stop iterations. This parameter is specified as Quantity so it can be given in per cents. choose - unused at the moment, specify False. Original meaning is to allow interactive decision on whether to continue iterations. This method always returns True.

template<class T>
Bool casacore::LatticeCleaner< T >::setcontrol ( CleanEnums::CleanType  cleanType,
const Int  niter,
const Float  gain,
const Quantity threshold,
const Bool  choose = True 
)

This version of the method disables stopping on fractional threshold.

template<class T>
void casacore::LatticeCleaner< T >::setMask ( Lattice< T > &  mask,
const T &  maskThreshold = T(0.9) 
)

Set the mask mask - input mask lattice maskThreshold - if positive, the value is treated as a threshold value to determine whether a pixel is good (mask value is greater than the threshold) or has to be masked (mask value is below the threshold).

Negative threshold switches mask clipping off. The mask value is used to weight the flux during cleaning. This mode is used to implement cleaning based on the signal-to-noise as opposed to the standard cleaning based on the flux. The default threshold value is 0.9, which ensures the behavior of the code is exactly the same as before this parameter has been introduced.

template<class T>
Bool casacore::LatticeCleaner< T >::setscales ( const Int  nscales,
const Float  scaleInc = 1.0 
)

Set a number of scale sizes.

The units of the scale are pixels.

template<class T>
Bool casacore::LatticeCleaner< T >::setscales ( const Vector< Float > &  scales)

Set a specific set of scales.

template<class T>
void casacore::LatticeCleaner< T >::setSmallScaleBias ( const Float  x = 0.5)
inline

Consider the case of a point source: the flux on all scales is the same, and the first scale will be chosen.

Now, consider the case of a point source with a little bit of extended structure: thats right, the largest scale will be chosen. In this case, we should provide some bias towards the small scales, or against the large scales. We do this in an ad hoc manner, multiplying the maxima found at each scale by 1.0 - itsSmallScaleBias * itsScaleSizes(scale)/itsScaleSizes(nScalesToClean-1); Typical bias values range from 0.2 to 1.0.

Definition at line 194 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsSmallScaleBias.

template<class T>
void casacore::LatticeCleaner< T >::speedup ( const Float  Ndouble)

speedup() will speed the clean iteration by raising the threshold.

This may be required if the threshold is accidentally set too low (ie, lower than can be achieved given errors in the approximate PSF).

threshold(iteration) = threshold(0) (exp((iteration - startingiteration)/Ndouble)/ 2.718) If speedup() is NOT invoked, no effect on threshold

template<class T>
Float casacore::LatticeCleaner< T >::spheroidal ( Float  nu)
protected

Make Spheroidal function for scale images.

template<class T>
void casacore::LatticeCleaner< T >::startingIteration ( const Int  starting = 0)
inline

what iteration number to start on

Definition at line 158 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsStartingIter.

template<class T>
void casacore::LatticeCleaner< T >::stopAtLargeScaleNegative ( )
inline

During early iterations of a cycled MS Clean in mosaicing, it common to come across an ocsilatory pattern going between positive and negative in the large scale.

If this is set, we stop at the first negative in the largest scale.

Definition at line 200 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsStopAtLargeScaleNegative, and casacore::True.

template<class T>
void casacore::LatticeCleaner< T >::stopPointMode ( Int  nStopPointMode)
inline

Some algorithms require that the cycles be terminated when the image is dominated by point sources; if we get nStopPointMode of the smallest scale components in a row, we terminate the cycles.

Definition at line 205 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsStopPointMode.

template<class T>
T casacore::LatticeCleaner< T >::strengthOptimum ( ) const
inline

Method to return the strength optimum achieved at the last clean iteration The output of this method makes sense only if it is called after clean.

Definition at line 230 of file LatticeCleaner.h.

References casacore::LatticeCleaner< T >::itsStrengthOptimum.

template<class T>
Float casacore::LatticeCleaner< T >::threshold ( ) const

Method to return threshold, including any speedup factors.

template<class T>
void casacore::LatticeCleaner< T >::update ( const Lattice< T > &  dirty)

Update the dirty image only.

template<class T>
Bool casacore::LatticeCleaner< T >::validatePsf ( const Lattice< T > &  psf)
protected

Make sure that the peak of the Psf is within the image.

Member Data Documentation

template<class T>
Bool casacore::LatticeCleaner< T >::itsChoose
private

Let the user choose whether to stop.

Definition at line 303 of file LatticeCleaner.h.

template<class T>
CleanEnums::CleanType casacore::LatticeCleaner< T >::itsCleanType
protected

Definition at line 259 of file LatticeCleaner.h.

template<class T>
Bool casacore::LatticeCleaner< T >::itsDidStopPointMode
private

Definition at line 324 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::queryStopPointMode().

template<class T>
TempLattice<T>* casacore::LatticeCleaner< T >::itsDirty
private

Definition at line 274 of file LatticeCleaner.h.

template<class T>
PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsDirtyConvScales
private

Definition at line 283 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::residual().

template<class T>
Bool casacore::LatticeCleaner< T >::itsDoSpeedup
private

Threshold speedup factors:

Definition at line 306 of file LatticeCleaner.h.

template<class T>
Quantum<Double> casacore::LatticeCleaner< T >::itsFracThreshold
private

Definition at line 290 of file LatticeCleaner.h.

template<class T>
Float casacore::LatticeCleaner< T >::itsGain
protected

Definition at line 260 of file LatticeCleaner.h.

template<class T>
Bool casacore::LatticeCleaner< T >::itsIgnoreCenterBox
private

Definition at line 320 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::ignoreCenterBox().

template<class T>
Int casacore::LatticeCleaner< T >::itsIteration
private
template<class T>
Bool casacore::LatticeCleaner< T >::itsJustStarting
private

Definition at line 325 of file LatticeCleaner.h.

template<class T>
TempLattice<T>* casacore::LatticeCleaner< T >::itsMask
protected

Definition at line 263 of file LatticeCleaner.h.

template<class T>
T casacore::LatticeCleaner< T >::itsMaskThreshold
private

threshold for masks.

If negative, mask values are used as weights and no pixels are discarded (although effectively they would be discarded if the mask value is 0.)

Definition at line 329 of file LatticeCleaner.h.

template<class T>
Float casacore::LatticeCleaner< T >::itsMaximumResidual
private

Definition at line 292 of file LatticeCleaner.h.

template<class T>
Int casacore::LatticeCleaner< T >::itsMaxNiter
protected

Definition at line 261 of file LatticeCleaner.h.

template<class T>
Double casacore::LatticeCleaner< T >::itsMemoryMB
private

Memory to be allocated per TempLattice.

Definition at line 300 of file LatticeCleaner.h.

template<class T>
Float casacore::LatticeCleaner< T >::itsNDouble
private

Definition at line 307 of file LatticeCleaner.h.

template<class T>
Int casacore::LatticeCleaner< T >::itsNscales
private

Definition at line 277 of file LatticeCleaner.h.

template<class T>
IPosition casacore::LatticeCleaner< T >::itsPositionPeakPsf
protected

Definition at line 264 of file LatticeCleaner.h.

template<class T>
PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsPsfConvScales
private

Definition at line 282 of file LatticeCleaner.h.

template<class T>
PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsScaleMasks
private

Definition at line 284 of file LatticeCleaner.h.

template<class T>
PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsScales
private

Definition at line 280 of file LatticeCleaner.h.

template<class T>
Vector<Float> casacore::LatticeCleaner< T >::itsScaleSizes
private

Definition at line 278 of file LatticeCleaner.h.

template<class T>
Bool casacore::LatticeCleaner< T >::itsScalesValid
private

Definition at line 286 of file LatticeCleaner.h.

template<class T>
PtrBlock<TempLattice<Complex>* > casacore::LatticeCleaner< T >::itsScaleXfrs
private

Definition at line 281 of file LatticeCleaner.h.

template<class T>
Float casacore::LatticeCleaner< T >::itsSmallScaleBias
private

Definition at line 321 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::setSmallScaleBias().

template<class T>
Int casacore::LatticeCleaner< T >::itsStartingIter
private

Definition at line 289 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::startingIteration().

template<class T>
Bool casacore::LatticeCleaner< T >::itsStopAtLargeScaleNegative
private
template<class T>
Int casacore::LatticeCleaner< T >::itsStopPointMode
private

Definition at line 323 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::stopPointMode().

template<class T>
T casacore::LatticeCleaner< T >::itsStrengthOptimum
private

Definition at line 293 of file LatticeCleaner.h.

Referenced by casacore::LatticeCleaner< T >::strengthOptimum().

template<class T>
Quantum<Double> casacore::LatticeCleaner< T >::itsThreshold
protected

Definition at line 262 of file LatticeCleaner.h.

template<class T>
Float casacore::LatticeCleaner< T >::itsTotalFlux
private

Definition at line 297 of file LatticeCleaner.h.

template<class T>
Vector<Float> casacore::LatticeCleaner< T >::itsTotalFluxScale
private

Definition at line 296 of file LatticeCleaner.h.

template<class T>
TempLattice<Complex>* casacore::LatticeCleaner< T >::itsXfr
private

Definition at line 275 of file LatticeCleaner.h.


The documentation for this class was generated from the following file: