00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SYNTHESIS_AWCONVFUNC_H
00030 #define SYNTHESIS_AWCONVFUNC_H
00031
00032 #include <synthesis/TransformMachines/ConvolutionFunction.h>
00033 #include <synthesis/TransformMachines/PolOuterProduct.h>
00034 #include <coordinates/Coordinates/DirectionCoordinate.h>
00035 #include <synthesis/TransformMachines/CFStore.h>
00036 #include <synthesis/TransformMachines/CFStore2.h>
00037 #include <synthesis/TransformMachines/CFBuffer.h>
00038 #include <synthesis/TransformMachines/PSTerm.h>
00039 #include <synthesis/TransformMachines/WTerm.h>
00040 #include <synthesis/TransformMachines/ATerm.h>
00041 #include <images/Images/ImageInterface.h>
00042 #include <images/Images/TempImage.h>
00043 #include <casa/Logging/LogIO.h>
00044 #include <casa/Logging/LogSink.h>
00045 #include <casa/Logging/LogOrigin.h>
00046
00047 namespace casa {
00048 template<class T> class ImageInterface;
00049 template<class T> class Matrix;
00050 class VisBuffer;
00051
00052
00053
00054 class AWConvFunc : public ConvolutionFunction
00055 {
00056 public:
00057 AWConvFunc(const CountedPtr<ATerm> ATerm,
00058 const CountedPtr<PSTerm> psTerm,
00059 const CountedPtr<WTerm> wTerm,
00060 const Bool wbAWP=False):
00061 ConvolutionFunction(),aTerm_p(ATerm),psTerm_p(psTerm), wTerm_p(wTerm), pixFieldGrad_p(),
00062 wbAWP_p(wbAWP), baseCFB_p()
00063 {pixFieldGrad_p.resize(2);pixFieldGrad_p=0.0;}
00064
00065 ~AWConvFunc() {};
00066 AWConvFunc& operator=(const AWConvFunc& other);
00067 virtual void makeConvFunction(const ImageInterface<Complex>& image,
00068 const VisBuffer& vb,
00069 const Int wConvSize,
00070 const CountedPtr<PolOuterProduct>& pop,
00071 const Float pa,
00072 const Float dpa,
00073 const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00074 const Matrix<Double>& vbFreqSelection,
00075 CFStore2& cfs,
00076 CFStore2& cfwts,
00077 Bool fillCF=True);
00078 virtual void fillConvFuncBuffer(CFBuffer& cfb, CFBuffer& cfWtb,
00079 const Int& nx, const Int& ny,
00080 const Vector<Double>& freqValues,
00081 const Vector<Double>& wValues,
00082 const Double& wScale,
00083 const Double& vbPA, const Double& freqHi,
00084 const PolMapType& muellerElements,
00085 const PolMapType& muellerElementsIndex,
00086 const VisBuffer& vb, const Float& psScale,
00087 PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm,
00088 Bool isDryRun=False);
00089 static void makeConvFunction2(const String& uvGridDiskimage,
00090 const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00091 const Matrix<Double>& vbFreqSelection,
00092 CFStore2& cfs,
00093 CFStore2& cfwts,
00094 const Bool psTermOn,
00095 const Bool aTermOn);
00096 static void fillConvFuncBuffer2(CFBuffer& cfb, CFBuffer& cfWtb,
00097 const Int& nx, const Int& ny,
00098 const ImageInterface<Complex>& skyImage,
00099
00100 const CFCStruct& miscInfo,
00101 PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
00102
00103 virtual Bool makeAverageResponse(const VisBuffer& vb,
00104 const ImageInterface<Complex>& image,
00105 ImageInterface<Float>& theavgPB,
00106 Bool reset=True);
00107 virtual Bool makeAverageResponse(const VisBuffer& vb,
00108 const ImageInterface<Complex>& image,
00109 ImageInterface<Complex>& theavgPB,
00110 Bool reset=True);
00111 virtual int getVisParams(const VisBuffer& vb,const CoordinateSystem& skyCoord=CoordinateSystem())
00112 {return aTerm_p->getVisParams(vb,skyCoord);};
00113 virtual void setPolMap(const Vector<Int>& polMap) {aTerm_p->setPolMap(polMap);};
00114
00115 virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R);
00116 virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& ,
00117 const VisBuffer& ) {Vector<Double> tt(2); tt=0;return tt;};
00118 virtual void prepareConvFunction(const VisBuffer& vb, VBRow2CFBMapType& cfs);
00119 Int mapAntIDToAntType(const Int& ant) {return aTerm_p->mapAntIDToAntType(ant);};
00120
00121 virtual Vector<Double> makeFreqValList(Double& freqScale,
00122 const VisBuffer& vb,
00123 const ImageInterface<Complex>& uvGrid);
00124 virtual Vector<Double> makeWValList(const Double &dW, const Int &nW);
00125
00126 virtual void setMiscInfo(const RecordInterface& params);
00127 virtual Matrix<Double> getFreqRangePerSpw(const VisBuffer& vb);
00128
00129
00130
00131
00132
00133
00134 static void makeConjPolAxis(CoordinateSystem& cs, Int conjStokes_in=-1);
00135 static Complex cfArea(Matrix<Complex>& cf, const Int& xSupport, const Int& ySupport, const Float& sampling);
00136 static Bool awFindSupport(Array<Complex>& func, Float& threshold, Int& origin, Int& radius);
00137 static Bool setUpCFSupport(Array<Complex>& func, Int& xSupport, Int& ySupport,
00138 const Float& sampling, const Complex& peak);
00139 static Bool resizeCF(Array<Complex>& func, Int& xSupport, Int& ySupport,
00140 const Int& supportBuffer, const Float& sampling, const Complex& peak);
00141 static Int getOversampling(PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
00142 virtual CountedPtr<CFTerms> getTerm(const String& name)
00143 {if (name=="ATerm") return aTerm_p; else return NULL;}
00144
00145
00146 CountedPtr<ATerm> aTerm_p;
00147 CountedPtr<PSTerm> psTerm_p;
00148 CountedPtr<WTerm> wTerm_p;
00149
00150 protected:
00151 void normalizeAvgPB(ImageInterface<Complex>& inImage,
00152 ImageInterface<Float>& outImage);
00153 Bool makeAverageResponse_org(const VisBuffer& vb,
00154 const ImageInterface<Complex>& image,
00155 ImageInterface<Float>& theavgPB,
00156 Bool reset=True);
00157 void makePBSq(ImageInterface<Complex>& inImage);
00158
00159
00160 Vector<Double> thePix_p, pixFieldGrad_p;
00161 Double imRefFreq_p;
00162 Bool wbAWP_p;
00163 CountedPtr<CFBuffer> baseCFB_p;
00164 };
00165
00166
00167
00168 };
00169 #endif