Loading...
Searching...
No Matches
casacore::LatticeCleaner< T > Class Template Reference
lattices package (libcasa_lattices) » LatticeMath_module

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

`#include <LatticeCleaner.h>`

## Public Member Functions

| LatticeCleaner ()
| Create a cleaner : default constructor.
| LatticeCleaner (const Lattice< T > &psf, const Lattice< T > &dirty)
| Create a cleaner for a specific dirty image and PSF.
| LatticeCleaner (const LatticeCleaner< T > &other)
| The copy constructor uses reference semantics.
LatticeCleaner< T > & | operator= (const LatticeCleaner< T > &other)
| The assignment operator also uses reference semantics.
| ~LatticeCleaner ()
| The destructor does nothing special.
void | update (const Lattice< T > &dirty)
| Update the dirty image only.
Bool | setscales (const Int nscales, const Float scaleInc=1.0)
| Set a number of scale sizes.
Bool | setscales (const Vector< Float > &scales)
| Set a specific set of scales.
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.
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.
Int | iteration () const
| return how many iterations we did do
Int | numberIterations () const
void | startingIteration (const Int starting=0)
| what iteration number to start on
Int | clean (Lattice< T > &model, LatticeCleanProgress *progress=0)
| Clean an image.
void | setMask (const 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).
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.
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.
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.
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.
Bool | queryStopPointMode () const
| After completion of cycle, querry this to find out if we stopped because of stopPointMode.
void | speedup (const Float Ndouble)
| speedup() will speed the clean iteration by raising the threshold.
Lattice< T > * | residual ()
| Look at what WE think the residuals look like Assumes the first scale is zero-sized.
Float | threshold () const
| Method to return threshold, including any speedup factors.
T | 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.

## Static Public Member Functions

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

## Protected Member Functions

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

## Static Protected Member Functions

static Bool | findMaxAbsLattice (const Lattice< T > &lattice, T &maxAbs, IPosition &posMax)
| Find the Peak of the Lattice.
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.

## Protected Attributes

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

## Private Member Functions

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

## Private Attributes

TempLattice< T > * | itsDirty
TempLattice< Complex > * | itsXfr
Int | itsNscales
Vector< Float > | itsScaleSizes
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< Double > | itsFracThreshold
Float | itsMaximumResidual
T | itsStrengthOptimum
Vector< Float > | itsTotalFluxScale
Float | itsTotalFlux
Double | itsMemoryMB
| Memory to be allocated per TempLattice.
Bool | itsChoose
| Let the user choose whether to stop.
Bool | itsDoSpeedup
| Threshold speedup factors:
Float | itsNDouble
Bool | itsIgnoreCenterBox
Float | itsSmallScaleBias
Bool | itsStopAtLargeScaleNegative
Int | itsStopPointMode
Bool | itsDidStopPointMode
Bool | itsJustStarting
T | itsMaskThreshold
| threshold for masks.

## 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

- The mathematical concept of deconvolution

### Etymology

The LatticeCleaner class will deconvolve Lattices.

### Synopsis

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

### Example

### Motivation

### Thrown Exceptions

- AipsError: if psf has more dimensions than the model.

### To Do

- Allow the psf to be specified with a Function.

Definition at line 100 of file LatticeCleaner.h.

## Constructor & Destructor Documentation

## LatticeCleaner() [1/3]

template<class T>

casacore::LatticeCleaner< T >::LatticeCleaner | ( |  | ) |

Create a cleaner : default constructor.

Referenced by LatticeCleaner(), and operator=().

## LatticeCleaner() [2/3]

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.

## LatticeCleaner() [3/3]

template<class T>

casacore::LatticeCleaner< T >::LatticeCleaner | ( | const LatticeCleaner< T > & | other | ) |

The copy constructor uses reference semantics.

References LatticeCleaner().

## ~LatticeCleaner()

template<class T>

casacore::LatticeCleaner< T >::~LatticeCleaner | ( |  | ) |

The destructor does nothing special.

## Member Function Documentation

## addTo()

template<class T>

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

static

Helper function to optimize adding.

## clean()

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

## destroyMasks()

template<class T>

Bool casacore::LatticeCleaner< T >::destroyMasks | ( |  | ) |

private

## destroyScales()

template<class T>

Bool casacore::LatticeCleaner< T >::destroyScales | ( |  | ) |

private

## findMaxAbsLattice()

template<class T>

Bool casacore::LatticeCleaner< T >::findMaxAbsLattice | ( | const Lattice< T > & | lattice,
|  | T & | maxAbs,
|  | IPosition & | posMax )

static protected

Find the Peak of the Lattice.

## findMaxAbsMaskLattice()

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.

References casacore::mask().

