Line data Source code
1 : //# ALMAAperture.h: Definition of the ALMAAperture class
2 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //# Copyright (C) 2011 by ESO (in the framework of the ALMA collaboration)
5 : //#
6 : //# This library is free software; you can redistribute it and/or modify it
7 : //# under the terms of the GNU Library General Public License as published by
8 : //# the Free Software Foundation; either version 2 of the License, or (at your
9 : //# option) any later version.
10 : //#
11 : //# This library is distributed in the hope that it will be useful, but WITHOUT
12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 : //# License for more details.
15 : //#
16 : //# You should have received a copy of the GNU Library General Public License
17 : //# along with this library; if not, write to the Free Software Foundation,
18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 : //#
20 : //# Correspondence concerning AIPS++ should be addressed as follows:
21 : //# Internet email: casa-feedback@nrao.edu.
22 : //# Postal address: AIPS++ Project Office
23 : //# National Radio Astronomy Observatory
24 : //# 520 Edgemont Road
25 : //# Charlottesville, VA 22903-2475 USA
26 : //#
27 : //# $Id$
28 : //
29 : #ifndef SYNTHESIS_ALMAAPERTURE_H
30 : #define SYNTHESIS_ALMAAPERTURE_H
31 :
32 : #include <casacore/images/Images/PagedImage.h>
33 : #include <synthesis/TransformMachines/AzElAperture.h>
34 : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
35 : #include <synthesis/MeasurementEquations/AntennaResponses.h>
36 : #include <imageanalysis/ImageAnalysis/ImageConvolver.h>
37 : #include <casacore/images/Images/ImageRegrid.h>
38 : #include <casacore/images/Images/ImageRegrid.h>
39 : #include <casacore/casa/Arrays/ArrayFwd.h>
40 :
41 : //
42 : //---------------------------------------------------------------------
43 : //---------------------------------------------------------------------
44 : // TEMPS The following #defines should REALLY GO!
45 : //---------------------------------------------------------------------
46 : //---------------------------------------------------------------------
47 : //
48 : // #define CONVSIZE (1024*2)
49 : // #define CONVWTSIZEFACTOR sqrt(2.0)
50 : // #define OVERSAMPLING 10
51 : // #define THRESHOLD 1E-3
52 :
53 : namespace casacore{
54 :
55 : template<class T> class ImageInterface;
56 :
57 : }
58 :
59 : namespace casa { //# NAMESPACE CASA - BEGIN
60 : class VisBuffer;
61 :
62 : enum ALMAAntennaType {
63 : ALMA_INVALID = 0,
64 : ALMA_DA = 1,
65 : ALMA_DV,
66 : ALMA_CM,
67 : ALMA_PM,
68 : ALMA_numAntTypes
69 : };
70 :
71 : // class ALMAAperture : public ATerm
72 : class ALMAAperture : public AzElAperture
73 : {
74 : public:
75 : ALMAAperture();
76 :
77 : ~ALMAAperture();
78 :
79 : ALMAAperture& operator=(const ALMAAperture& other);
80 : //
81 : // Overload these functions. They are pure virtual in the base class (ATerm).
82 : //
83 : virtual void makeFullJones(casacore::ImageInterface<casacore::Complex>& pbImage,
84 : const VisBuffer& vb,
85 : casacore::Bool doSquint, casacore::Int& bandID, casacore::Double freqVal);
86 :
87 0 : virtual casacore::String name() {return casacore::String("ALMA Aperture");};
88 :
89 0 : virtual void applySky(casacore::ImageInterface<casacore::Float>& outputImage,
90 : const VisBuffer& vb,
91 : const casacore::Bool doSquint=true,
92 : const casacore::Int& cfKey=0,
93 : const casacore::Double freqVal=-1.0)
94 : {
95 0 : (void)freqVal;applySky(outputImage, vb, doSquint, cfKey, false);
96 0 : };
97 0 : virtual void applySky(casacore::ImageInterface<casacore::Complex>& outputImage,
98 : const VisBuffer& vb,
99 : const casacore::Bool doSquint=true,
100 : const casacore::Int& cfKey=0,
101 : const casacore::Double freqVal=-1.0)
102 0 : {(void)freqVal;applySky(outputImage, vb, doSquint, cfKey, false);};
103 :
104 : void applySky(casacore::ImageInterface<casacore::Float>& outputImage,
105 : const VisBuffer& vb,
106 : const casacore::Bool doSquint,
107 : const casacore::Int& cfKey,
108 : const casacore::Bool raytrace); // if true, use raytracing even if canned responses exist
109 : void applySky(casacore::ImageInterface<casacore::Complex>& outputImage,
110 : const VisBuffer& vb,
111 : const casacore::Bool doSquint,
112 : const casacore::Int& cfKey,
113 : const casacore::Bool raytrace); // if true, use raytracing even if canned responses exist
114 :
115 : virtual casacore::Vector<casacore::Int> vbRow2CFKeyMap(const VisBuffer& vb, casacore::Int& nUnique);
116 :
117 : void cacheVBInfo(const casacore::String& telescopeName, const casacore::Float& diameter);
118 : void cacheVBInfo(const VisBuffer& vb);
119 : casacore::Int getBandID(const casacore::Double& freq, const casacore::String& telescopeName);
120 :
121 0 : virtual void setPolMap(const casacore::Vector<casacore::Int>& polMap) {polMap_p.resize(0);polMap_p=polMap;};
122 0 : virtual void getPolMap(casacore::Vector<casacore::Int>& polMap) {polMap.resize(0);polMap=polMap_p;};
123 : // virtual casacore::Int getConvSize() {return CONVSIZE;};
124 : // virtual casacore::Int getOversampling() {return OVERSAMPLING;}
125 : // virtual casacore::Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
126 : // virtual casacore::Float getSupportThreshold() {return THRESHOLD;};
127 :
128 : // tell the antenna type number for each antenna in the antenna table
129 : casacore::Vector<ALMAAntennaType> antTypeMap(const VisBuffer& vb);
130 :
131 : // call this before reusing the same ALMAAperture object on a different MS
132 : void resetAntTypeMap(){antTypeMap_p.resize(0);};
133 :
134 : // derive type number from first two characters in antenna name,
135 : // return -1 if not recognised
136 : static ALMAAntennaType antTypeFromName(const casacore::String& name);
137 : static casacore::String antTypeStrFromType(const ALMAAntennaType& aType);
138 :
139 : static casacore::Int cFKeyFromAntennaTypes(const ALMAAntennaType aT1, const ALMAAntennaType aT2);
140 : static casacore::Vector<ALMAAntennaType> antennaTypesFromCFKey(const casacore::Int& cFKey);
141 :
142 : // generate the lists of antenna types for the whole vb
143 : casacore::Vector<ALMAAntennaType> antTypeList(const VisBuffer& vb);
144 :
145 : casacore::Int getVisParams(const VisBuffer& vb, const casacore::CoordinateSystem& skyCoord=casacore::CoordinateSystem());
146 : casacore::Int makePBPolnCoords(const VisBuffer&vb,
147 : const casacore::Int& convSize,
148 : const casacore::Int& convSampling,
149 : const casacore::CoordinateSystem& skyCoord,
150 : const casacore::Int& skyNx, const casacore::Int& skyNy,
151 : casacore::CoordinateSystem& feedCoord);
152 :
153 : void destroyAntResp(){ delete aR_p; aR_p=0;};
154 :
155 :
156 : private:
157 : static AntennaResponses* aR_p; // shared between all instances of this class
158 : static casacore::Bool orderMattersInCFKey;
159 : casacore::Vector<casacore::Int> polMap_p;
160 : casacore::Bool haveCannedResponses_p; // true if there are precalculated response images available
161 : casacore::Vector<ALMAAntennaType> antTypeMap_p; // maps antenna id to antenna type
162 : casacore::Vector<casacore::PagedImage<casacore::Complex>* > respImage_p;
163 : };
164 : };
165 : #endif
|