casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatConvEquation.h
Go to the documentation of this file.
1 //# LatConvEquation.h: this defines LatConvEquation
2 //# Copyright (C) 1996,1997,1998,1999,2000
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_LATCONVEQUATION_H
30 #define SYNTHESIS_LATCONVEQUATION_H
31 
32 
33 #include <casa/aips.h>
37 #include <casa/Arrays/IPosition.h>
38 #include <casa/Arrays/Array.h>
39 
40 namespace casa { //# NAMESPACE CASA - BEGIN
41 
42 template <class Domain> class LinearModel;
43 
44 
45 // <summary> Implements the convolution equation </summary>
46 
47 // <use visibility=local>
48 
49 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
50 // </reviewed>
51 
52 // <prerequisite>
53 // <li> <linkto class="HogbomCleanModel">HogbomCleanModel</linkto>
54 // (or similar classes)
55 // <li> LinearModel/LinearEquation Paradigm
56 // </prerequisite>
57 //
58 // <etymology>
59 // This class implements convolution within the LinearEquation framework.
60 // </etymology>
61 //
62 // <synopsis>
63 // This class is used in conjunction with classes like HogbomCleanModel to
64 // implement deconvolution algorithms. This class contains the point spread
65 // function (psf) and the convolved data (dirty image), and is able to
66 // convolve a supplied model with the psf to produce a predicted output
67 // (using the evaluate() function), or to subtract the convolved data and
68 // produce a residual (using the residual() function).
69 //
70 // See the documentation for
71 // <linkto class=HogbomCleanModel>HogbomCleanModel</linkto>
72 // for an example of how this class can be used to perform deconvolution.
73 //
74 // This class also contains specialised functions (like the version of
75 // evaluate() for a point source model) that speed up the calculation of the
76 // convolution. This specialised version of evaluate() does not need to
77 // actually perform the convolution and instead returns a suitable part of
78 // the psf (zero padded if necessary). When this function is called this
79 // class will get the psf from the convolver and cache it, on the assumption
80 // that many evaluations of this function will be requested (as occurs in
81 // Clean algorithms).
82 //
83 // The size and shape of the psf and the supplied model may be different. The
84 // only restriction is that the dimension of the psf must be less than or
85 // equal to the dimension of the model. If the dimension of the
86 // model is larger than the dimension of the psf then the convolution
87 // will be repeated along the slowest moving (last) axis. The dirty image
88 // and the supplied model must be the same size and shape.
89 //
90 //
91 // </synopsis>
92 //
93 // <example>
94 // <srcblock>
95 // casacore::PagedArray<casacore::Float> psf(2,4,4), dirty(2,20,20), model(2,20,20);
96 // .... put some meaningful values into these Lattices....
97 // // create a convolution equation, and a casacore::PagedArray model
98 // LatConvEquation convEqn(psf, dirty);
99 // LinearModel< casacore::Lattice<casacore::Float> > myModel(model);
100 // // now calculate the convolution of the model and the psf
101 // casacore::PagedArray<casacore::Float> prediction;
102 // convEqn.evaluate(myModel, prediction);
103 // // and calculate the difference between the predicted and actual convolution
104 // casacore::PagedArray<casacore::Float> residual;
105 // convEqn.residual(mymodel, residual)
106 // </srcblock>
107 // </example>
108 //
109 // <motivation>
110 // This class was designed with deconvolution in mind.
111 // </motivation>
112 //
113 // <todo asof="1990/05/03">
114 // <li> Reinstate the evaluate() method with position argument.
115 // <li> Fix up copies and references with Ralph Marson's help
116 // <li> This class is not templated. If necessary I would use templating
117 // to produce a casacore::Double Precision Version.
118 // </todo>
119 
121  public LinearEquation< casacore::Lattice<casacore::Float>, casacore::Lattice<casacore::Float> >
122 {
123 public:
124 
125  // Construct the LatConvEquation setting the psf and measured data
128 
129  // destroy
130  virtual ~LatConvEquation();
131 
132  // Do the convolution of the model supplied by the LinearModel class with
133  // the internal psf. Return the answer in result .
136 
137  // Do the convolution of the a point source model at position 'position'
138  // with amplitude 'amplitude' and the internal psf. Return the answer in
139  // result.
141  const casacore::Float amplitude,
142  const casacore::IPosition & modelShape);
143 
144  // Do the convolution of the a point source model at position 'position'
145  // with amplitude 'amplitude' and the internal psf. Return the answer in
146  // result, which is an array
147  // Calling this will result in throwing away creating a new PSF owned by
148  // this object;
150  const casacore::Float amplitude,
151  const casacore::IPosition & modelShape);
152 
153  // Calculate the convolution of the model (supplied by the LinearModel
154  // class) and the psf and the difference between this and the supplied
155  // (presumably measured) convolution.
158 
159  // Calculate the convolution of the model (supplied by the LinearModel
160  // class) and the psf and the difference between this and the supplied
161  // (presumably measured) convolution. Also return chisq.
164 
165  // Calculate the convolution of the model (supplied by the LinearModel
166  // class) and the psf and the difference between this and the supplied
167  // (presumably measured) convolution. Also return chisq, considering mask
171 
172  // return the psf size used in the convolution. The returned size does not
173  // include any zero padding
175 
176 protected:
177 
178  // Don't use this one, due to the casacore::Lattice<casacore::Float> &
179  LatConvEquation();
186 };
187 
188 
189 } //# NAMESPACE CASA - END
190 
191 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::LatticeConvolver< casacore::Float > itsConv
virtual casacore::Bool residual(casacore::Lattice< casacore::Float > &result, const LinearModel< casacore::Lattice< casacore::Float > > &model)
Calculate the convolution of the model (supplied by the LinearModel class) and the psf and the differ...
casacore::IPosition itsRealPsfSize
casacore::IPosition psfSize()
return the psf size used in the convolution.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Implements the convolution equation.
casacore::IPosition itsPsfOrigin
casacore::Bool itsVirgin
LatConvEquation()
Don&#39;t use this one, due to the casacore::Lattice&lt;casacore::Float&gt; &amp;.
casacore::Lattice< casacore::Float > * itsMeas
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
virtual ~LatConvEquation()
destroy
casacore::Lattice< casacore::Float > * itsPsf
defines a relationship between Domain and Range objects
Provides a model for use in model fitting applications.
virtual casacore::Bool evaluate(casacore::Lattice< casacore::Float > &result, const LinearModel< casacore::Lattice< casacore::Float > > &model)
Do the convolution of the model supplied by the LinearModel class with the internal psf...
TableExprNode amplitude(const TableExprNode &node)
The amplitude (i.e.
Definition: ExprNode.h:1397