casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MaskedHogbomCleanModel.h
Go to the documentation of this file.
00001 //# MaskedHogbomCleanModel.h: this defines MaskedHogbomCleanModel
00002 //# Copyright (C) 1996,1999
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef SYNTHESIS_MASKEDHOGBOMCLEANMODEL_H
00030 #define SYNTHESIS_MASKEDHOGBOMCLEANMODEL_H
00031 
00032 
00033 #include <casa/aips.h>
00034 #include <synthesis/MeasurementEquations/MaskedArrayModel.h>
00035 #include <synthesis/MeasurementEquations/Iterate.h>
00036 #include <synthesis/MeasurementEquations/ResidualEquation.h>
00037 #include <synthesis/MeasurementEquations/ConvolutionEquation.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 // <summary>
00042 // A Class for performing Hogbom Clean's of Arrays
00043 // </summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00048 // </reviewed>
00049 
00050 // <prerequisite> <li> ResidualEquation/ConvolutionEquation <li>
00051 // LinearModel/LinearEquation Paradigm </prerequisite>
00052 //
00053 // <etymology>
00054 // This class is called HogbomCleanModel because thats the algorithm it uses
00055 // deconvolve the model. 
00056 // </etymology>
00057 //
00058 // <synopsis>
00059 // This class is used to perform the Hogbom Clean Algorithm on a
00060 // MaskedArray. It is functionally equivalent to the HogbomCleanModel class and
00061 // all the documention for that class will not be repreated here. The only
00062 // difference is that the model used to represent the sky in this class is a
00063 // MaskedArray, and hence this class can implement the concept of clean
00064 // boxes.
00065 // 
00066 // Masking is used to deliniate the search region when clean is determing
00067 // the maximum residual as well as the region that is subtracted in the
00068 // when calculating the residual image (if the ConvolutionEquation class is
00069 // used in conjunction with this class). However Because this user
00070 // calculates the residual using the  ConvolutionEquation class (which ignores
00071 // the mask) this will always return a residual that is accurate even in the
00072 // masked regions of the image. 
00073 // </synopsis>
00074 //
00075 // <example>
00076 // <srcblock>
00077 // Matrix<Float> psf(12,12); // The psf cannot be masked!
00078 // MaskedMatrix dirty(10,10), initialModel(10,10);
00079 // ...put appropriate values into psf, dirty, & initialModel....
00080 // ConvolutionEquation convEqn(psf, dirty);
00081 // MaskedHogbomCleanModel<Float> deconvolvedModel(initialModel); 
00082 // deconvolvedModel.setGain(0.2); 
00083 // deconvolvedModel.setNumberIterations(1000);
00084 // Bool convWorked = deconvolvedModel.solve(convEqn);
00085 // Array<Float> finalModel, residuals;
00086 // if (convWorked){
00087 //   finalModel = deconvolvedModel.getModel();
00088 //   ConvEqn.residual(deconvolvedModel, finalResidual);
00089 // }
00090 // </srcblock> 
00091 // </example>
00092 //
00093 // <motivation>
00094 // This class is needed to deconvolve images.
00095 // </motivation>
00096 //
00097 // <templating arg=T>
00098 // I have tested this class with Arrays of
00099 //    <li> Float
00100 // </templating>
00101 //
00102 //
00103 // <todo asof="1996/05/02">
00104 //   <li> Check that Arrays of StokesVectors work as advertised
00105 //   <li> compare timing with other clean implementations (ie, Mark's
00106 //   CleanTools, SDE, AIPS & miriad) 
00107 // </todo>
00108 
00109 template<class T> class MaskedHogbomCleanModel: 
00110   public MaskedArrayModel<T>,
00111   public Iterate
00112 {
00113 public:
00114   // The default constructor does nothing more than initialise a zero length
00115   // array to hold the deconvolved model. If this constructor is used then 
00116   // the actual model must be set using the setModel() function of the
00117   // ArrayModel class.
00118   MaskedHogbomCleanModel():MaskedArrayModel<T>(){};
00119   // Construct the HogbomCleanModel object and initialise the model.
00120   MaskedHogbomCleanModel(const MaskedArray<T> & model)
00121     :MaskedArrayModel<T>(model){};
00122   // Using a Hogbom clean deconvolution proceedure solve for an improved
00123   // estimate of the deconvolved object. The convolution/residual equation
00124   // contains the psf and dirty image. When called with a ResidualEquation
00125   // arguement a quite general interface is used that is slow. The
00126   // convolution equation contains functions that speed things up. The
00127   // functions return False if the deconvolution could not be done.
00128   // <group>
00129   Bool solve(ResidualEquation<MaskedArray<T> > & eqn);
00130   Bool solve(ConvolutionEquation & eqn);
00131   // </group>
00132 
00133   //# Make parent members known.
00134 protected:
00135   using MaskedArrayModel<T>::theModel;
00136 };
00137 
00138 
00139 } //# NAMESPACE CASA - END
00140 
00141 #ifndef AIPS_NO_TEMPLATE_SRC
00142 #include <synthesis/MeasurementEquations/MaskedHogbomCleanModel.tcc>
00143 #endif //# AIPS_NO_TEMPLATE_SRC
00144 #endif