casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PBMath2D.h
Go to the documentation of this file.
00001 //# PBMath2D.h: Definitions of interface for 2-D PBMath objects
00002 //# Copyright (C) 1996,1997,1998,1999,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_PBMATH2D_H
00030 #define SYNTHESIS_PBMATH2D_H
00031 
00032 #include <casa/aips.h>
00033 #include <synthesis/TransformMachines/PBMathInterface.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //#forward
00038 class Table;
00039 class SkyComponent;
00040 class ImageRegion;
00041 class CoordinateSystem;
00042 
00043 // <summary> base class for 1D PBMath objects </summary>
00044 
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="" date="" tests="" demos="">
00049 
00050 // <prerequisite>
00051 // <li> <linkto class="SkyJones">SkyJones</linkto> class
00052 // <li> <linkto class="BeamSkyJones">BeamSkyJones</linkto> class
00053 // <li> <linkto class="PBMathInterface">PBMathInterface</linkto> class
00054 // </prerequisite>
00055 //
00056 // <etymology>
00057 // PBMath types do the mathematical operations of the PB's or VP's.
00058 // This is the base class for the 1D (ie, rotationally symmetric) PB's.
00059 // </etymology>
00060 //
00061 // <synopsis> 
00062 // PBMath2D,  the virtual base class for 1D PBMath objects, is
00063 // derived from PBMathInterface.  Its cousin, PBMath2D, can deal with
00064 // inherently 2D voltage patterns or primary beams.  PBMath2D can deal
00065 // with beam squint, (ie, the offset of the LL and RR beams on opposite
00066 // sides of the pointing center) which rotates on the sky with parallactic angle.
00067 // 
00068 // The 1D PB philosophy is to specify the Voltage pattern or Primary Beam
00069 // via a small number of
00070 // parameters via one of the derived types (PBMath2DGauss, for example).  The
00071 // derived type knows how to instantiate itself from a row in a beam subTable,
00072 // and how to convert itself into a lookup vector.  The lookup vector is
00073 // fine enough that no interpolation need be done when finding the nearest
00074 // PB or VP value for a particular pixel (currently, there are 1e+4 elements
00075 // in the lookup vector, so on average, an error on order of 1e-4 is made
00076 // when applying the primary beam).
00077 //
00078 // There are two ways of creating the derived PB types:
00079 // 1) explicitly create one of the babies.  You have control
00080 // over the details such as PB size and total extent, the reference
00081 // frequency at which this size is true (the size scales inversely
00082 // with wavelength), the squint orientation, and whether a mean
00083 // symmetrized beam will be calculated from the squinted beam.
00084 // (Nice defaults can reduce the arguments in most cases.)
00085 // <example>
00086 // <srcblock>
00087 //  PBMath2DGauss myPB  (Quantity(1.0, "'"), Quantity(3.0, "'"), Quantity(1.0, "GHz"),
00088 //                       False,   // these are PB parameters, not VP
00089 //                       BeamSquint(MDirection(Quantity(2.0, "\""),
00090 //                                                      Quantity(0.0, "\""),
00091 //                                                      MDirection::Ref(MDirection::AZEL)),
00092 //                                  Quantity(2.0, "GHz")),
00093 //                       False);
00094 //  PBMath2DGauss myPB2  (Quantity(1.0, "'"), Quantity(3.0, "'"), Quantity(1.0, "GHz"));
00095 // 
00096 // </srcblock>
00097 // </example>
00098 // 2) via the envelope class PBMath's enumerated CommonPB type.  This is much simpler,
00099 // and will deal with a majority of the cases required:
00100 // <example>
00101 // <srcblock>
00102 // PBMath wsrtPB(PBMath::WSRT);
00103 // PBMath vla_LPB(PBMath::VLA_L);  // has L band squint built in
00104 // </srcblock>
00105 // </example>
00106 //
00107 // The main thing you want to do with a primary beam or voltage pattern is
00108 // to apply it to an image.  The top level "apply" methods are defined in
00109 // PBMathInterface.  They are applyPB, applyPB2, applyVP.  These top level
00110 // apply's then call a lower level private polymorphic apply, which are defined
00111 // in PBMath2D and in PBMath2D.  These two different apply's deal with the
00112 // different details of 1D and 2D primary beam application.
00113 // <example>
00114 // <srcblock>
00115 //
00116 //    PagedImage<Float> in;
00117 //    PagedImage<Complex> out;
00118 //    MDirection pointingDir(Quantity(135.0, "deg"), Quantity(60.0, "deg"), 
00119 //                           MDirection::Ref(MDirection::J2000));
00120 //    Quantity parallacticAngle(26.5, "deg");
00121 //    PBMath wsrtPB(PBMath::WSRT_LOW);
00122 //    wsrtPB.applyPB(in, out, pointingDir);   // multiply by primary beam
00123 //    wsrtPB.applyPB(in, out, pointingDir, parallacticAngle, BeamSquint::GOFIGURE, 
00124 //                   True, 0.02); // divide by primary beam
00125 //    wsrtPB.applyVP(in, out, pointingDir);   // multiply by voltage pattern
00126 //
00127 // </srcblock>
00128 // </example>
00129 // </synopsis> 
00130 //
00131 // <motivation>
00132 // All of the 2-D PB types have everything in common except for the
00133 // details of their parameterization.
00134 // </motivation>
00135 //
00136 // lower level helping apply methods: reduce code by this bundling
00137 // <thrown>
00138 // <li> AipsError - in apply(Image...), if in and out images are 
00139 //      inconsistent in shape or coordinates
00140 // <li> AipsError - in  apply(SkyComponent...), if doSqiont==RR or LL
00141 // </thrown>
00142 // <todo asof="98/010/21">
00143 // <li> SymmetrizeBeam doesn't do anything yet.  (It should calculate
00144 //      the mean symmetric beam about the pointing center when
00145 //      squint is present, slightly larger than the symmetric beam 
00146 //      about the squint position.
00147 // </todo>
00148 
00149  
00150 class PBMath2D : public PBMathInterface {
00151 public:
00152 
00153   // required so PBMath can see the protected "apply" method
00154   // Other derivatives of PBMathInterface, such as PBMath2D, will
00155   // also require friend class PBMath;
00156   friend class PBMath;  
00157 
00158   PBMath2D();
00159 
00160   virtual ~PBMath2D();
00161 
00162   // Summarize the Voltage Pattern;
00163   // For PBMath2D, list nValues worth of the VP array
00164   virtual void summary(Int nValues=0);
00165 
00166   // Is state of PBMath OK?
00167   virtual Bool ok();
00168 
00169   // Get the ImageRegion of the primary beam on an Image for a given pointing
00170   // Note: ImageRegion is not necesarily constrained to lie within the
00171   // image region (for example, if the pointing center is near the edge of the
00172   // image).  fPad: extra fractional padding, beyond Primary Beam support
00173   // (note: we do not properly treat squint yet, this will cover it for now)
00174   // iChan: frequency channel to take: lowest frequency channel is safe for all
00175   //
00176   // Potential problem: this ImageRegion includes all Stokes and Frequency Channels
00177   // present in the input image.
00178   ImageRegion* extent (const ImageInterface<Complex>& in, 
00179                        const MDirection& pointing,
00180                        const Int irow,  
00181                        const Float fPad,  
00182                        const Int iChan,  
00183                        const SkyJones::SizeType sizeType);
00184   ImageRegion* extent (const ImageInterface<Float>& in, 
00185                        const MDirection& pointing,
00186                        const Int irow,  
00187                        const Float fPad,  
00188                        const Int iChan,  
00189                        const SkyJones::SizeType sizeType);
00190 
00191   virtual Int support(const CoordinateSystem& cs);
00192 
00193 protected:
00194 
00195 private:    
00196 
00197 };
00198 
00199 
00200 } //# NAMESPACE CASA - END
00201 
00202 #endif