## ignoreCenterBox()

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 181 of file LatticeCleaner.h.

References itsIgnoreCenterBox.

## index()

template<class T>

Int casacore::LatticeCleaner< T >::index | ( | const Int | scale,
|  | const Int | otherscale )

private

Calculate index into PsfConvScales.

## iteration()

template<class T>

Int casacore::LatticeCleaner< T >::iteration | ( |  | ) | const

inline

return how many iterations we did do

Definition at line 151 of file LatticeCleaner.h.

References itsIteration.

## makeBoxesSameSize()

template<class T>

void casacore::LatticeCleaner< T >::makeBoxesSameSize | ( | IPosition & | blc1,
|  | IPosition & | trc1,
|  | IPosition & | blc2,
|  | IPosition & | trc2 )

static protected

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

## makeScale()

template<class T>

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

protected

Make an lattice of the specified scale.

## makeScaleMasks()

template<class T>

Bool casacore::LatticeCleaner< T >::makeScaleMasks | ( |  | ) |

private

## numberIterations()

template<class T>

Int casacore::LatticeCleaner< T >::numberIterations | ( |  | ) | const

inline

Definition at line 152 of file LatticeCleaner.h.

References itsIteration.

## operator=()

template<class T>

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

The assignment operator also uses reference semantics.

References LatticeCleaner().

## queryStopPointMode()

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 206 of file LatticeCleaner.h.

References itsDidStopPointMode.

## residual()

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 220 of file LatticeCleaner.h.

References itsDirtyConvScales.

Referenced by casacore::MultiTermLatticeCleaner< T >::getresidual().

## setcontrol() [1/2]

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.

References casacore::True.

## setcontrol() [2/2]

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.

References threshold(), and casacore::True.

## setMask()

template<class T>

