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