casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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 <images/Images/ImageInterface.h>
00035 #include <images/Images/PagedImage.h>
00036 #include <images/Images/TempImage.h>
00037 #include <synthesis/MSVis/VisBuffer.h>
00038 #include <casa/Containers/Block.h>
00039 #include <synthesis/TransformMachines/CFTerms.h>
00040 #include <synthesis/TransformMachines/CFStore.h>
00041 #include <synthesis/TransformMachines/CFStore2.h>
00042 #define CONVSIZE (1024*2)
00043 #define CONVWTSIZEFACTOR 1
00044 #define OVERSAMPLING 20
00045 #define THRESHOLD 1E-4
00046 
00047 namespace casa{
00048   // <summary>  
00049   //  The base class to represent the Aperture-Term of the Measurement Equation. 
00050   // </summary>
00051   
00052   // <use visibility=export>
00053   // <prerequisite>
00054   // </prerequisite>
00055   // <etymology>
00056   //   A-Term to account for the effects of the antenna primary beam(s).
00057   // </etymology>
00058   //
00059   // <synopsis> 
00060   // 
00061   //</synopsis>
00062   class ATerm: public CFTerms
00063   {
00064   public:
00065     ATerm (): CFTerms() {};
00066     virtual ~ATerm () {};
00067 
00068     virtual String name() = 0;
00069 
00070     virtual void applySky(ImageInterface<Float>& outputImages,
00071                           const VisBuffer& vb, 
00072                           const Bool doSquint=True,
00073                           const Int& cfKey=0,
00074                           const Double freqVal=-1) = 0;
00075     virtual void applySky(ImageInterface<Complex>& outputImages,
00076                           const VisBuffer& vb, 
00077                           const Bool doSquint=True,
00078                           const Int& cfKey=0,
00079                           const Double freqVal=-1) = 0;
00080     //
00081     // Not sure if the following method is requried.  Leaving it in
00082     // the code for now with an implementation that does nothing.
00083     //
00084     // virtual void applySky(Matrix<Complex>& screen, const Int wPixel, 
00085     //                    const Vector<Double>& sampling,
00086     //                    const Int wConvSize, const Double wScale,
00087     //                    const Int inner) 
00088     // {(void)screen; (void)wPixel; (void)sampling; (void)wConvSize; (void)wScale; (void)inner;};
00089 
00090     //
00091     // Returns a vector of integers that map each row in the given
00092     // VisBuffer to an index that is used to pick the appropriate
00093     // convolution function plane.  It also returns the number of
00094     // unique baselines in the nUnique parameter (unique baselines are
00095     // defined as the number of baselines each requiring a unique
00096     // convolution function).
00097     //
00098     // This is required for Heterogeneous antenna arrays (like ALMA)
00099     // and for all arrays where not all antenna aperture illuminations
00100     // can be treated as identical.
00101     //
00102     virtual Int makePBPolnCoords(const VisBuffer& vb,
00103                                  const Int& convSize,
00104                                  const Int& convSampling,
00105                                  const CoordinateSystem& skyCoord,
00106                                  const Int& skyNx, const Int& skyNy,
00107                                  CoordinateSystem& feedCoord);
00108 
00109     virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer& vb, Int& nUnique)
00110     {Vector<Int> tmp; tmp.resize(vb.nRow()); tmp=0; nUnique=1; return tmp;}
00111 
00112     virtual void getPolMap(Vector<Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
00113     virtual Vector<Int> getAntTypeList() {Vector<Int> tt(1);tt(0)=0;return tt;};
00114     virtual Int getConvSize() {return CONVSIZE;};
00115     virtual Int getOversampling() {return OVERSAMPLING;}
00116     virtual Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
00117     virtual Float getSupportThreshold() {return THRESHOLD;};
00118 
00119     // virtual Vector<Int> vbRow2CFKeyMap(const VisBuffer& vb, Int& nUnique) = 0;
00120     // virtual Int getConvSize() = 0;
00121     // virtual Int getOversampling() = 0;
00122     // virtual Float getConvWeightSizeFactor() = 0;
00123     // virtual Float getSupportThreshold() = 0;
00124 
00125     virtual void normalizeImage(Lattice<Complex>& skyImage,
00126                                 const Matrix<Float>& weights) 
00127     {
00128       (void)skyImage;(void)weights;
00129       throw(AipsError("Make ATerm::normalizeImage() pure virtual and implement in specializations"));
00130     };
00131 
00132     virtual int getVisParams(const VisBuffer& vb, const CoordinateSystem& skyCoord=CoordinateSystem()) = 0;
00133     //
00134     // The mapping from VisBuffer polarizations map to the Image plane
00135     // polarization.  The latter is determined by the user input,
00136     // which is passed to the FTMachine in Imager.cc
00137     //
00138     // The map is available in the FTMachine which uses this method to
00139     // set the map for the ATerm object.
00140     //
00141     virtual void setPolMap(const Vector<Int>& polMap) {polMap_p_base.resize(0);polMap_p_base=polMap;}
00142     //    virtual void rotate(const VisBuffer& vb, CFStore2& cfs)=0;
00143     virtual void rotate(const VisBuffer& vb, CFCell& cfs, const Double& rotAngleIncrement=5.0)=0;
00144     virtual Int mapAntIDToAntType(const Int& /*ant*/) {return 0;};
00145   protected:
00146     LogIO& logIO() {return logIO_p;}
00147     LogIO logIO_p;
00148     Vector<Int> polMap_p_base;
00149   };
00150 
00151 };
00152 
00153 #endif