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_TRANSFORM2_ATERM_H
00030 #define SYNTHESIS_TRANSFORM2_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/VisBuffer2.h>
00039 #include <casa/Containers/Block.h>
00040 #include <synthesis/TransformMachines2/CFTerms.h>
00041 #include <synthesis/TransformMachines2/CFStore.h>
00042 #include <synthesis/TransformMachines2/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   namespace refim{
00050   using namespace vi;
00051   // <summary>  
00052   //  The base class to represent the Aperture-Term of the Measurement Equation. 
00053   // </summary>
00054   
00055   // <use visibility=export>
00056   // <prerequisite>
00057   // </prerequisite>
00058   // <etymology>
00059   //   A-Term to account for the effects of the antenna primary beam(s).
00060   // </etymology>
00061   //
00062   // <synopsis> 
00063   // 
00064   //</synopsis>
00065   class ATerm: public CFTerms
00066   {
00067   public:
00068     ATerm ();
00069     virtual ~ATerm () {};
00070 
00071     virtual String name() = 0;
00072 
00073     virtual void makeFullJones(ImageInterface<Complex>& pbImage,
00074                                const VisBuffer2& vb,
00075                                Bool doSquint, Int& bandID, Double freqVal)=0;
00076 
00077     virtual void applySky(ImageInterface<Float>& outputImages,
00078                           const VisBuffer2& vb, 
00079                           const Bool doSquint=True,
00080                           const Int& cfKey=0,
00081                           const Int& muellerTerm=0,
00082                           const Double freqVal=-1.0) = 0;
00083     virtual void applySky(ImageInterface<Complex>& outputImages,
00084                           const VisBuffer2& vb, 
00085                           const Bool doSquint=True,
00086                           const Int& cfKey=0,
00087                           const Int& muellerTerm=0,
00088                           const Double freqVal=-1.0) = 0;
00089     virtual void applySky(ImageInterface<Complex>& outImages,
00090                           const Double& pa,
00091                           const Bool doSquint,
00092                           const Int& cfKey,
00093                           const Int& muellerTerm,
00094                           const Double freqVal)=0;
00095 
00096     //
00097     // Not sure if the following method is requried.  Leaving it in
00098     // the code for now with an implementation that does nothing.
00099     //
00100     // virtual void applySky(Matrix<Complex>& screen, const Int wPixel, 
00101     //                    const Vector<Double>& sampling,
00102     //                    const Int wConvSize, const Double wScale,
00103     //                    const Int inner) 
00104     // {(void)screen; (void)wPixel; (void)sampling; (void)wConvSize; (void)wScale; (void)inner;};
00105 
00106     //
00107     // Returns a vector of integers that map each row in the given
00108     // VisBuffer to an index that is used to pick the appropriate
00109     // convolution function plane.  It also returns the number of
00110     // unique baselines in the nUnique parameter (unique baselines are
00111     // defined as the number of baselines each requiring a unique
00112     // convolution function).
00113     //
00114     // This is required for Heterogeneous antenna arrays (like ALMA)
00115     // and for all arrays where not all antenna aperture illuminations
00116     // can be treated as identical.
00117     //
00118     virtual Int makePBPolnCoords(const VisBuffer2& vb,
00119                                  const Int& convSize,
00120                                  const Int& convSampling,
00121                                  const CoordinateSystem& skyCoord,
00122                                  const Int& skyNx, const Int& skyNy,
00123                                  CoordinateSystem& feedCoord)
00124     {
00125       //      return makePBPolnCoords(vb.corrType(), convSize, convSampling, skyCoord,
00126       return makePBPolnCoords(vb.correlationTypes(), convSize, convSampling, skyCoord,
00127                               skyNx, skyNy, feedCoord);
00128     };
00129     virtual Int makePBPolnCoords(const Vector<Int>& vbCorrTypes,
00130                                  const Int& convSize,
00131                                  const Int& convSampling,
00132                                  const CoordinateSystem& skyCoord,
00133                                  const Int& skyNx, const Int& skyNy,
00134                                  CoordinateSystem& feedCoord);
00135 
00136 
00137     virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer2& vb, Int& nUnique)
00138     {Vector<Int> tmp; tmp.resize(vb.nRows()); tmp=0; nUnique=1; return tmp;}
00139 
00140     virtual void getPolMap(Vector<Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
00141     virtual Vector<Int> getAntTypeList() {Vector<Int> tt(1);tt(0)=0;return tt;};
00142 
00143     virtual void setConvSize(const Int convSize) {cachedConvSize_p=convSize;}
00144     virtual Int getConvSize()  {return cachedConvSize_p;};
00145     // {
00146     //   Int defaultConvSize=CONVSIZE;
00147     //   defaultConvSize= SynthesisUtils::getenv("CONVSIZE",CONVSIZE);
00148     //   // if (envStr != "")
00149     //   //     {
00150     //   //       sscanf(envStr.c_str,"%d",&defaultConvSize);
00151     //   cerr << "ConvFuncSize set to " << defaultConvSize << endl;
00152     //   //     }
00153     //   return defaultConvSize;
00154     // };
00155 
00156     void setOversampling(const Int os) {cachedOverSampling_p=os;};
00157     virtual Int getOversampling() {return cachedOverSampling_p;}
00158     // {
00159     //   Int defaultOverSampling=OVERSAMPLING;
00160     //   char *envStr;
00161     //   if ((envStr = getenv("OVERSAMPLING")) != NULL)
00162     //  {
00163     //    sscanf(envStr,"%d",&defaultOverSampling);
00164     //    cerr << "Oversampling set to " << defaultOverSampling << endl;
00165     //  }
00166     //   return defaultOverSampling;
00167     // }
00168     virtual Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
00169     virtual Float getSupportThreshold() {return THRESHOLD;};
00170 
00171     // virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer2& vb, Int& nUnique) = 0;
00172     // virtual Int getConvSize() = 0;
00173     // virtual Int getOversampling() = 0;
00174     // virtual Float getConvWeightSizeFactor() = 0;
00175     // virtual Float getSupportThreshold() = 0;
00176 
00177     virtual void normalizeImage(Lattice<Complex>& skyImage,
00178                                 const Matrix<Float>& weights) 
00179     {
00180       (void)skyImage;(void)weights;
00181       throw(AipsError("Make ATerm::normalizeImage() pure virtual and implement in specializations"));
00182     };
00183 
00184     virtual void cacheVBInfo(const VisBuffer2& vb) = 0;
00185     virtual void cacheVBInfo(const String& telescopeName, const Float& diameter)=0;
00186     virtual Int getBandID(const Double& freq, const String& telescopeName) = 0;
00187     virtual int getVisParams(const VisBuffer2& vb, const CoordinateSystem& skyCoord=CoordinateSystem()) = 0;
00188     //
00189     // The mapping from VisBuffer polarizations map to the Image plane
00190     // polarization.  The latter is determined by the user input,
00191     // which is passed to the FTMachine in Imager.cc
00192     //
00193     // The map is available in the FTMachine which uses this method to
00194     // set the map for the ATerm object.
00195     //
00196     virtual void setPolMap(const Vector<Int>& polMap) {polMap_p_base.resize(0);polMap_p_base=polMap;}
00197     //    virtual void rotate(const VisBuffer2& vb, CFStore2& cfs)=0;
00198     virtual void rotate(const VisBuffer2& vb, CFCell& cfc, const Double& rotAngleIncrement=5.0)=0;
00199     virtual void rotate2(const VisBuffer2& vb, CFCell& baseCFS, CFCell& cfc, const Double& rotAngleIncrement=5.0)=0;
00200     virtual Int mapAntIDToAntType(const Int& /*ant*/) {return 0;};
00201     String getTelescopeName() {return telescopeName_p;};
00202     virtual Bool rotationallySymmetric() {return True;};
00203 
00204   protected:
00205     LogIO& logIO() {return logIO_p;}
00206     LogIO logIO_p;
00207     Vector<Int> polMap_p_base;
00208     Int cachedOverSampling_p, cachedConvSize_p;
00209 
00210     Float Diameter_p, Nant_p, HPBW, sigma;
00211     String telescopeName_p;
00212   };
00213   };
00214 };
00215 
00216 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1