casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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_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 { //# NAMESPACE CASA - BEGIN
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)
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   void fillConvFuncBuffer(CFBuffer& cfb, CFBuffer& cfWtb,
00078                           const Int& nx, const Int& ny,
00079                           const Vector<Double>& freqValues,
00080                           const Vector<Double>& wValues,
00081                           const Double& wScale,
00082                           const PolMapType& muellerElements,
00083                           const PolMapType& muellerElementsIndex,
00084                           const VisBuffer& vb, const Float& psScale,
00085                           PSTerm& psTerm, WTerm& wTerm, ATerm& aTerm);
00086 
00087     virtual Bool makeAverageResponse(const VisBuffer& vb, 
00088                                      const ImageInterface<Complex>& image,
00089                                      ImageInterface<Float>& theavgPB,
00090                                      Bool reset=True);
00091     virtual Bool makeAverageResponse(const VisBuffer& vb, 
00092                                      const ImageInterface<Complex>& image,
00093                                      ImageInterface<Complex>& theavgPB,
00094                                      Bool reset=True);
00095     virtual int getVisParams(const VisBuffer& vb,const CoordinateSystem& skyCoord=CoordinateSystem())
00096     {return aTerm_p->getVisParams(vb,skyCoord);};
00097     virtual void setPolMap(const Vector<Int>& polMap) {aTerm_p->setPolMap(polMap);};
00098     //    virtual void setFeedStokes(const Vector<Int>& feedStokes) {aTerm_p->setFeedStokes(feedStokes);};
00099     virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R);
00100     virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& /*image*/,
00101                                               const VisBuffer& /*vb*/) {Vector<Double> tt(2); tt=0;return tt;};
00102     virtual Bool setUpCFSupport(Array<Complex>& func, 
00103                                 Int& xSupport, Int& ySupport,
00104                                 const Float& sampling,
00105                                 const Complex& peak);
00106     virtual Bool resizeCF(Array<Complex>& func, 
00107                           Int& xSupport, Int& ySupport,
00108                           const Float& sampling,
00109                           const Complex& peak);
00110     virtual void prepareConvFunction(const VisBuffer& vb, VBRow2CFBMapType& cfs);
00111     Int mapAntIDToAntType(const Int& ant) {return aTerm_p->mapAntIDToAntType(ant);};
00112 
00113     virtual Vector<Double> makeFreqValList(Double& freqScale,
00114                                            const VisBuffer& vb, 
00115                                            const ImageInterface<Complex>& uvGrid);
00116     virtual Vector<Double> makeWValList(const Double &dW, const Int &nW);
00117 
00118     virtual void setMiscInfo(const RecordInterface& params);
00119     virtual Matrix<Double> getFreqRangePerSpw(const VisBuffer& vb);
00120 
00121   protected:
00122     void normalizeAvgPB(ImageInterface<Complex>& inImage,
00123                         ImageInterface<Float>& outImage);
00124     Bool makeAverageResponse_org(const VisBuffer& vb, 
00125                                  const ImageInterface<Complex>& image,
00126                                  ImageInterface<Float>& theavgPB,
00127                                  Bool reset=True);
00128     void makePBSq(ImageInterface<Complex>& inImage);
00129     void makeConjPolAxis(CoordinateSystem& cs);
00130 
00131     Complex cfArea(Matrix<Complex>& cf, const Int& xSupport, const Int& ySupport, const Float& sampling);
00132 
00133     CountedPtr<ATerm> aTerm_p;
00134     CountedPtr<PSTerm> psTerm_p;
00135     CountedPtr<WTerm> wTerm_p;
00136     Vector<Double> thePix_p, pixFieldGrad_p;
00137     Double imRefFreq_p;
00138     Bool wbAWP_p;
00139   };
00140   //
00141   //-------------------------------------------------------------------------------------------
00142   //
00143 };
00144 #endif