casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PBMath2DImage.h
Go to the documentation of this file.
00001 //# PBMath2DImage.h: Definitions of 2-D Image PBMath objects
00002 //# Copyright (C) 1996,1997,1998,2000,2003
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_PBMATH2DIMAGE_H
00030 #define SYNTHESIS_PBMATH2DIMAGE_H
00031 
00032 #include <casa/aips.h>
00033 #include <synthesis/TransformMachines/PBMath2D.h>
00034 #include <images/Images/ImageInterface.h>
00035 #include <measures/Measures.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //#forward
00040 template<class T> class TempImage;
00041 
00042 typedef SquareMatrix<Complex,2> mjJones2;
00043 typedef SquareMatrix<Complex,4> mjJones4;
00044 typedef SquareMatrix<Float,2> mjJones2F;
00045 
00046 // <summary> 2-D Image Primary Beam Model </summary>
00047 
00048 // <use visibility=export>
00049 
00050 // <reviewed reviewer="" date="" tests="" demos="">
00051 
00052 // <prerequisite>
00053 // <li> <linkto class="PBMathInterface">PBMathInterface</linkto> class
00054 // <li> <linkto class="PBMath2D">PBMath2D</linkto> class
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 //  PBMath2DImage: derived from  PBMath2D, implements PB and VP from sampled 2D VP
00059 // </etymology>
00060 //
00061 // <synopsis> 
00062 // See PBMath2D for a general synopsis of the 2D PB types.
00063 // 
00064 // The user supplies a vector which is a numerical representation
00065 // of a voltage [attern (hey, if you have a PB, just take the square
00066 // root, and look out for sidelobes which could be negative).
00067 // The first element in the vector needs to be 1.0, the center of the
00068 // voltage pattern.  The last element of the vector is the value of the
00069 // VP at the maximumRadius.  The maximumRadius and the reference frequency at
00070 // which the tabulated VP is intended are also required for construction.
00071 // The PBMath2DImage constructor proceeds by performing SINC interpolation
00072 // on the input vector to generate the highly oversampled lookup vector.
00073 // 
00074 // </synopsis> 
00075 //
00076 //
00077 // <example>
00078 // <srcblock>
00079 
00080 //    numPB.applyPB( im1, im2, pointingDir);
00081 // </srcblock>
00082 // </example>
00083 //
00084 // <motivation>
00085 // All of the 2-D PB types have everything in common except for the
00086 // details of their parameterization.  This lightweight class
00087 // deals with those differences: construction, filling the PBArray
00088 // from construction parameters, and flushing to disk.
00089 // The Image type is very handy: someone can take a sample
00090 // illumination pattern, FT, and take a slice of the resulting voltage
00091 // pattern and construct a  VP from that slice.
00092 // </motivation>
00093 //
00094 // <todo asof="98/10/21">
00095 // <li> constructor from a MS beam subtable
00096 // <li> flush to MS beam subtable
00097 // </todo>
00098 
00099  
00100 class PBMath2DImage : public PBMath2D {
00101 public:
00102 
00103   PBMath2DImage();
00104 
00105   // Instantiation from arguments; only an image is needed
00106   PBMath2DImage(ImageInterface<Float>& reJonesImage);
00107   PBMath2DImage(ImageInterface<Float>& reJonesImage,
00108                 ImageInterface<Float>& imJonesImage);
00109 
00110   PBMath2DImage(const ImageInterface<Complex>& jonesImage);
00111 
00112   // Copy constructor
00113   // PBMath2DGImage(const PBMath2DImage& other);
00114 
00115   // Assignment operator, by reference
00116   PBMath2DImage& operator=(const PBMath2DImage& other);
00117 
00118   //destructor
00119  ~PBMath2DImage();  
00120 
00121   // Get the type of PB this is
00122   PBMathInterface::PBClass whichPBClass() { return PBMathInterface::IMAGE; }  
00123   
00124   // Summarize the construction data for this primary beam
00125   void summary(Int nValues=0);
00126 
00127 protected:
00128 
00129   virtual ImageInterface<Complex>& apply(const ImageInterface<Complex>& in,
00130                                  ImageInterface<Complex>& out,
00131                                  const MDirection& sp,
00132                                  const Quantity parAngle,             
00133                                  const BeamSquint::SquintType doSquint,
00134                                  Bool inverse,
00135                                  Bool conjugate,
00136                                  Int ipower,  // ie, 1=VP, 2=PB, 4=PB^2
00137                                  Float cutoff,
00138                                  Bool forward); 
00139 
00140   virtual ImageInterface<Float>& apply(const ImageInterface<Float>& in,
00141                                ImageInterface<Float>& out,
00142                                const MDirection& sp,
00143                                const Quantity parAngle,       
00144                                const BeamSquint::SquintType doSquint,
00145                                Float cutoff, Int ipower);
00146 
00147   virtual SkyComponent& apply(SkyComponent& in,
00148                       SkyComponent& out,
00149                       const MDirection& sp,
00150                       const Quantity frequency,       
00151                       const Quantity parAngle,        
00152                       const BeamSquint::SquintType doSquint,
00153                       Bool inverse,
00154                       Bool conjugate,
00155                       Int ipower,  // ie, 1=VP, 2=PB, 4=PB^2
00156                       Float cutoff,
00157                       Bool forward); 
00158 
00159   virtual Int support(const CoordinateSystem& cs);
00160 
00161 
00162 
00163 private:    
00164 
00165   // Check for congruency
00166   void checkJonesCongruent(ImageInterface<Float>& reJones,
00167                            ImageInterface<Float>& imJones);
00168   void checkImageCongruent(ImageInterface<Float>& image);
00169 
00170 
00171   // Update the Jones Matrix
00172   void updateJones(const CoordinateSystem& coords,
00173                    const IPosition& shape,
00174                    const MDirection& pc,
00175                    const Quantity& paAngle);
00176 
00177   // Complex to Complex
00178   void applyJones(const Array<Float>* reJones,
00179                   const Array<Float>* imJones,
00180                   const Array<Complex>& in,
00181                   Array<Complex>& out,
00182                   Vector<Int>& polmap,
00183                   Bool inverse,
00184                   Bool conjugate,
00185                   Int ipower,  // ie, 1=VP, 2=PB
00186                   Float cutoff,
00187                   Bool circular=True,
00188                   Bool forward=True);
00189 
00190 
00191   // Float to Float
00192   void applyJones(const Array<Float>* reJones,
00193                   const Array<Float>* imJones,
00194                   const Array<Float>& in,
00195                   Array<Float>& out,
00196                   Vector<Int>& polmap,
00197                   Float cutoff,
00198                   Bool circular=True);
00199 
00200 
00201   TempImage<Float>* reJonesImage_p;
00202   TempImage<Float>* reRegridJonesImage_p;
00203   TempImage<Float>* imJonesImage_p;
00204   TempImage<Float>* imRegridJonesImage_p;
00205 
00206   Vector<Double>* incrementsReJones_p;
00207   Vector<Double>* incrementsImJones_p;
00208 
00209   Vector<Double>* referencePixelReJones_p;
00210   Vector<Double>* referencePixelImJones_p;
00211 
00212   Float pa_p;
00213 };
00214 
00215 
00216 } //# NAMESPACE CASA - END
00217 
00218 #endif