Line data Source code
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 :
35 : #include <synthesis/TransformMachines2/AWProjectFT.h>
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 : //
52 : AWProjectWBFT(casacore::Int nFacets, casacore::Long cachesize,
53 : casacore::CountedPtr<CFCache>& cfcache,
54 : casacore::CountedPtr<ConvolutionFunction>& cf,
55 : casacore::CountedPtr<VisibilityResamplerBase>& visResampler,
56 : casacore::Bool applyPointingOffset=true,
57 : vector<float> pointingOffsetSigDev={10,10},
58 : casacore::Bool doPBCorr=true,
59 : casacore::Int tilesize=16,
60 : casacore::Float paSteps=5.0,
61 : casacore::Float pbLimit=5e-4,
62 : casacore::Bool usezero=false,
63 : casacore::Bool conjBeams_p=true,
64 : casacore::Bool doublePrecGrid=false);
65 : // </group>
66 :
67 : // Construct from a casacore::Record containing the AWProjectWBFT state
68 : AWProjectWBFT(const casacore::RecordInterface& stateRec);
69 :
70 : // Copy constructor
71 0 : AWProjectWBFT(const AWProjectWBFT &other):AWProjectFT(other) {operator=(other);};
72 :
73 : // Assignment operator
74 : AWProjectWBFT &operator=(const AWProjectWBFT &other);
75 :
76 0 : ~AWProjectWBFT() {};
77 :
78 0 : virtual casacore::String name() const {return "AWProjectWBFT";};
79 :
80 : //
81 : // With the following here, AWProjectWBFTNew is not required.
82 : //
83 0 : virtual FTMachine* cloneFTM() {return new AWProjectWBFT(*this);};
84 0 : virtual casacore::Bool useWeightImage() {return true;};
85 0 : virtual void setDryRun(casacore::Bool val) {isDryRun=val;};
86 :
87 :
88 : casacore::Int findPointingOffsets(const VisBuffer2& vb,
89 : casacore::Array<casacore::Float> &l_off,
90 : casacore::Array<casacore::Float> &m_off,
91 : casacore::Bool Evaluate);
92 : //
93 : // This method is called from AWProjectFT to compute the
94 : // sensitivity image by accumulating in the image domain
95 : // (i.e. directly accumulate the Primay Beam functions). This is
96 : // called from findConvFunction() so that sensitivity pattern is
97 : // also pre-computed along with the convolution functions. This
98 : // in-turn calls the ATerm::makeAverageResponse().
99 : //
100 : // For AWProjectWBFT class of FTMachines, this just issues a log
101 : // message indicating that this is only setting up things for
102 : // accumulation of weight images in the first gridding cycle. The
103 : // actual sensitivity patterns are computed by overloaded function
104 : // below.
105 : //
106 : virtual void makeSensitivityImage(const VisBuffer2& vb,
107 : const casacore::ImageInterface<casacore::Complex>& imageTemplate,
108 : casacore::ImageInterface<casacore::Float>& sensitivityImage);
109 : virtual void makeSensitivityImage(const VisBuffer2& vb,
110 : const casacore::ImageInterface<casacore::DComplex>& imageTemplate,
111 : casacore::ImageInterface<casacore::Float>& sensitivityImage);
112 : //
113 : // In AWProjectWBFT and its derivatives, sensitivity image is
114 : // computed by accumulating weight functions (images) during the
115 : // first gridding cycle. AWProjectFT::makeSensitivityImage() is
116 : // overloaded in AWProjectWBFT and only issues a log message.
117 : //
118 : // The following method is used to Fourier transform normalize the
119 : // accumulated weight images. doFFTNorm when true, the FFT
120 : // normalization (by pixel volume) is also done.
121 : //
122 : template <class T>
123 : void makeWBSensitivityImage(casacore::Lattice<T>& wtImage,
124 : casacore::ImageInterface<casacore::Float>& sensitivityImage,
125 : const casacore::Matrix<casacore::Float>& sumWt=casacore::Matrix<casacore::Float>(),
126 : const casacore::Bool& doFFTNorm=true);
127 : //
128 : // Method used to make normalized image from gridded visibilites.
129 : // This calls makeSensitivityImage() to make the sensitivity image
130 : // and AWProjectFT::getImage() to make the image from gridded
131 : // visibilites. AWProjectFT::getImage() internally calls
132 : // normalizeImage() which uses the sensitivty image computed by
133 : // makeSensitivtyImage().
134 : //
135 : virtual casacore::ImageInterface<casacore::Complex>&
136 : getImage(casacore::Matrix<casacore::Float>&, casacore::Bool normalize=true);
137 : //
138 : // Method used to convert the pixel value of the PB image, passed
139 : // as pbPixValue, to a value used for PB-normalization.
140 : // Typically, this will depend on the units of the "PB image"
141 : // constructed by the makeSensitivtyImage() methods. pbLimit is
142 : // the fractional pb-gain below which imaging is not required
143 : // (this value is typically the user-defined parameter in the
144 : // private member variable pbLimit_p).
145 : //
146 0 : inline virtual casacore::Float pbFunc(const casacore::Float& /*pbPixValue*/,
147 : const casacore::Float& /*pbLimit*/)
148 0 : {return 1.0;};
149 :
150 : virtual void finalizeToSky();
151 : virtual void initializeToSky(casacore::ImageInterface<casacore::Complex>& image,
152 : casacore::Matrix<casacore::Float>& weight,
153 : const VisBuffer2& vb);
154 :
155 0 : void setObservatoryLocation(const casacore::MPosition& mLocation) {mLocation_p=mLocation;};
156 :
157 0 : virtual casacore::Bool verifyShapes(casacore::IPosition shape0, casacore::IPosition shape1)
158 0 : {(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 0 : virtual casacore::Bool computeAvgPB(const casacore::Double& /*actualPA*/, const casacore::Double& /*lastPAUsedForWtImg*/)
165 0 : {return (avgPBReady_p==false);};
166 :
167 : virtual void setCFCache(casacore::CountedPtr<CFCache>& cfc, const casacore::Bool resetCFC=true);
168 : void gridImgWeights(const VisBuffer2& vb);
169 :
170 :
171 : protected:
172 : template <class T>
173 : void ftWeightImage(casacore::Lattice<T>& wtImage,
174 : const casacore::Matrix<casacore::Float>& sumWt,
175 : const casacore::Bool& doFFTNorm);
176 :
177 : virtual void resampleDataToGrid(casacore::Array<casacore::Complex>& griddedData,VBStore& vbs,
178 : const VisBuffer2& vb, casacore::Bool& dopsf);
179 : virtual void resampleDataToGrid(casacore::Array<casacore::DComplex>& griddedData,VBStore& vbs,
180 : const VisBuffer2& vb, casacore::Bool& dopsf);
181 : // virtual void resampleGridToData(VBStore& vbs, const VisBuffer2& vb);
182 : template <class T>
183 : void resampleCFToGrid(casacore::Array<T>& wtsGrid,
184 : VBStore& vbs, const VisBuffer2& vb);
185 :
186 : casacore::Bool resetPBs_p, wtImageFTDone_p;
187 :
188 : private:
189 : casacore::String tt_pp;
190 : casacore::Vector<casacore::Int> fieldIds_p;
191 : casacore::TempImage<casacore::Complex> griddedWeights;
192 : casacore::TempImage<casacore::DComplex> griddedWeights_D;
193 : CFStore rotatedCFWts_p;
194 : casacore::CountedPtr<VisibilityResamplerBase> visResamplerWt_p;
195 : casacore::Bool oneTimeMessage_p;
196 : };
197 : } //# NAMESPACE CASA - END
198 : };
199 : #endif
|