Line data Source code
1 : //# ATerm.h: Definition for ATerm
2 : //# Copyright (C) 2007
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: casa-feedback@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_ATERM_H
30 : #define SYNTHESIS_TRANSFORM2_ATERM_H
31 :
32 :
33 : #include <casacore/casa/Arrays/Vector.h>
34 : #include <casacore/casa/System/Casarc.h>
35 : #include <casacore/images/Images/ImageInterface.h>
36 : #include <casacore/images/Images/PagedImage.h>
37 : #include <casacore/images/Images/TempImage.h>
38 : #include <msvis/MSVis/VisBuffer2.h>
39 : #include <casacore/casa/Containers/Block.h>
40 : #include <synthesis/TransformMachines2/CFTerms.h>
41 : #include <synthesis/TransformMachines2/CFStore.h>
42 : #include <synthesis/TransformMachines2/CFStore2.h>
43 : #define CONVSIZE (1024*2)
44 : #define CONVWTSIZEFACTOR 1
45 : #define OVERSAMPLING 20
46 : #define THRESHOLD 1E-4
47 :
48 : namespace casa{
49 : namespace refim{
50 : using namespace vi;
51 : // <summary>
52 : // The base class to represent the Aperture-Term of the Measurement Equation.
53 : // </summary>
54 :
55 : // <use visibility=export>
56 : // <prerequisite>
57 : // </prerequisite>
58 : // <etymology>
59 : // A-Term to account for the effects of the antenna primary beam(s).
60 : // </etymology>
61 : //
62 : // <synopsis>
63 : //
64 : //</synopsis>
65 : class ATerm: public CFTerms
66 : {
67 : public:
68 : ATerm ();
69 0 : virtual ~ATerm () {};
70 :
71 : virtual casacore::String name() = 0;
72 :
73 : virtual void makeFullJones(casacore::ImageInterface<casacore::Complex>& pbImage,
74 : const VisBuffer2& vb,
75 : casacore::Bool doSquint, casacore::Int& bandID, casacore::Double freqVal)=0;
76 :
77 : virtual void applySky(casacore::ImageInterface<casacore::Float>& outputImages,
78 : const VisBuffer2& vb,
79 : const casacore::Bool doSquint=true,
80 : const casacore::Int& cfKey=0,
81 0 : const casacore::Int& muellerTerm=0,
82 : const casacore::Double freqVal=-1.0) = 0;
83 : virtual void applySky(casacore::ImageInterface<casacore::Complex>& outputImages,
84 : const VisBuffer2& vb,
85 : const casacore::Bool doSquint=true,
86 : const casacore::Int& cfKey=0,
87 0 : const casacore::Int& muellerTerm=0,
88 : const casacore::Double freqVal=-1.0) = 0;
89 : virtual void applySky(casacore::ImageInterface<casacore::Complex>& outImages,
90 : const casacore::Double& pa,
91 : const casacore::Bool doSquint,
92 : const casacore::Int& cfKey,
93 : const casacore::Int& muellerTerm,
94 : const casacore::Double freqVal)=0;
95 :
96 : //
97 : // Not sure if the following method is requried. Leaving it in
98 : // the code for now with an implementation that does nothing.
99 : //
100 : // virtual void applySky(casacore::Matrix<casacore::Complex>& screen, const casacore::Int wPixel,
101 : // const casacore::Vector<casacore::Double>& sampling,
102 : // const casacore::Int wConvSize, const casacore::Double wScale,
103 : // const casacore::Int inner)
104 : // {(void)screen; (void)wPixel; (void)sampling; (void)wConvSize; (void)wScale; (void)inner;};
105 :
106 : //
107 : // Returns a vector of integers that map each row in the given
108 : // VisBuffer to an index that is used to pick the appropriate
109 : // convolution function plane. It also returns the number of
110 : // unique baselines in the nUnique parameter (unique baselines are
111 : // defined as the number of baselines each requiring a unique
112 : // convolution function).
113 : //
114 : // This is required for Heterogeneous antenna arrays (like ALMA)
115 : // and for all arrays where not all antenna aperture illuminations
116 : // can be treated as identical.
117 : //
118 0 : virtual casacore::Int makePBPolnCoords(const VisBuffer2& vb,
119 : const casacore::Int& convSize,
120 : const casacore::Int& convSampling,
121 : const casacore::CoordinateSystem& skyCoord,
122 : const casacore::Int& skyNx, const casacore::Int& skyNy,
123 : casacore::CoordinateSystem& feedCoord)
124 : {
125 : // return makePBPolnCoords(vb.corrType(), convSize, convSampling, skyCoord,
126 0 : return makePBPolnCoords(vb.correlationTypes(), convSize, convSampling, skyCoord,
127 0 : skyNx, skyNy, feedCoord);
128 : };
129 : virtual casacore::Int makePBPolnCoords(const casacore::Vector<casacore::Int>& vbCorrTypes,
130 : const casacore::Int& convSize,
131 : const casacore::Int& convSampling,
132 : const casacore::CoordinateSystem& skyCoord,
133 : const casacore::Int& skyNx, const casacore::Int& skyNy,
134 : casacore::CoordinateSystem& feedCoord);
135 :
136 :
137 0 : virtual casacore::Vector<casacore::Int> vbRow2CFKeyMap(const VisBuffer2& vb, casacore::Int& nUnique)
138 0 : {casacore::Vector<casacore::Int> tmp; tmp.resize(vb.nRows()); tmp=0; nUnique=1; return tmp;}
139 :
140 0 : virtual void getPolMap(casacore::Vector<casacore::Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
141 0 : virtual casacore::Vector<casacore::Int> getAntTypeList() {casacore::Vector<casacore::Int> tt(1);tt(0)=0;return tt;};
142 :
143 0 : virtual void setConvSize(const casacore::Int convSize) {cachedConvSize_p=convSize;}
144 0 : virtual casacore::Int getConvSize() {return cachedConvSize_p;};
145 : // {
146 : // casacore::Int defaultConvSize=CONVSIZE;
147 : // defaultConvSize= SynthesisUtils::getenv("CONVSIZE",CONVSIZE);
148 : // // if (envStr != "")
149 : // // {
150 : // // sscanf(envStr.c_str,"%d",&defaultConvSize);
151 : // cerr << "ConvFuncSize set to " << defaultConvSize << endl;
152 : // // }
153 : // return defaultConvSize;
154 : // };
155 :
156 0 : virtual casacore::Int getOversampling() {return cachedOverSampling_p;}
157 : // {
158 : // casacore::Int defaultOverSampling=OVERSAMPLING;
159 : // char *envStr;
160 : // if ((envStr = getenv("OVERSAMPLING")) != NULL)
161 : // {
162 : // sscanf(envStr,"%d",&defaultOverSampling);
163 : // cerr << "Oversampling set to " << defaultOverSampling << endl;
164 : // }
165 : // return defaultOverSampling;
166 : // }
167 0 : virtual casacore::Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
168 0 : virtual casacore::Float getSupportThreshold() {return THRESHOLD;};
169 :
170 : // virtual casacore::Vector<casacore::Int> vbRow2CFKeyMap(const VisBuffer2& vb, casacore::Int& nUnique) = 0;
171 : // virtual casacore::Int getConvSize() = 0;
172 : // virtual casacore::Int getOversampling() = 0;
173 : // virtual casacore::Float getConvWeightSizeFactor() = 0;
174 : // virtual casacore::Float getSupportThreshold() = 0;
175 :
176 0 : virtual void normalizeImage(casacore::Lattice<casacore::Complex>& skyImage,
177 : const casacore::Matrix<casacore::Float>& weights)
178 : {
179 : (void)skyImage;(void)weights;
180 0 : throw(casacore::AipsError("Make ATerm::normalizeImage() pure virtual and implement in specializations"));
181 : };
182 :
183 : virtual void cacheVBInfo(const VisBuffer2& vb) = 0;
184 : virtual void cacheVBInfo(const casacore::String& telescopeName, const casacore::Float& diameter)=0;
185 : virtual casacore::Int getBandID(const casacore::Double& freq, const casacore::String& telescopeName, const casacore::String& bandName) = 0;
186 : virtual int getVisParams(const VisBuffer2& vb, const casacore::CoordinateSystem& skyCoord=casacore::CoordinateSystem()) = 0;
187 : //
188 : // The mapping from VisBuffer polarizations map to the Image plane
189 : // polarization. The latter is determined by the user input,
190 : // which is passed to the FTMachine in Imager.cc
191 : //
192 : // The map is available in the FTMachine which uses this method to
193 : // set the map for the ATerm object.
194 : //
195 0 : virtual void setPolMap(const casacore::Vector<casacore::Int>& polMap) {polMap_p_base.resize(0);polMap_p_base=polMap;}
196 : // virtual void rotate(const VisBuffer2& vb, CFStore2& cfs)=0;
197 : virtual void rotate(const VisBuffer2& vb, CFCell& cfc, const casacore::Double& rotAngleIncrement=5.0)=0;
198 : virtual void rotate2(const VisBuffer2& vb, CFCell& baseCFS, CFCell& cfc, const casacore::Double& rotAngleIncrement=5.0)=0;
199 0 : virtual casacore::Int mapAntIDToAntType(const casacore::Int& /*ant*/) {return 0;};
200 0 : casacore::String getTelescopeName() {return telescopeName_p;};
201 0 : virtual casacore::Bool rotationallySymmetric() {return true;};
202 :
203 : protected:
204 0 : casacore::LogIO& logIO() {return logIO_p;}
205 : casacore::LogIO logIO_p;
206 : casacore::Vector<casacore::Int> polMap_p_base;
207 : casacore::Int cachedOverSampling_p, cachedConvSize_p;
208 :
209 : casacore::Float Diameter_p, Nant_p, HPBW, sigma;
210 : };
211 : };
212 : };
213 :
214 : #endif
|