ATerm.h

Go to the documentation of this file.
00001 //# ATerm.h: Definition for ATerm
00002 //# Copyright (C) 2007
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef SYNTHESIS_ATERM_H
00030 #define SYNTHESIS_ATERM_H
00031 
00032 
00033 #include <casa/Arrays/Vector.h>
00034 #include <casa/System/Casarc.h>
00035 #include <images/Images/ImageInterface.h>
00036 #include <images/Images/PagedImage.h>
00037 #include <images/Images/TempImage.h>
00038 #include <msvis/MSVis/VisBuffer.h>
00039 #include <casa/Containers/Block.h>
00040 #include <synthesis/TransformMachines/CFTerms.h>
00041 #include <synthesis/TransformMachines/CFStore.h>
00042 #include <synthesis/TransformMachines/CFStore2.h>
00043 #define CONVSIZE (1024*2)
00044 #define CONVWTSIZEFACTOR 1
00045 #define OVERSAMPLING 20
00046 #define THRESHOLD 1E-4
00047 
00048 namespace casa{
00049   // <summary>  
00050   //  The base class to represent the Aperture-Term of the Measurement Equation. 
00051   // </summary>
00052   
00053   // <use visibility=export>
00054   // <prerequisite>
00055   // </prerequisite>
00056   // <etymology>
00057   //   A-Term to account for the effects of the antenna primary beam(s).
00058   // </etymology>
00059   //
00060   // <synopsis> 
00061   // 
00062   //</synopsis>
00063   class ATerm: public CFTerms
00064   {
00065   public:
00066     ATerm ();
00067     virtual ~ATerm () {};
00068 
00069     virtual String name() = 0;
00070 
00071     virtual void makeFullJones(ImageInterface<Complex>& pbImage,
00072                                const VisBuffer& vb,
00073                                Bool doSquint, Int& bandID, Double freqVal)=0;
00074 
00075     virtual void applySky(ImageInterface<Float>& outputImages,
00076                           const VisBuffer& vb, 
00077                           const Bool doSquint=True,
00078                           const Int& cfKey=0,
00079                           const Int& muellerTerm=0,
00080                           const Double freqVal=-1.0) = 0;
00081     virtual void applySky(ImageInterface<Complex>& outputImages,
00082                           const VisBuffer& vb, 
00083                           const Bool doSquint=True,
00084                           const Int& cfKey=0,
00085                           const Int& muellerTerm=0,
00086                           const Double freqVal=-1.0) = 0;
00087     virtual void applySky(ImageInterface<Complex>& outImages,
00088                           const Double& pa,
00089                           const Bool doSquint,
00090                           const Int& cfKey,
00091                           const Int& muellerTerm,
00092                           const Double freqVal)=0;
00093 
00094     //
00095     // Not sure if the following method is requried.  Leaving it in
00096     // the code for now with an implementation that does nothing.
00097     //
00098     // virtual void applySky(Matrix<Complex>& screen, const Int wPixel, 
00099     //                    const Vector<Double>& sampling,
00100     //                    const Int wConvSize, const Double wScale,
00101     //                    const Int inner) 
00102     // {(void)screen; (void)wPixel; (void)sampling; (void)wConvSize; (void)wScale; (void)inner;};
00103 
00104     //
00105     // Returns a vector of integers that map each row in the given
00106     // VisBuffer to an index that is used to pick the appropriate
00107     // convolution function plane.  It also returns the number of
00108     // unique baselines in the nUnique parameter (unique baselines are
00109     // defined as the number of baselines each requiring a unique
00110     // convolution function).
00111     //
00112     // This is required for Heterogeneous antenna arrays (like ALMA)
00113     // and for all arrays where not all antenna aperture illuminations
00114     // can be treated as identical.
00115     //
00116     virtual Int makePBPolnCoords(const VisBuffer& vb,
00117                                  const Int& convSize,
00118                                  const Int& convSampling,
00119                                  const CoordinateSystem& skyCoord,
00120                                  const Int& skyNx, const Int& skyNy,
00121                                  CoordinateSystem& feedCoord)
00122     {
00123       return makePBPolnCoords(vb.corrType(), convSize, convSampling, skyCoord,
00124                               skyNx, skyNy, feedCoord);
00125     };
00126     virtual Int makePBPolnCoords(const Vector<Int>& vbCorrTypes,
00127                                  const Int& convSize,
00128                                  const Int& convSampling,
00129                                  const CoordinateSystem& skyCoord,
00130                                  const Int& skyNx, const Int& skyNy,
00131                                  CoordinateSystem& feedCoord);
00132 
00133 
00134     virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer& vb, Int& nUnique)
00135     {Vector<Int> tmp; tmp.resize(vb.nRow()); tmp=0; nUnique=1; return tmp;}
00136 
00137     virtual void getPolMap(Vector<Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
00138     virtual Vector<Int> getAntTypeList() {Vector<Int> tt(1);tt(0)=0;return tt;};
00139     virtual Int getConvSize() ;
00140     // {
00141     //   Int defaultConvSize=CONVSIZE;
00142     //   defaultConvSize= SynthesisUtils::getenv("CONVSIZE",CONVSIZE);
00143     //   // if (envStr != "")
00144     //   //     {
00145     //   //       sscanf(envStr.c_str,"%d",&defaultConvSize);
00146     //   cerr << "ConvFuncSize set to " << defaultConvSize << endl;
00147     //   //     }
00148     //   return defaultConvSize;
00149     // };
00150 
00151     virtual Int getOversampling() ;
00152     // {
00153     //   Int defaultOverSampling=OVERSAMPLING;
00154     //   char *envStr;
00155     //   if ((envStr = getenv("OVERSAMPLING")) != NULL)
00156     //  {
00157     //    sscanf(envStr,"%d",&defaultOverSampling);
00158     //    cerr << "Oversampling set to " << defaultOverSampling << endl;
00159     //  }
00160     //   return defaultOverSampling;
00161     // }
00162     virtual Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
00163     virtual Float getSupportThreshold() {return THRESHOLD;};
00164 
00165     // virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer& vb, Int& nUnique) = 0;
00166     // virtual Int getConvSize() = 0;
00167     // virtual Int getOversampling() = 0;
00168     // virtual Float getConvWeightSizeFactor() = 0;
00169     // virtual Float getSupportThreshold() = 0;
00170 
00171     virtual void normalizeImage(Lattice<Complex>& skyImage,
00172                                 const Matrix<Float>& weights) 
00173     {
00174       (void)skyImage;(void)weights;
00175       throw(AipsError("Make ATerm::normalizeImage() pure virtual and implement in specializations"));
00176     };
00177 
00178     virtual void cacheVBInfo(const VisBuffer& vb) = 0;
00179     virtual void cacheVBInfo(const String& telescopeName, const Float& diameter)=0;
00180     virtual Int getBandID(const Double& freq, const String& telescopeName) = 0;
00181     virtual int getVisParams(const VisBuffer& vb, const CoordinateSystem& skyCoord=CoordinateSystem()) = 0;
00182     //
00183     // The mapping from VisBuffer polarizations map to the Image plane
00184     // polarization.  The latter is determined by the user input,
00185     // which is passed to the FTMachine in Imager.cc
00186     //
00187     // The map is available in the FTMachine which uses this method to
00188     // set the map for the ATerm object.
00189     //
00190     virtual void setPolMap(const Vector<Int>& polMap) {polMap_p_base.resize(0);polMap_p_base=polMap;}
00191     //    virtual void rotate(const VisBuffer& vb, CFStore2& cfs)=0;
00192     virtual void rotate(const VisBuffer& vb, CFCell& cfc, const Double& rotAngleIncrement=5.0)=0;
00193     virtual void rotate2(const VisBuffer& vb, CFCell& baseCFS, CFCell& cfc, const Double& rotAngleIncrement=5.0)=0;
00194     virtual Int mapAntIDToAntType(const Int& /*ant*/) {return 0;};
00195     String getTelescopeName() {return telescopeName_p;};
00196     virtual Bool rotationallySymmetric() {return True;};
00197 
00198   protected:
00199     LogIO& logIO() {return logIO_p;}
00200     LogIO logIO_p;
00201     Vector<Int> polMap_p_base;
00202     Int cachedOverSampling_p, cachedConvSize_p;
00203 
00204     Float Diameter_p, Nant_p, HPBW, sigma;
00205     String telescopeName_p;
00206   };
00207 
00208 };
00209 
00210 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1