casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATerm.h
Go to the documentation of this file.
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 <casa/Arrays/Vector.h>
34 #include <casa/System/Casarc.h>
38 #include <msvis/MSVis/VisBuffer.h>
39 #include <casa/Containers/Block.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  virtual ~ATerm () {};
68 
69  virtual casacore::String name() = 0;
70 
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;
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  //
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  return makePBPolnCoords(vb.corrType(), convSize, convSampling, skyCoord,
124  skyNx, skyNy, feedCoord);
125  };
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 
135  {casacore::Vector<casacore::Int> tmp; tmp.resize(vb.nRow()); tmp=0; nUnique=1; return tmp;}
136 
137  virtual void getPolMap(casacore::Vector<casacore::Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
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  // }
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 
172  const casacore::Matrix<casacore::Float>& weights)
173  {
174  (void)skyImage;(void)weights;
175  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  //
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  virtual casacore::Int mapAntIDToAntType(const casacore::Int& /*ant*/) {return 0;};
196  virtual casacore::Bool rotationallySymmetric() {return true;};
197 
198  protected:
203 
206  };
207 
208 };
209 
210 #endif
virtual casacore::Int mapAntIDToAntType(const casacore::Int &)
Definition: ATerm.h:194
int Int
Definition: aipstype.h:50
virtual ~ATerm()
Definition: ATerm.h:67
virtual void applySky(casacore::ImageInterface< casacore::Float > &outputImages, const VisBuffer &vb, const casacore::Bool doSquint=true, const casacore::Int &cfKey=0, const casacore::Int &muellerTerm=0, const casacore::Double freqVal=-1.0)=0
virtual casacore::Float getConvWeightSizeFactor()
{ casacore::Int defaultOverSampling=OVERSAMPLING; char *envStr; if ((envStr = getenv(&quot;OVERSAMPLING&quot;))...
Definition: ATerm.h:162
virtual casacore::Vector< casacore::Int > getAntTypeList()
Definition: ATerm.h:138
virtual void rotate(const VisBuffer &vb, CFCell &cfc, const casacore::Double &rotAngleIncrement=5.0)=0
virtual void rotate(const VisBuffer&amp; vb, CFStore2&amp; cfs)=0;
virtual casacore::Float getSupportThreshold()
Definition: ATerm.h:163
casacore::Float Nant_p
Definition: ATerm.h:204
virtual casacore::Int getBandID(const casacore::Double &freq, const casacore::String &telescopeName, const casacore::String &bandName)=0
virtual casacore::String name()=0
casacore::LogIO logIO_p
Definition: ATerm.h:200
The base class to represent the Aperture-Term of the Measurement Equation.
Definition: CFTerms.h:55
virtual casacore::Int & nRow()
virtual casacore::Int &amp; nCat() { return nCatOK_p ? nCat_p : fillnCat(); } virtual casacore::Int nCat(...
Definition: VisBuffer.h:245
virtual int getVisParams(const VisBuffer &vb, const casacore::CoordinateSystem &skyCoord=casacore::CoordinateSystem())=0
virtual casacore::Int makePBPolnCoords(const VisBuffer &vb, const casacore::Int &convSize, const casacore::Int &convSampling, const casacore::CoordinateSystem &skyCoord, const casacore::Int &skyNx, const casacore::Int &skyNy, casacore::CoordinateSystem &feedCoord)
Not sure if the following method is requried.
Definition: ATerm.h:116
casacore::String telescopeName_p
Definition: ATerm.h:205
ostream-like interface to creating log messages.
Definition: LogIO.h:167
virtual void setPolMap(const casacore::Vector< casacore::Int > &polMap)
The mapping from VisBuffer polarizations map to the Image plane polarization.
Definition: ATerm.h:190
virtual casacore::Vector< casacore::Int > vbRow2CFKeyMap(const VisBuffer &vb, casacore::Int &nUnique)
Not sure if the following method is requried.
Definition: ATerm.h:134
casacore::LogIO & logIO()
Definition: ATerm.h:199
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
double Double
Definition: aipstype.h:55
casacore::Vector< casacore::Int > polMap_p_base
Definition: ATerm.h:201
casacore::Int cachedOverSampling_p
Definition: ATerm.h:202
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Float sigma
Definition: ATerm.h:204
casacore::Float Diameter_p
Definition: ATerm.h:204
float Float
Definition: aipstype.h:54
casacore::Int cachedConvSize_p
Definition: ATerm.h:202
virtual casacore::Vector< casacore::Int > & corrType()
Definition: VisBuffer.h:476
virtual casacore::Int getConvSize()
virtual void normalizeImage(casacore::Lattice< casacore::Complex > &skyImage, const casacore::Matrix< casacore::Float > &weights)
virtual casacore::Vector&lt;casacore::Int&gt; vbRow2CFKeyMap(const VisBuffer&amp; vb, casacore::Int&amp; nUnique) =...
Definition: ATerm.h:171
virtual void rotate2(const VisBuffer &vb, CFCell &baseCFS, CFCell &cfc, const casacore::Double &rotAngleIncrement=5.0)=0
virtual void getPolMap(casacore::Vector< casacore::Int > &polMap)
Definition: ATerm.h:137
#define CONVWTSIZEFACTOR
Definition: ATerm.h:44
Base class for all Casacore library errors.
Definition: Error.h:134
virtual casacore::Int getOversampling()
{ casacore::Int defaultConvSize=CONVSIZE; defaultConvSize= SynthesisUtils::getenv(&quot;CONVSIZE&quot;,CONVSIZE); if (envStr != &quot;&quot;) { sscanf(envStr.c_str,&quot;%d&quot;,&amp;defaultConvSize); cerr &lt;&lt; &quot;ConvFuncSize set to &quot; &lt;&lt; defaultConvSize &lt;&lt; endl; } return defaultConvSize; };
The base class to represent the Aperture-Term of the Measurement Equation.
Definition: ATerm.h:63
template &lt;class t&gt;=&quot;&quot;&gt;
Definition: CFCell.h:92
String: the storage and methods of handling collections of characters.
Definition: String.h:223
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual void makeFullJones(casacore::ImageInterface< casacore::Complex > &pbImage, const VisBuffer &vb, casacore::Bool doSquint, casacore::Int &bandID, casacore::Double freqVal)=0
virtual void cacheVBInfo(const VisBuffer &vb)=0
void resize(size_t len, Bool copyValues=False)
Definition: Vector.h:167
casacore::Float HPBW
Definition: ATerm.h:204
Interconvert pixel and world coordinates.
casacore::String getTelescopeName()
Definition: ATerm.h:195
virtual casacore::Bool rotationallySymmetric()
Definition: ATerm.h:196
#define THRESHOLD
Definition: ATerm.h:46