Line data Source code
1 : // -*- C++ -*-
2 : //# AWConvFunc.h: Definition of the AWConvFunc class
3 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
4 : //# Associated Universities, Inc. Washington DC, USA.
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: aips2-request@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_AWCONVFUNC_H
30 : #define SYNTHESIS_AWCONVFUNC_H
31 :
32 : #include <synthesis/TransformMachines/ConvolutionFunction.h>
33 : #include <synthesis/TransformMachines/PolOuterProduct.h>
34 : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
35 : #include <synthesis/TransformMachines/CFStore.h>
36 : #include <synthesis/TransformMachines/CFStore2.h>
37 : #include <synthesis/TransformMachines/CFBuffer.h>
38 : #include <synthesis/TransformMachines/PSTerm.h>
39 : #include <synthesis/TransformMachines/WTerm.h>
40 : #include <synthesis/TransformMachines/ATerm.h>
41 : #include <casacore/images/Images/ImageInterface.h>
42 : #include <casacore/images/Images/TempImage.h>
43 : #include <casacore/casa/Logging/LogIO.h>
44 : #include <casacore/casa/Logging/LogSink.h>
45 : #include <casacore/casa/Logging/LogOrigin.h>
46 : #include <casacore/casa/Arrays/ArrayFwd.h>
47 :
48 : namespace casacore{
49 :
50 : template<class T> class ImageInterface;
51 :
52 : }
53 :
54 : namespace casa { //# NAMESPACE CASA - BEGIN
55 : class VisBuffer;
56 : //
57 : //-------------------------------------------------------------------------------------------
58 : //
59 : class AWConvFunc : public ConvolutionFunction
60 : {
61 : public:
62 : AWConvFunc(const casacore::CountedPtr<ATerm> ATerm,
63 : const casacore::CountedPtr<PSTerm> psTerm,
64 : const casacore::CountedPtr<WTerm> wTerm,
65 : const casacore::Bool wbAWP=false,
66 : const casacore::Bool conjPB=casacore::True);
67 :
68 0 : ~AWConvFunc() {};
69 : AWConvFunc& operator=(const AWConvFunc& other);
70 : virtual void makeConvFunction(const casacore::ImageInterface<casacore::Complex>& image,
71 : const VisBuffer& vb,
72 : const casacore::Int wConvSize,
73 : const casacore::CountedPtr<PolOuterProduct>& pop,
74 : const casacore::Float pa,
75 : const casacore::Float dpa,
76 : const casacore::Vector<casacore::Double>& uvScale,
77 : const casacore::Vector<casacore::Double>& uvOffset,
78 : const casacore::Matrix<casacore::Double>& vbFreqSelection,
79 : CFStore2& cfs,
80 : CFStore2& cfwts,
81 : casacore::Bool fillCF=true);
82 : virtual void fillConvFuncBuffer(CFBuffer& cfb, CFBuffer& cfWtb,
83 : const casacore::Int& nx, const casacore::Int& ny,
84 : const casacore::Vector<casacore::Double>& freqValues,
85 : const casacore::Vector<casacore::Double>& wValues,
86 : const casacore::Double& wScale,
87 : const casacore::Double& vbPA, const casacore::Double& freqHi,
88 : const PolMapType& muellerElements,
89 : const PolMapType& muellerElementsIndex,
90 : const VisBuffer& vb, const casacore::Float& psScale,
91 : PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm,
92 : casacore::Bool isDryRun=false);
93 : static void makeConvFunction2(const casacore::String& uvGridDiskimage,
94 : const casacore::Vector<casacore::Double>& uvScale,
95 : const casacore::Vector<casacore::Double>& uvOffset,
96 : const casacore::Matrix<casacore::Double>& vbFreqSelection,
97 : CFStore2& cfs,
98 : CFStore2& cfwts,
99 : const casacore::Bool psTermOn,
100 : const casacore::Bool aTermOn,
101 : const casacore::Bool conjBeams);
102 : static void fillConvFuncBuffer2(CFBuffer& cfb, CFBuffer& cfWtb,
103 : const casacore::Int& nx, const casacore::Int& ny,
104 : const casacore::ImageInterface<casacore::Complex>& skyImage,
105 : //const CoordinateSystem& skyCoords,
106 : const CFCStruct& miscInfo,
107 : PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm,
108 : casacore::Bool conjPB);
109 :
110 : virtual casacore::Bool makeAverageResponse(const VisBuffer& vb,
111 : const casacore::ImageInterface<casacore::Complex>& image,
112 : casacore::ImageInterface<casacore::Float>& theavgPB,
113 : casacore::Bool reset=true);
114 : virtual casacore::Bool makeAverageResponse(const VisBuffer& vb,
115 : const casacore::ImageInterface<casacore::Complex>& image,
116 : casacore::ImageInterface<casacore::Complex>& theavgPB,
117 : casacore::Bool reset=true);
118 :
119 0 : virtual int getVisParams(const VisBuffer& vb,const casacore::CoordinateSystem& skyCoord=casacore::CoordinateSystem())
120 0 : {return aTerm_p->getVisParams(vb,skyCoord);};
121 :
122 0 : virtual void setPolMap(const casacore::Vector<casacore::Int>& polMap) {aTerm_p->setPolMap(polMap);};
123 : // virtual void setFeedStokes(const casacore::Vector<casacore::Int>& feedStokes) {aTerm_p->setFeedStokes(feedStokes);};
124 :
125 : virtual casacore::Bool findSupport(casacore::Array<casacore::Complex>& func, casacore::Float& threshold,casacore::Int& origin, casacore::Int& R);
126 :
127 0 : virtual casacore::Vector<casacore::Double> findPointingOffset(const casacore::ImageInterface<casacore::Complex>& /*image*/,
128 : const VisBuffer& /*vb*/)
129 0 : {casacore::Vector<casacore::Double> tt(2); tt=0;return tt;};
130 :
131 : virtual void prepareConvFunction(const VisBuffer& vb, VBRow2CFBMapType& cfs);
132 0 : casacore::Int mapAntIDToAntType(const casacore::Int& ant) {return aTerm_p->mapAntIDToAntType(ant);};
133 :
134 : virtual casacore::Vector<casacore::Double> makeFreqValList(casacore::Double& freqScale,const VisBuffer& vb,
135 : const casacore::ImageInterface<casacore::Complex>& uvGrid,
136 : casacore::Vector<String>& bandNames);
137 : virtual casacore::Vector<casacore::Double> makeWValList(const casacore::Double &dW, const casacore::Int &nW);
138 :
139 : virtual void setMiscInfo(const casacore::RecordInterface& params);
140 :
141 : virtual casacore::Matrix<casacore::Double> getFreqRangePerSpw(const VisBuffer& vb);
142 :
143 :
144 :
145 : //
146 : // Global methods (services)
147 : //
148 : static void makeConjPolAxis(casacore::CoordinateSystem& cs, casacore::Int conjStokes_in=-1);
149 : static casacore::Complex cfArea(casacore::Matrix<casacore::Complex>& cf, const casacore::Int& xSupport,
150 : const casacore::Int& ySupport, const casacore::Float& sampling);
151 : static casacore::Bool awFindSupport(casacore::Array<casacore::Complex>& func, casacore::Float& threshold,
152 : casacore::Int& origin, casacore::Int& radius);
153 : static casacore::Bool setUpCFSupport(casacore::Array<casacore::Complex>& func, casacore::Int& xSupport,
154 : casacore::Int& ySupport,const casacore::Float& sampling, const casacore::Complex& peak);
155 : static casacore::Bool resizeCF(casacore::Array<casacore::Complex>& func, casacore::Int& xSupport,
156 : casacore::Int& ySupport, const casacore::Int& supportBuffer, const casacore::Float& sampling,
157 : const casacore::Complex& peak);
158 : static int getOversampling(PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
159 0 : virtual casacore::CountedPtr<CFTerms> getTerm(const casacore::String& name)
160 0 : {if (name=="ATerm") return aTerm_p; else return NULL;}
161 :
162 :
163 : casacore::CountedPtr<ATerm> aTerm_p;
164 : casacore::CountedPtr<PSTerm> psTerm_p;
165 : casacore::CountedPtr<WTerm> wTerm_p;
166 :
167 : protected:
168 : void normalizeAvgPB(casacore::ImageInterface<casacore::Complex>& inImage,
169 : casacore::ImageInterface<casacore::Float>& outImage);
170 : casacore::Bool makeAverageResponse_org(const VisBuffer& vb,
171 : const casacore::ImageInterface<casacore::Complex>& image,
172 : casacore::ImageInterface<casacore::Float>& theavgPB,
173 : casacore::Bool reset=true);
174 : void makePBSq(casacore::ImageInterface<casacore::Complex>& inImage);
175 :
176 :
177 : casacore::Vector<casacore::Double> thePix_p, pixFieldGrad_p;
178 : casacore::Double imRefFreq_p;
179 : casacore::Bool wbAWP_p, conjPB_p;
180 : casacore::CountedPtr<CFBuffer> baseCFB_p;
181 : };
182 : //
183 : //-------------------------------------------------------------------------------------------
184 : //
185 : };
186 : #endif
|