casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HogbomCleanModel.h
Go to the documentation of this file.
1 //# HogbomCleanModel.h: this defines HogbomCleanModel
2 //# Copyright (C) 1996,1999
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef SYNTHESIS_HOGBOMCLEANMODEL_H
30 #define SYNTHESIS_HOGBOMCLEANMODEL_H
31 
32 
33 #include <casa/aips.h>
38 
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41 // <summary>
42 // A Class for performing Hogbom Clean's of Arrays
43 // </summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48 // </reviewed>
49 
50 // <prerequisite>
51 // <li> ResidualEquation/ConvolutionEquation
52 // <li> LinearModel/LinearEquation Paradigm
53 // </prerequisite>
54 //
55 // <etymology>
56 // This class is called HogbomCleanModel because thats the algorithm it uses
57 // deconvolve the model.
58 // </etymology>
59 //
60 // <synopsis>
61 // This class is used to perform the Hogbom Clean Algorithm on an
62 // Array. Only the deconvolved model of the sky are directly stored by this
63 // class. The point spread function (psf) and convolved (dirty) image are
64 // stored in a companion class which is must be derived from
65 // ResidualEquation.
66 //
67 // The cleaning works like this. The user constructs a HogbomCleanModel by
68 // specifying an initial model of the sky. This can by be
69 // one,two,three... dimensional depending on the dimension of the psf (see
70 // below). The user then constructs a class which implements the forward
71 // equation between the model and the dirty image. Typically this will be
72 // the ConvolutionEquation class, although any class which has a
73 // ResidualEquation interface will be work (but perhaps very slowly, as the
74 // ConvolutionEquation class has member functions optimised for cleaning)
75 //
76 // The user then calls the solve() function (with the appropriate equation
77 // class as an arguement), and this class will perform the Hogbom clean.
78 // The various clean parameters are set (prior to calling solve) using the
79 // functions derived from the Iterate class, in particular setGain(),
80 // setNumberIterations() & setThreshold() (to set a flux limit).
81 //
82 // The solve() function does not return either the deconvolved model or the
83 // residuals. The solved model can be obtained using the getModel() function
84 // (derived from ArrayModel()) and the residual can be obtained using the
85 // residual() member function of the Convolution/Residual Equation Class.
86 //
87 // The size and shape of the model used in this class MUST be the same as
88 // the convolved data (Dirty Image), stored in the companion
89 // ResidualEquation Class. However the model (and convolved data) can have
90 // more dimensions than the psf, as well as a different size (either larger
91 // or smaller). When the dimensionality is different the cleaning is done
92 // independendtly in each "plane" of the model. (Note this has not
93 // been implemented yet but is relatively simple to do if necessary).
94 //
95 // This multi-dimensionalty is exploited when cleaning arrays of
96 // StokesVectors. Here the casacore::Array of StokesVectors is decomposed into a stack
97 // of 4 Floating point arrays and the cleaning is done on all the the arrays
98 // simultaneosly. The criterion for choosing the brightest pixel has been
99 // generalised by using the "length" of the Stokesvector in 4 dimensional
100 // space.
101 //
102 // A companion class to this one is MaskedHogbomCleanModel. This provides
103 // the same functionality but is used with MaskedArrays which indicate which
104 // regions of the model to search for clean components.
105 //
106 // </synopsis>
107 //
108 // <example>
109 // <srcblock>
110 // casacore::Matrix<casacore::Float> psf(12,12), dirty(10,10), initialModel(10,10);
111 // ...put appropriate values into psf, dirty, & initialModel....
112 // HogbomCleanModel<casacore::Float> deconvolvedModel(initialModel);
113 // ConvolutionEquation convEqn(psf, dirty);
114 // deconvolvedModel.setGain(0.2);
115 // deconvolvedModel.setNumberIterations(1000);
116 // casacore::Bool convWorked = deconvolvedModel.solve(convEqn);
117 // casacore::Array<casacore::Float> finalModel, residuals;
118 // if (convWorked){
119 // finalModel = deconvolvedModel.getModel();
120 // ConvEqn.residual(deconvolvedModel, finalResidual);
121 // }
122 // </srcblock>
123 // </example>
124 //
125 // <motivation>
126 // This class is needed to deconvolve images.
127 // </motivation>
128 //
129 // <templating arg=T>
130 // I have tested this class with Arrays of
131 // <li> Float
132 // <li> StokesVector
133 // </templating>
134 //
135 // <todo asof="1996/05/02">
136 // <li> Make changes so that multidimensions work as advertised
137 // <li> compare timing with other clean implementations (ie, Mark's
138 // CleanTools, SDE, AIPS & miriad)
139 // </todo>
140 
141 template<class T> class HogbomCleanModel:
142  public ArrayModel<T>,
143  public Iterate
144 {
145 public:
146  // The default constructor does nothing more than initialise a zero length
147  // array to hold the deconvolved model. If this constructor is used then
148  // the actual model must be set using the setModel() function of the
149  // ArrayModel class.
151  // Construct the HogbomCleanModel object and initialise the model.
152  HogbomCleanModel(const casacore::Array<T> & model):ArrayModel<T>(model){};
153  // Using a Hogbom clean deconvolution proceedure solve for an improved
154  // estimate of the deconvolved object. The convolution/residual equation
155  // contains the psf and dirty image. When called with a ResidualEquation
156  // arguement a quite general interface is used that is slow. The
157  // convolution equation contains functions that speed things up. The
158  // functions return false if the deconvolution could not be done.
159  // <group>
162  // </group>
163 
164  //# Make parent members known.
165 protected:
167 };
168 
169 
170 } //# NAMESPACE CASA - END
171 
172 #ifndef AIPS_NO_TEMPLATE_SRC
173 #include <synthesis/MeasurementEquations/HogbomCleanModel.tcc>
174 #endif //# AIPS_NO_TEMPLATE_SRC
175 #endif
Interface class containing functions returning &quot;Domain&quot; type.
Definition: Deconvolver.h:56
Implements the convolution equation.
models with an internal &amp; external representation as an array
Definition: ArrayModel.h:112
casacore::Bool solve(ResidualEquation< casacore::Array< T > > &eqn)
Using a Hogbom clean deconvolution proceedure solve for an improved estimate of the deconvolved objec...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
HogbomCleanModel(const casacore::Array< T > &model)
Construct the HogbomCleanModel object and initialise the model.
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
HogbomCleanModel()
The default constructor does nothing more than initialise a zero length array to hold the deconvolved...
Base class for Iteration.
Definition: Iterate.h:40
A Class for performing Hogbom Clean&#39;s of Arrays.