AWConvFunc.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //# AWConvFunc.h: Definition of the AWConvFunc class
00003 //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
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 { //# NAMESPACE CASA - BEGIN
00048   using namespace vi;
00049   template<class T> class ImageInterface;
00050   template<class T> class Matrix;
00051   //  class VisBuffer2;
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     //    virtual void setFeedStokes(const Vector<Int>& feedStokes) {aTerm_p->setFeedStokes(feedStokes);};
00116     virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R);
00117     virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& /*image*/,
00118                                               const VisBuffer2& /*vb*/) {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     // Global methods (services)
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1