casacore
|
A class for doing multi-dimensional cleaning. More...
#include <LatticeCleaner.h>
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... | |
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. 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< Double > | itsThreshold |
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< 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. 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 |
T | itsMaskThreshold |
threshold for masks. More... | |
A class for doing multi-dimensional cleaning.
Public interface
The LatticeCleaner class will deconvolve Lattices.
This class will perform various types of Clean deconvolution on Lattices.
Definition at line 103 of file LatticeCleaner.h.
casacore::LatticeCleaner< T >::LatticeCleaner | ( | ) |
Create a cleaner : default constructor.
casacore::LatticeCleaner< T >::LatticeCleaner | ( | const Lattice< T > & | psf, |
const Lattice< T > & | dirty | ||
) |
Create a cleaner for a specific dirty image and PSF.
casacore::LatticeCleaner< T >::LatticeCleaner | ( | const LatticeCleaner< T > & | other | ) |
The copy constructor uses reference semantics.
casacore::LatticeCleaner< T >::~LatticeCleaner | ( | ) |
The destructor does nothing special.
|
static |
Helper function to optimize adding.
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
|
private |
|
private |
|
staticprotected |
Find the Peak of the Lattice.
|
protected |
Find the Peak of the lattice, applying a mask.
|
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.
|
private |
Calculate index into PsfConvScales.
|
inline |
return how many iterations we did do
Definition at line 154 of file LatticeCleaner.h.
References casacore::LatticeCleaner< T >::itsIteration.
|
staticprotected |
Helper function to reduce the box sizes until the have the same size keeping the centers intact.
|
protected |
Make an lattice of the specified scale.
|
private |
|
inline |
Definition at line 155 of file LatticeCleaner.h.
References casacore::LatticeCleaner< T >::itsIteration.
LatticeCleaner<T>& casacore::LatticeCleaner< T >::operator= | ( | const LatticeCleaner< T > & | other | ) |
The assignment operator also uses reference semantics.
|
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.
|
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.
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.
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.
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.
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.
Bool casacore::LatticeCleaner< T >::setscales | ( | const Vector< Float > & | scales | ) |
Set a specific set of scales.
|
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.
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
|
protected |
Make Spheroidal function for scale images.
|
inline |
what iteration number to start on
Definition at line 158 of file LatticeCleaner.h.
References casacore::LatticeCleaner< T >::itsStartingIter.
|
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.
|
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.
|
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.
Float casacore::LatticeCleaner< T >::threshold | ( | ) | const |
Method to return threshold, including any speedup factors.
void casacore::LatticeCleaner< T >::update | ( | const Lattice< T > & | dirty | ) |
Update the dirty image only.
|
protected |
Make sure that the peak of the Psf is within the image.
|
private |
Let the user choose whether to stop.
Definition at line 303 of file LatticeCleaner.h.
|
protected |
Definition at line 259 of file LatticeCleaner.h.
|
private |
Definition at line 324 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::queryStopPointMode().
|
private |
Definition at line 274 of file LatticeCleaner.h.
|
private |
Definition at line 283 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::residual().
|
private |
Threshold speedup factors:
Definition at line 306 of file LatticeCleaner.h.
|
private |
Definition at line 290 of file LatticeCleaner.h.
|
protected |
Definition at line 260 of file LatticeCleaner.h.
|
private |
Definition at line 320 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::ignoreCenterBox().
|
private |
Definition at line 288 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::iteration(), and casacore::LatticeCleaner< T >::numberIterations().
|
private |
Definition at line 325 of file LatticeCleaner.h.
|
protected |
Definition at line 263 of file LatticeCleaner.h.
|
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.
|
private |
Definition at line 292 of file LatticeCleaner.h.
|
protected |
Definition at line 261 of file LatticeCleaner.h.
|
private |
Memory to be allocated per TempLattice.
Definition at line 300 of file LatticeCleaner.h.
|
private |
Definition at line 307 of file LatticeCleaner.h.
|
private |
Definition at line 277 of file LatticeCleaner.h.
|
protected |
Definition at line 264 of file LatticeCleaner.h.
|
private |
Definition at line 282 of file LatticeCleaner.h.
|
private |
Definition at line 284 of file LatticeCleaner.h.
|
private |
Definition at line 280 of file LatticeCleaner.h.
|
private |
Definition at line 278 of file LatticeCleaner.h.
|
private |
Definition at line 286 of file LatticeCleaner.h.
|
private |
Definition at line 281 of file LatticeCleaner.h.
|
private |
Definition at line 321 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::setSmallScaleBias().
|
private |
Definition at line 289 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::startingIteration().
|
private |
Definition at line 322 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::stopAtLargeScaleNegative().
|
private |
Definition at line 323 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::stopPointMode().
|
private |
Definition at line 293 of file LatticeCleaner.h.
Referenced by casacore::LatticeCleaner< T >::strengthOptimum().
|
protected |
Definition at line 262 of file LatticeCleaner.h.
|
private |
Definition at line 297 of file LatticeCleaner.h.
|
private |
Definition at line 296 of file LatticeCleaner.h.
|
private |
Definition at line 275 of file LatticeCleaner.h.