LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMath2DImage.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 1 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 1 0.0 %

          Line data    Source code
       1             : //# PBMath2DImage.h: Definitions of 2-D Image PBMath objects
       2             : //# Copyright (C) 1996,1997,1998,2000,2003
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be adressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //#
      27             : //# $Id$
      28             : 
      29             : #ifndef SYNTHESIS_PBMATH2DIMAGE_H
      30             : #define SYNTHESIS_PBMATH2DIMAGE_H
      31             : 
      32             : #include <casacore/casa/aips.h>
      33             : #include <synthesis/TransformMachines/PBMath2D.h>
      34             : #include <casacore/images/Images/ImageInterface.h>
      35             : #include <casacore/measures/Measures.h>
      36             : 
      37             : namespace casacore{
      38             : 
      39             : template<class T> class TempImage;
      40             : }
      41             : 
      42             : namespace casa { //# NAMESPACE CASA - BEGIN
      43             : 
      44             : //#forward
      45             : 
      46             : typedef casacore::SquareMatrix<casacore::Complex,2> mjJones2;
      47             : typedef casacore::SquareMatrix<casacore::Complex,4> mjJones4;
      48             : typedef casacore::SquareMatrix<casacore::Float,2> mjJones2F;
      49             : 
      50             : // <summary> 2-D Image Primary Beam Model </summary>
      51             : 
      52             : // <use visibility=export>
      53             : 
      54             : // <reviewed reviewer="" date="" tests="" demos="">
      55             : 
      56             : // <prerequisite>
      57             : // <li> <linkto class="PBMathInterface">PBMathInterface</linkto> class
      58             : // <li> <linkto class="PBMath2D">PBMath2D</linkto> class
      59             : // </prerequisite>
      60             : //
      61             : // <etymology>
      62             : //  PBMath2DImage: derived from  PBMath2D, implements PB and VP from sampled 2D VP
      63             : // </etymology>
      64             : //
      65             : // <synopsis> 
      66             : // See PBMath2D for a general synopsis of the 2D PB types.
      67             : // 
      68             : // The user supplies a vector which is a numerical representation
      69             : // of a voltage [attern (hey, if you have a PB, just take the square
      70             : // root, and look out for sidelobes which could be negative).
      71             : // The first element in the vector needs to be 1.0, the center of the
      72             : // voltage pattern.  The last element of the vector is the value of the
      73             : // VP at the maximumRadius.  The maximumRadius and the reference frequency at
      74             : // which the tabulated VP is intended are also required for construction.
      75             : // The PBMath2DImage constructor proceeds by performing SINC interpolation
      76             : // on the input vector to generate the highly oversampled lookup vector.
      77             : // 
      78             : // </synopsis> 
      79             : //
      80             : //
      81             : // <example>
      82             : // <srcblock>
      83             : 
      84             : //    numPB.applyPB( im1, im2, pointingDir);
      85             : // </srcblock>
      86             : // </example>
      87             : //
      88             : // <motivation>
      89             : // All of the 2-D PB types have everything in common except for the
      90             : // details of their parameterization.  This lightweight class
      91             : // deals with those differences: construction, filling the PBArray
      92             : // from construction parameters, and flushing to disk.
      93             : // The Image type is very handy: someone can take a sample
      94             : // illumination pattern, FT, and take a slice of the resulting voltage
      95             : // pattern and construct a  VP from that slice.
      96             : // </motivation>
      97             : //
      98             : // <todo asof="98/10/21">
      99             : // <li> constructor from a casacore::MS beam subtable
     100             : // <li> flush to casacore::MS beam subtable
     101             : // </todo>
     102             : 
     103             :  
     104             : class PBMath2DImage : public PBMath2D {
     105             : public:
     106             : 
     107             :   PBMath2DImage();
     108             : 
     109             :   // Instantiation from arguments; only an image is needed
     110             :   PBMath2DImage(casacore::ImageInterface<casacore::Float>& reJonesImage);
     111             :   PBMath2DImage(casacore::ImageInterface<casacore::Float>& reJonesImage,
     112             :                 casacore::ImageInterface<casacore::Float>& imJonesImage);
     113             : 
     114             :   PBMath2DImage(const casacore::ImageInterface<casacore::Complex>& jonesImage);
     115             : 
     116             :   // Copy constructor
     117             :   // PBMath2DGImage(const PBMath2DImage& other);
     118             : 
     119             :   // Assignment operator, by reference
     120             :   PBMath2DImage& operator=(const PBMath2DImage& other);
     121             : 
     122             :   //destructor
     123             :  ~PBMath2DImage();  
     124             : 
     125             :   // Get the type of PB this is
     126           0 :   PBMathInterface::PBClass whichPBClass() { return PBMathInterface::IMAGE; }  
     127             :   
     128             :   // Summarize the construction data for this primary beam
     129             :   void summary(casacore::Int nValues=0);
     130             : 
     131             : protected:
     132             : 
     133             :   virtual casacore::ImageInterface<casacore::Complex>& apply(const casacore::ImageInterface<casacore::Complex>& in,
     134             :                                  casacore::ImageInterface<casacore::Complex>& out,
     135             :                                  const casacore::MDirection& sp,
     136             :                                  const casacore::Quantity parAngle,           
     137             :                                  const BeamSquint::SquintType doSquint,
     138             :                                  casacore::Bool inverse,
     139             :                                  casacore::Bool conjugate,
     140             :                                  casacore::Int ipower,  // ie, 1=VP, 2=PB, 4=PB^2
     141             :                                  casacore::Float cutoff,
     142             :                                  casacore::Bool forward); 
     143             : 
     144             :   virtual casacore::ImageInterface<casacore::Float>& apply(const casacore::ImageInterface<casacore::Float>& in,
     145             :                                casacore::ImageInterface<casacore::Float>& out,
     146             :                                const casacore::MDirection& sp,
     147             :                                const casacore::Quantity parAngle,             
     148             :                                const BeamSquint::SquintType doSquint,
     149             :                                casacore::Float cutoff, casacore::Int ipower);
     150             : 
     151             :   virtual SkyComponent& apply(SkyComponent& in,
     152             :                       SkyComponent& out,
     153             :                       const casacore::MDirection& sp,
     154             :                       const casacore::Quantity frequency,             
     155             :                       const casacore::Quantity parAngle,              
     156             :                       const BeamSquint::SquintType doSquint,
     157             :                       casacore::Bool inverse,
     158             :                       casacore::Bool conjugate,
     159             :                       casacore::Int ipower,  // ie, 1=VP, 2=PB, 4=PB^2
     160             :                       casacore::Float cutoff,
     161             :                       casacore::Bool forward); 
     162             : 
     163             :   virtual casacore::Int support(const casacore::CoordinateSystem& cs);
     164             : 
     165             : 
     166             : 
     167             : private:    
     168             : 
     169             :   // Check for congruency
     170             :   void checkJonesCongruent(casacore::ImageInterface<casacore::Float>& reJones,
     171             :                            casacore::ImageInterface<casacore::Float>& imJones);
     172             :   void checkImageCongruent(casacore::ImageInterface<casacore::Float>& image);
     173             : 
     174             : 
     175             :   // Update the Jones Matrix
     176             :   void updateJones(const casacore::CoordinateSystem& coords,
     177             :                    const casacore::IPosition& shape,
     178             :                    const casacore::MDirection& pc,
     179             :                    const casacore::Quantity& paAngle);
     180             : 
     181             :   // casacore::Complex to Complex
     182             :   void applyJones(const casacore::Array<casacore::Float>* reJones,
     183             :                   const casacore::Array<casacore::Float>* imJones,
     184             :                   const casacore::Array<casacore::Complex>& in,
     185             :                   casacore::Array<casacore::Complex>& out,
     186             :                   casacore::Vector<casacore::Int>& polmap,
     187             :                   casacore::Bool inverse,
     188             :                   casacore::Bool conjugate,
     189             :                   casacore::Int ipower,  // ie, 1=VP, 2=PB
     190             :                   casacore::Float cutoff,
     191             :                   casacore::Bool circular=true,
     192             :                   casacore::Bool forward=true);
     193             : 
     194             :  void applyJonesFast(const casacore::Float*& reJones,
     195             :                           const casacore::Float*& imJones,
     196             :                           const casacore::Array<casacore::Complex>& in,
     197             :                           casacore::Array<casacore::Complex>& out,
     198             :                           casacore::Vector<casacore::Int>& polmap,
     199             :                           casacore::Bool /*inverse*/,
     200             :                           casacore::Bool /*conjugate*/,
     201             :                           casacore::Int ipower,  // ie, 1=VP, 2=PB
     202             :                           casacore::Float /*cutoff*/,
     203             :                           casacore::Bool circular,
     204             :                      casacore::Bool forward);
     205             :  void applyJonesFastX(const casacore::Float*& reJones,
     206             :                           const casacore::Float*& imJones,
     207             :                           const casacore::Complex*& in,
     208             :                           casacore::Complex*& outstor,
     209             :                           const casacore::Int*& polmap,
     210             :                           casacore::Bool /*inverse*/,
     211             :                           casacore::Bool /*conjugate*/,
     212             :                           casacore::Int ipower,  // ie, 1=VP, 2=PB
     213             :                           casacore::Float /*cutoff*/,
     214             :                       casacore::Bool circular,
     215             :                       casacore::Bool forward,
     216             :                       const casacore::Int ix, const casacore::Int nx, const casacore::Int ny, const casacore::Int npol);
     217             : 
     218             : 
     219             :   // casacore::Float to Float
     220             :   void applyJones(const casacore::Array<casacore::Float>* reJones,
     221             :                   const casacore::Array<casacore::Float>* imJones,
     222             :                   const casacore::Array<casacore::Float>& in,
     223             :                   casacore::Array<casacore::Float>& out,
     224             :                   casacore::Vector<casacore::Int>& polmap,
     225             :                   casacore::Float cutoff,
     226             :                   casacore::Bool circular=true);
     227             : 
     228             : 
     229             :   casacore::TempImage<casacore::Float>* reJonesImage_p;
     230             :   casacore::TempImage<casacore::Float>* reRegridJonesImage_p;
     231             :   casacore::TempImage<casacore::Float>* imJonesImage_p;
     232             :   casacore::TempImage<casacore::Float>* imRegridJonesImage_p;
     233             : 
     234             :   casacore::Vector<casacore::Double>* incrementsReJones_p;
     235             :   casacore::Vector<casacore::Double>* incrementsImJones_p;
     236             : 
     237             :   casacore::Vector<casacore::Double>* referencePixelReJones_p;
     238             :   casacore::Vector<casacore::Double>* referencePixelImJones_p;
     239             : 
     240             :   casacore::Float pa_p;
     241             : };
     242             : 
     243             : 
     244             : } //# NAMESPACE CASA - END
     245             : 
     246             : #endif

Generated by: LCOV version 1.16