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_TRANSFORM2_ATERM_H
30 #define SYNTHESIS_TRANSFORM2_ATERM_H
31 
32 
33 #include <casa/Arrays/Vector.h>
34 #include <casa/System/Casarc.h>
38 #include <msvis/MSVis/VisBuffer2.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  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  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  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  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  //
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  return makePBPolnCoords(vb.correlationTypes(), convSize, convSampling, skyCoord,
127  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 
138  {casacore::Vector<casacore::Int> tmp; tmp.resize(vb.nRows()); tmp=0; nUnique=1; return tmp;}
139 
140  virtual void getPolMap(casacore::Vector<casacore::Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
142 
143  virtual void setConvSize(const casacore::Int convSize) {cachedConvSize_p=convSize;}
144  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  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  // }
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 
177  const casacore::Matrix<casacore::Float>& weights)
178  {
179  (void)skyImage;(void)weights;
180  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  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  virtual casacore::Int mapAntIDToAntType(const casacore::Int& /*ant*/) {return 0;};
200  casacore::String getTelescopeName() {return telescopeName_p;};
201  virtual casacore::Bool rotationallySymmetric() {return true;};
202 
203  protected:
204  casacore::LogIO& logIO() {return logIO_p;}
208 
209  casacore::Float Diameter_p, Nant_p, HPBW, sigma;
210  };
211  };
212 };
213 
214 #endif
virtual void getPolMap(casacore::Vector< casacore::Int > &polMap)
Definition: ATerm.h:140
virtual casacore::Float getConvWeightSizeFactor()
{ casacore::Int defaultOverSampling=OVERSAMPLING; char *envStr; if ((envStr = getenv(&quot;OVERSAMPLING&quot;))...
Definition: ATerm.h:167
int Int
Definition: aipstype.h:50
virtual casacore::Vector< casacore::Int > vbRow2CFKeyMap(const VisBuffer2 &vb, casacore::Int &nUnique)
Not sure if the following method is requried.
Definition: ATerm.h:137
virtual casacore::Int mapAntIDToAntType(const casacore::Int &)
Definition: ATerm.h:199
casacore::Int cachedOverSampling_p
Definition: ATerm.h:207
virtual casacore::Int makePBPolnCoords(const VisBuffer2 &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:118
casacore::LogIO logIO_p
Definition: ATerm.h:205
virtual casacore::Int getConvSize()
Definition: ATerm.h:144
ostream-like interface to creating log messages.
Definition: LogIO.h:167
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
virtual void normalizeImage(casacore::Lattice< casacore::Complex > &skyImage, const casacore::Matrix< casacore::Float > &weights)
virtual casacore::Vector&lt;casacore::Int&gt; vbRow2CFKeyMap(const VisBuffer2&amp; vb, casacore::Int&amp; nUnique) ...
Definition: ATerm.h:176
#define THRESHOLD
Definition: ATerm.h:46
#define CONVWTSIZEFACTOR
Definition: ATerm.h:44
virtual casacore::Vector< casacore::Int > getAntTypeList()
Definition: ATerm.h:141
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
virtual const casacore::Vector< casacore::Int > & correlationTypes() const =0
Returns the correlation type of each correlation in the VisCube.
double Double
Definition: aipstype.h:55
virtual casacore::Int nRows() const =0
Returns the number of rows in this VisBuffer.
virtual casacore::Float getSupportThreshold()
Definition: ATerm.h:168
virtual casacore::Bool rotationallySymmetric()
Definition: ATerm.h:201
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
The base class to represent the Aperture-Term of the Measurement Equation.
Definition: CFTerms.h:57
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; };
Definition: ATerm.h:156
virtual void setConvSize(const casacore::Int convSize)
Definition: ATerm.h:143
The base class to represent the Aperture-Term of the Measurement Equation.
Definition: ATerm.h:65
casacore::Vector< casacore::Int > polMap_p_base
Definition: ATerm.h:206
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
casacore::LogIO & logIO()
Definition: ATerm.h:204
virtual void setPolMap(const casacore::Vector< casacore::Int > &polMap)
The mapping from VisBuffer polarizations map to the Image plane polarization.
Definition: ATerm.h:195
Base class for all Casacore library errors.
Definition: Error.h:134
casacore::String getTelescopeName()
Definition: ATerm.h:200
casacore::Float sigma
Definition: ATerm.h:209
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
void resize(size_t len, Bool copyValues=False)
Definition: Vector.h:167
void rotate2(const double &actualPA, CFCell &baseCFC, CFCell &cfc, const double &rotAngleIncr)
Interconvert pixel and world coordinates.
virtual ~ATerm()
Definition: ATerm.h:69