casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AWProjectWBFT.h
Go to the documentation of this file.
1 //# AWProjectWBFT.h: Definition for AWProjectWBFT
2 //# Copyright (C) 1996,1997,1998,1999,2000,2002
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 adressed 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_TRANSFORM2_AWPROJECTWBFT_H
30 #define SYNTHESIS_TRANSFORM2_AWPROJECTWBFT_H
31 #define DELTAPA 1.0
32 #define MAGICPAVALUE -999.0
33 
34 
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39  class EPJones;
40 
41  namespace refim {
42  class AWProjectWBFT : public AWProjectFT {
43 
44  public:
45  //
46  // Constructor: cachesize is the size of the cache in words
47  // (e.g. a few million is a good number), tilesize is the size of
48  // the tile used in gridding (cannot be less than 12, 16 works in
49  // most cases).
50  // <group>
51  //
56  casacore::Bool applyPointingOffset=true,
57  casacore::Bool doPBCorr=true,
59  casacore::Float paSteps=5.0,
60  casacore::Float pbLimit=5e-4,
61  casacore::Bool usezero=false,
64  // </group>
65 
66  // Construct from a casacore::Record containing the AWProjectWBFT state
68 
69  // Copy constructor
70  AWProjectWBFT(const AWProjectWBFT &other):AWProjectFT(other) {operator=(other);};
71 
72  // Assignment operator
73  AWProjectWBFT &operator=(const AWProjectWBFT &other);
74 
76 
77  virtual casacore::String name() const {return "AWProjectWBFT";};
78 
79 
81  casacore::Bool Evaluate);
82  void normalizeAvgPB();
84  {throw(casacore::AipsError("AWPWBFT::normalizeAvgPB(Complex,Float)"));}
85 
86  //
87  // This method is called from AWProjectFT to compute the
88  // sensitivity image by accumulating in the image domain
89  // (i.e. directly accumulate the Primay Beam functions). This is
90  // called from findConvFunction() so that sensitivity pattern is
91  // also pre-computed along with the convolution functions. This
92  // in-turn calls the ATerm::makeAverageResponse().
93  //
94  // For AWProjectWBFT class of FTMachines, this just issues a log
95  // message indicating that this is only setting up things for
96  // accumulation of weight images in the first gridding cycle. The
97  // actual sensitivity patterns are computed by overloaded function
98  // below.
99  //
100  virtual void makeSensitivityImage(const VisBuffer2& vb,
101  const casacore::ImageInterface<casacore::Complex>& imageTemplate,
103  virtual void makeSensitivityImage(const VisBuffer2& vb,
106  //
107  // In AWProjectWBFT and its derivatives, sensitivity image is
108  // computed by accumulating weight functions (images) during the
109  // first gridding cycle. AWProjectFT::makeSensitivityImage() is
110  // overloaded in AWProjectWBFT and only issues a log message.
111  //
112  // The following method is used to Fourier transform normalize the
113  // accumulated weight images. doFFTNorm when true, the FFT
114  // normalization (by pixel volume) is also done.
115  //
116  template <class T>
120  const casacore::Bool& doFFTNorm=true);
124  const casacore::Bool& doFFTNorm=true);
125 
126  //
127  // Method used to make normalized image from gridded visibilites.
128  // This calls makeSensitivityImage() to make the sensitivity image
129  // and AWProjectFT::getImage() to make the image from gridded
130  // visibilites. AWProjectFT::getImage() internally calls
131  // normalizeImage() which uses the sensitivty image computed by
132  // makeSensitivtyImage().
133  //
135  //
136  // Method used to convert the pixel value of the PB image, passed
137  // as pbPixValue, to a value used for PB-normalization.
138  // Typically, this will depend on the units of the "PB image"
139  // constructed by the makeSensitivtyImage() methods. pbLimit is
140  // the fractional pb-gain below which imaging is not required
141  // (this value is typically the user-defined parameter in the
142  // private member variable pbLimit_p).
143  //
144  inline virtual casacore::Float pbFunc(const casacore::Float& /*pbPixValue*/, const casacore::Float& /*pbLimit*/)
145  {return 1.0;};
146  // {casacore::Float tt=(pbPixValue);return (abs(tt) >= pbLimit)?tt:1.0;};
147 
148 
149  // {casacore::Float tt=sqrt(pbPixValue);return (abs(tt) >= pbLimit)?tt:1.0;};
150 
151  virtual void finalizeToSky();
153  const VisBuffer2& vb);
154 
155  void setObservatoryLocation(const casacore::MPosition& mLocation) {mLocation_p=mLocation;};
156 
158  {(void)shape0; (void)shape1;return false;};
159 
160  //
161  // Returns true if accumulation during gridding to compute the
162  // average PB must be done.
163  //
164  virtual casacore::Bool computeAvgPB(const casacore::Double& /*actualPA*/, const casacore::Double& /*lastPAUsedForWtImg*/)
165  {return (avgPBReady_p==false);};
166 
167  // virtual void setMiscInfo(const casacore::Int qualifier)
168  // {sensitivityPatternQualifier_p=qualifier;}
169  // {qualifier_p = qualifier;taylorQualifier_p = "_MFS_"+casacore::String::toString(qualifier_p)+"_";};
170 
171  // virtual void ComputeResiduals(VisBuffer2&vb, casacore::Bool useCorrected) {};
172  virtual void setCFCache(casacore::CountedPtr<CFCache>& cfc, const casacore::Bool resetCFC=true);
173 
174  protected:
175  template <class T>
176  void ftWeightImage(casacore::Lattice<T>& wtImage,
178  const casacore::Bool& doFFTNorm);
179 
181  const VisBuffer2& vb, casacore::Bool& dopsf);
183  const VisBuffer2& vb, casacore::Bool& dopsf);
184  // virtual void resampleGridToData(VBStore& vbs, const VisBuffer2& vb);
185  template <class T>
186  void resampleCFToGrid(casacore::Array<T>& wtsGrid,
187  VBStore& vbs, const VisBuffer2& vb);
188 
190 
191  private:
198  // //
199  // // These ugly methods (ugly due to their flirtation with FORTRAN) should go!
200  // //
201  // virtual void runFortranGet(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
202  // casacore::Cube<casacore::Complex>& visdata,
203  // casacore::IPosition& s,
204  // casacore::Int& Conj,
205  // casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
206  // casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
207  // casacore::Array<casacore::Complex>* dataPtr,
208  // casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
209  // VisBuffer2& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
210  // casacore::Double& sigma,
211  // casacore::Array<casacore::Float>& raoffsets,
212  // casacore::Array<casacore::Float>& decoffsets,
213  // casacore::Double area,
214  // casacore::Int& doGrad,casacore::Int paIndex);
215  // virtual void runFortranPut(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
216  // const casacore::Complex& visdata_p,
217  // casacore::IPosition& s,
218  // casacore::Int& Conj,
219  // casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
220  // const casacore::Matrix<casacore::Float>& weight,
221  // casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
222  // casacore::Array<casacore::Complex>& dataPtr,
223  // casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
224  // const VisBuffer2& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
225  // casacore::Double& sigma,
226  // casacore::Array<casacore::Float>& raoffsets,
227  // casacore::Array<casacore::Float>& decoffsets,
228  // casacore::Matrix<casacore::Double>& sumWeight,
229  // casacore::Double& area,
230  // casacore::Int& doGrad,
231  // casacore::Int& doPSF,casacore::Int paIndex);
232  // virtual void runFortranGetGrad(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
233  // casacore::Cube<casacore::Complex>& visdata,
234  // casacore::IPosition& s,
235  // casacore::Cube<casacore::Complex>& gradVisAzData,
236  // casacore::Cube<casacore::Complex>& gradVisElData,
237  // casacore::Int& Conj,
238  // casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
239  // casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
240  // casacore::Array<casacore::Complex>* dataPtr,
241  // casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
242  // VisBuffer2& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
243  // casacore::Double& sigma,
244  // casacore::Array<casacore::Float>& l_off,
245  // casacore::Array<casacore::Float>& m_off,
246  // casacore::Double area,
247  // casacore::Int& doGrad,
248  // casacore::Int paIndex);
250  };
251 } //# NAMESPACE CASA - END
252 };
253 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::TempImage< casacore::DComplex > griddedWeights_D
virtual casacore::Float pbFunc(const casacore::Float &, const casacore::Float &)
Method used to convert the pixel value of the PB image, passed as pbPixValue, to a value used for PB-...
casacore::Long cachesize
Sizes.
Definition: AWProjectFT.h:453
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
virtual casacore::ImageInterface< casacore::Complex > & getImage(casacore::Matrix< casacore::Float > &, casacore::Bool normalize=true)
Method used to make normalized image from gridded visibilites.
void ftWeightImage(casacore::Lattice< T > &wtImage, const casacore::Matrix< casacore::Float > &sumWt, const casacore::Bool &doFFTNorm)
casacore::Bool conjBeams_p
Definition: AWProjectFT.h:512
virtual casacore::String name() const
Return the name of the machine.
Definition: AWProjectWBFT.h:77
casacore::Bool wtImageFTDone_p
casacore::TempImage< casacore::Complex > griddedWeights
casacore::Vector< casacore::Int > fieldIds_p
AWProjectWBFT & operator=(const AWProjectWBFT &other)
Assignment operator.
AWProjectWBFT(casacore::Int nFacets, casacore::Long cachesize, casacore::CountedPtr< CFCache > &cfcache, casacore::CountedPtr< ConvolutionFunction > &cf, casacore::CountedPtr< VisibilityResamplerBase > &visResampler, casacore::Bool applyPointingOffset=true, casacore::Bool doPBCorr=true, casacore::Int tilesize=16, casacore::Float paSteps=5.0, casacore::Float pbLimit=5e-4, casacore::Bool usezero=false, casacore::Bool conjBeams_p=true, casacore::Bool doublePrecGrid=false)
Constructor: cachesize is the size of the cache in words (e.g.
virtual casacore::Bool doublePrecGrid()
return whether the ftmachine is using a double precision grid
virtual casacore::Bool computeAvgPB(const casacore::Double &, const casacore::Double &)
Returns true if accumulation during gridding to compute the average PB must be done.
virtual void setCFCache(casacore::CountedPtr< CFCache > &cfc, const casacore::Bool resetCFC=true)
virtual void setMiscInfo(const casacore::Int qualifier) {sensitivityPatternQualifier_p=qualifier;} {q...
casacore::Int findPointingOffsets(const VisBuffer2 &vb, casacore::Array< casacore::Float > &l_off, casacore::Array< casacore::Float > &m_off, casacore::Bool Evaluate)
casacore::Bool changed(const VisBuffer&amp; vb) {return vpSJ-&gt;changed(vb,1);}; casacore::Bool changed(con...
long Long
Definition: aipstype.h:52
casacore::CountedPtr< VisibilityResamplerBase > visResamplerWt_p
AWProjectWBFT(const AWProjectWBFT &other)
Copy constructor.
Definition: AWProjectWBFT.h:70
void setObservatoryLocation(const casacore::MPosition &mLocation)
A templated, abstract base class for array-like objects.
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
void normalizeAvgPB(casacore::ImageInterface< casacore::Complex > &, casacore::ImageInterface< casacore::Float > &)
Definition: AWProjectWBFT.h:83
double Double
Definition: aipstype.h:55
void makeSensitivitySqImage(casacore::Lattice< casacore::Complex > &wtImage, casacore::ImageInterface< casacore::Complex > &sensitivitySqImage, const casacore::Matrix< casacore::Float > &sumWt=casacore::Matrix< casacore::Float >(), const casacore::Bool &doFFTNorm=true)
casacore::Array< casacore::Complex > griddedData
casacore::Array for non-tiled gridding These are common to most FTmachines
Definition: FTMachine.h:523
virtual void initializeToSky(casacore::ImageInterface< casacore::Complex > &image, casacore::Matrix< casacore::Float > &weight, const VisBuffer2 &vb)
Initialize transform to Sky plane: initializes the image.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
virtual void resampleDataToGrid(casacore::Array< casacore::Complex > &griddedData, VBStore &vbs, const VisBuffer2 &vb, casacore::Bool &dopsf)
Base class for all Casacore library errors.
Definition: Error.h:134
const Double e
e and functions thereof:
casacore::Int tilesize
Definition: AWProjectFT.h:454
casacore::Bool oneTimeMessage_p
// These ugly methods (ugly due to their flirtation with FORTRAN) should go!
virtual casacore::Bool verifyShapes(casacore::IPosition shape0, casacore::IPosition shape1)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::MPosition mLocation_p
Default Position used for phase rotations.
Definition: FTMachine.h:444
Abstract base class for Record classes.
void resampleCFToGrid(casacore::Array< T > &wtsGrid, VBStore &vbs, const VisBuffer2 &vb)
virtual void resampleGridToData(VBStore&amp; vbs, const VisBuffer2&amp; vb);
casacore::ImageInterface< casacore::Complex > * image
Definition: FTMachine.h:395
virtual void makeSensitivityImage(const VisBuffer2 &vb, const casacore::ImageInterface< casacore::Complex > &imageTemplate, casacore::ImageInterface< casacore::Float > &sensitivityImage)
This method is called from AWProjectFT to compute the sensitivity image by accumulating in the image ...
virtual void finalizeToSky()
{casacore::Float tt=(pbPixValue);return (abs(tt) &gt;= pbLimit)?tt:1.0;};