void casacore::LatticeCleaner< T >::setMask | ( | const 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.

References casacore::mask().

## setscales() [1/2]

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.

## setscales() [2/2]

template<class T>

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

Set a specific set of scales.

## setSmallScaleBias()

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 191 of file LatticeCleaner.h.

References itsSmallScaleBias.

## speedup()

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

## spheroidal()

template<class T>

Float casacore::LatticeCleaner< T >::spheroidal | ( | Float | nu | ) |

protected

Make Spheroidal function for scale images.

## startingIteration()

template<class T>

void casacore::LatticeCleaner< T >::startingIteration | ( | const Int | starting = 0 | ) |

inline

what iteration number to start on

Definition at line 155 of file LatticeCleaner.h.

References itsStartingIter.

## stopAtLargeScaleNegative()

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 197 of file LatticeCleaner.h.

References itsStopAtLargeScaleNegative, and casacore::True.

## stopPointMode()

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 202 of file LatticeCleaner.h.

References itsStopPointMode.

## strengthOptimum()

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 227 of file LatticeCleaner.h.

References itsStrengthOptimum.

## threshold()

template<class T>

Float casacore::LatticeCleaner< T >::threshold | ( |  | ) | const

Method to return threshold, including any speedup factors.

Referenced by casacore::MultiTermLatticeCleaner< T >::computeFluxLimit(), and setcontrol().

## update()

template<class T>

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

Update the dirty image only.

## validatePsf()

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

## itsChoose

template<class T>

Bool casacore::LatticeCleaner< T >::itsChoose

private

Let the user choose whether to stop.

Definition at line 300 of file LatticeCleaner.h.

## itsCleanType

template<class T>

CleanEnums::CleanType casacore::LatticeCleaner< T >::itsCleanType

protected

Definition at line 256 of file LatticeCleaner.h.

## itsDidStopPointMode

template<class T>

Bool casacore::LatticeCleaner< T >::itsDidStopPointMode

private

Definition at line 321 of file LatticeCleaner.h.

Referenced by queryStopPointMode().

## itsDirty

template<class T>

TempLattice<T>* casacore::LatticeCleaner< T >::itsDirty

private

Definition at line 271 of file LatticeCleaner.h.

## itsDirtyConvScales

template<class T>

PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsDirtyConvScales

private

Definition at line 280 of file LatticeCleaner.h.

Referenced by residual().

## itsDoSpeedup

template<class T>

Bool casacore::LatticeCleaner< T >::itsDoSpeedup

private

Threshold speedup factors:

Definition at line 303 of file LatticeCleaner.h.

## itsFracThreshold

template<class T>

Quantum<Double> casacore::LatticeCleaner< T >::itsFracThreshold

private

Definition at line 287 of file LatticeCleaner.h.

## itsGain

template<class T>

Float casacore::LatticeCleaner< T >::itsGain

protected

Definition at line 257 of file LatticeCleaner.h.

## itsIgnoreCenterBox

template<class T>

Bool casacore::LatticeCleaner< T >::itsIgnoreCenterBox

private

Definition at line 317 of file LatticeCleaner.h.

Referenced by ignoreCenterBox().

## itsIteration

template<class T>

Int casacore::LatticeCleaner< T >::itsIteration

private

Definition at line 285 of file LatticeCleaner.h.

Referenced by iteration(), and numberIterations().

## itsJustStarting

template<class T>

Bool casacore::LatticeCleaner< T >::itsJustStarting

private

Definition at line 322 of file LatticeCleaner.h.

## itsMask

template<class T>

TempLattice<T>* casacore::LatticeCleaner< T >::itsMask

protected

Definition at line 260 of file LatticeCleaner.h.

## itsMaskThreshold

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 326 of file LatticeCleaner.h.

## itsMaximumResidual

template<class T>

Float casacore::LatticeCleaner< T >::itsMaximumResidual

private

Definition at line 289 of file LatticeCleaner.h.

## itsMaxNiter

template<class T>

Int casacore::LatticeCleaner< T >::itsMaxNiter

protected

Definition at line 258 of file LatticeCleaner.h.

## itsMemoryMB

template<class T>

Double casacore::LatticeCleaner< T >::itsMemoryMB

private

Memory to be allocated per TempLattice.

Definition at line 297 of file LatticeCleaner.h.

## itsNDouble

template<class T>

Float casacore::LatticeCleaner< T >::itsNDouble

private

Definition at line 304 of file LatticeCleaner.h.

## itsNscales

template<class T>

Int casacore::LatticeCleaner< T >::itsNscales

private

Definition at line 274 of file LatticeCleaner.h.

## itsPositionPeakPsf

template<class T>

IPosition casacore::LatticeCleaner< T >::itsPositionPeakPsf

protected

Definition at line 261 of file LatticeCleaner.h.

## itsPsfConvScales

template<class T>

PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsPsfConvScales

private

Definition at line 279 of file LatticeCleaner.h.

## itsScaleMasks

template<class T>

PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsScaleMasks

private

Definition at line 281 of file LatticeCleaner.h.

## itsScales

template<class T>

PtrBlock<TempLattice<T>* > casacore::LatticeCleaner< T >::itsScales

private

Definition at line 277 of file LatticeCleaner.h.

## itsScaleSizes

template<class T>

Vector<Float> casacore::LatticeCleaner< T >::itsScaleSizes

private

Definition at line 275 of file LatticeCleaner.h.

## itsScalesValid

template<class T>

Bool casacore::LatticeCleaner< T >::itsScalesValid

private

Definition at line 283 of file LatticeCleaner.h.

## itsScaleXfrs

template<class T>

PtrBlock<TempLattice<Complex>* > casacore::LatticeCleaner< T >::itsScaleXfrs

private

Definition at line 278 of file LatticeCleaner.h.

## itsSmallScaleBias

template<class T>

Float casacore::LatticeCleaner< T >::itsSmallScaleBias

private

Definition at line 318 of file LatticeCleaner.h.

Referenced by setSmallScaleBias().

## itsStartingIter

template<class T>

Int casacore::LatticeCleaner< T >::itsStartingIter

private

Definition at line 286 of file LatticeCleaner.h.

Referenced by startingIteration().

## itsStopAtLargeScaleNegative

template<class T>

Bool casacore::LatticeCleaner< T >::itsStopAtLargeScaleNegative

private

Definition at line 319 of file LatticeCleaner.h.

Referenced by stopAtLargeScaleNegative().

## itsStopPointMode

template<class T>

Int casacore::LatticeCleaner< T >::itsStopPointMode

private

Definition at line 320 of file LatticeCleaner.h.

Referenced by stopPointMode().

## itsStrengthOptimum

template<class T>

T casacore::LatticeCleaner< T >::itsStrengthOptimum

private

Definition at line 290 of file LatticeCleaner.h.

Referenced by strengthOptimum().

## itsThreshold

template<class T>

Quantum<Double> casacore::LatticeCleaner< T >::itsThreshold

protected

Definition at line 259 of file LatticeCleaner.h.

## itsTotalFlux

template<class T>

Float casacore::LatticeCleaner< T >::itsTotalFlux

private

Definition at line 294 of file LatticeCleaner.h.

## itsTotalFluxScale

template<class T>

Vector<Float> casacore::LatticeCleaner< T >::itsTotalFluxScale

private

Definition at line 293 of file LatticeCleaner.h.

## itsXfr

template<class T>

TempLattice<Complex>* casacore::LatticeCleaner< T >::itsXfr

private

Definition at line 272 of file LatticeCleaner.h.

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

- lattices/LatticeMath/LatticeCleaner.h