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_TRANSFORM2_AWCONVFUNC_H
00030 #define SYNTHESIS_TRANSFORM2_AWCONVFUNC_H
00031
00032 #include <synthesis/TransformMachines2/ConvolutionFunction.h>
00033 #include <synthesis/TransformMachines2/PolOuterProduct.h>
00034 #include <coordinates/Coordinates/DirectionCoordinate.h>
00035 #include <synthesis/TransformMachines2/CFStore.h>
00036 #include <synthesis/TransformMachines2/CFStore2.h>
00037 #include <synthesis/TransformMachines2/CFBuffer.h>
00038 #include <synthesis/TransformMachines2/PSTerm.h>
00039 #include <synthesis/TransformMachines2/WTerm.h>
00040 #include <synthesis/TransformMachines2/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 #include <msvis/MSVis/VisBuffer2.h>
00047 namespace casa {
00048 using namespace vi;
00049 template<class T> class ImageInterface;
00050 template<class T> class Matrix;
00051
00052
00053
00054
00055 namespace refim{
00056 class AWConvFunc : public ConvolutionFunction
00057 {
00058 public:
00059 AWConvFunc(const CountedPtr<ATerm> ATerm,
00060 const CountedPtr<PSTerm> psTerm,
00061 const CountedPtr<WTerm> wTerm,
00062 const Bool wbAWP=False):
00063 ConvolutionFunction(),aTerm_p(ATerm),psTerm_p(psTerm), wTerm_p(wTerm), pixFieldGrad_p(),
00064 wbAWP_p(wbAWP), baseCFB_p()
00065 {pixFieldGrad_p.resize(2);pixFieldGrad_p=0.0;}
00066
00067 ~AWConvFunc() {};
00068 AWConvFunc& operator=(const AWConvFunc& other);
00069 virtual void makeConvFunction(const ImageInterface<Complex>& image,
00070 const VisBuffer2& vb,
00071 const Int wConvSize,
00072 const CountedPtr<PolOuterProduct>& pop,
00073 const Float pa,
00074 const Float dpa,
00075 const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00076 const Matrix<Double>& vbFreqSelection,
00077 CFStore2& cfs,
00078 CFStore2& cfwts,
00079 Bool fillCF=True);
00080 virtual void fillConvFuncBuffer(CFBuffer& cfb, CFBuffer& cfWtb,
00081 const Int& nx, const Int& ny,
00082 const Vector<Double>& freqValues,
00083 const Vector<Double>& wValues,
00084 const Double& wScale,
00085 const Double& vbPA, const Double& freqHi,
00086 const PolMapType& muellerElements,
00087 const PolMapType& muellerElementsIndex,
00088 const VisBuffer2& vb, const Float& psScale,
00089 PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm,
00090 Bool isDryRun=False);
00091 static void makeConvFunction2(const String& uvGridDiskimage,
00092 const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00093 const Matrix<Double>& vbFreqSelection,
00094 CFStore2& cfs,
00095 CFStore2& cfwts,
00096 const Bool psTermOn,
00097 const Bool aTermOn);
00098 static void fillConvFuncBuffer2(CFBuffer& cfb, CFBuffer& cfWtb,
00099 const Int& nx, const Int& ny,
00100 const ImageInterface<Complex>& skyImage,
00101 const CFCStruct& miscInfo,
00102 PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
00103
00104 virtual Bool makeAverageResponse(const VisBuffer2& vb,
00105 const ImageInterface<Complex>& image,
00106 ImageInterface<Float>& theavgPB,
00107 Bool reset=True);
00108 virtual Bool makeAverageResponse(const VisBuffer2& vb,
00109 const ImageInterface<Complex>& image,
00110 ImageInterface<Complex>& theavgPB,
00111 Bool reset=True);
00112 virtual int getVisParams(const VisBuffer2& vb,const CoordinateSystem& skyCoord=CoordinateSystem())
00113 {return aTerm_p->getVisParams(vb,skyCoord);};
00114 virtual void setPolMap(const Vector<Int>& polMap) {aTerm_p->setPolMap(polMap);};
00115
00116 virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R);
00117 virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& ,
00118 const VisBuffer2& ) {Vector<Double> tt(2); tt=0;return tt;};
00119 virtual void prepareConvFunction(const VisBuffer2& vb, VBRow2CFBMapType& cfs);
00120 Int mapAntIDToAntType(const Int& ant) {return aTerm_p->mapAntIDToAntType(ant);};
00121
00122 virtual Vector<Double> makeFreqValList(Double& freqScale,
00123 const VisBuffer2& vb,
00124 const ImageInterface<Complex>& uvGrid);
00125 virtual Vector<Double> makeWValList(const Double &dW, const Int &nW);
00126
00127 virtual void setMiscInfo(const RecordInterface& params);
00128 virtual Matrix<Double> getFreqRangePerSpw(const VisBuffer2& vb);
00129
00130
00131
00132
00133
00134
00135 static void makeConjPolAxis(CoordinateSystem& cs, Int conjStokes_in=-1);
00136 static Complex cfArea(Matrix<Complex>& cf, const Int& xSupport, const Int& ySupport, const Float& sampling);
00137 static Bool awFindSupport(Array<Complex>& func, Float& threshold, Int& origin, Int& radius);
00138 static Bool setUpCFSupport(Array<Complex>& func, Int& xSupport, Int& ySupport,
00139 const Float& sampling, const Complex& peak);
00140 static Bool resizeCF(Array<Complex>& func, Int& xSupport, Int& ySupport,
00141 const Int& supportBuffer, const Float& sampling, const Complex& peak);
00142 static Int getOversampling(PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
00143 virtual CountedPtr<CFTerms> getTerm(const String& name)
00144 {if (name=="ATerm") return aTerm_p; else return NULL;}
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 VisBuffer2& 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 };
00170 #endif