LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMath1DAiry.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 37 45 82.2 %
Date: 2023-10-25 08:47:59 Functions: 5 6 83.3 %

          Line data    Source code
       1             : //# PBMath1DAiry.cc: Implementation for PBMath1DAiry
       2             : //# Copyright (C) 1996,1997,1998,1999,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: aips2-request@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             : #include <casacore/casa/aips.h>
      30             : #include <casacore/casa/Exceptions/Error.h>
      31             : #include <casacore/casa/BasicSL/Complex.h>
      32             : #include <casacore/casa/BasicMath/Math.h>
      33             : #include <synthesis/TransformMachines/PBMath1DAiry.h>
      34             : #include <casacore/casa/Quanta.h>
      35             : #include <casacore/measures/Measures.h>
      36             : 
      37             : 
      38             : 
      39             : using namespace casacore;
      40             : namespace casa { //# NAMESPACE CASA - BEGIN
      41             : 
      42         674 : PBMath1DAiry::PBMath1DAiry(Quantity dishDiam, Quantity blockedDiam,
      43             :                            Quantity maxRad, Quantity refFreq, 
      44             :                            BeamSquint squint,
      45         674 :                            Bool useSymmetricBeam) :
      46             :   PBMath1D(maxRad, refFreq, true, squint, useSymmetricBeam),
      47             :   dishDiam_p(dishDiam),  
      48         674 :   blockedDiam_p(blockedDiam)
      49             : {
      50         674 :   fillPBArray();    
      51             : 
      52         674 :   if (useSymmetricBeam) {
      53           0 :     symmetrizeSquintedBeam();
      54             :   }
      55         674 : };
      56             : 
      57        1348 : PBMath1DAiry::~PBMath1DAiry()
      58             : {
      59        1348 : };
      60             : 
      61             : 
      62           0 : PBMath1DAiry& PBMath1DAiry::operator=(const PBMath1DAiry& other)
      63             : {
      64           0 :   if (this == &other)
      65           0 :     return *this;
      66             : 
      67           0 :   PBMath1D::operator=(other);
      68           0 :   dishDiam_p = other.dishDiam_p;
      69           0 :   blockedDiam_p = other.blockedDiam_p;
      70             : 
      71           0 :   return *this;
      72             : };
      73             : 
      74             : 
      75             : 
      76         674 : void PBMath1DAiry::fillPBArray()
      77             : {
      78             : 
      79        2022 :   LogIO os(LogOrigin("PBMath1DAiry", "fillPBArray"));
      80         674 :   uInt nSamples=10000;
      81         674 :   vp_p.resize(nSamples);
      82             : 
      83         674 :   inverseIncrementRadius_p=Double(nSamples-1)/maximumRadius_p.getValue("'");
      84             :   
      85             :   // This scales the maximum radius from arcminutes on the sky at
      86             :   // 1 GHz for a 24.5 m unblocked aperture to the J1 Bessel function
      87             :   // coordinates (7.016 at the 2ns null).
      88         674 :   Double dimensionless_maxRad = maximumRadius_p.getValue("'") * 
      89         674 :     7.016/(1.566*60.) * dishDiam_p.getValue("m") / 24.5;  
      90         674 :   Double dimensionless_iiR = Double(nSamples-1)/dimensionless_maxRad;
      91             :   Double x;
      92             :   Double bd;
      93             :   uInt i;
      94         674 :   bd = blockedDiam_p.getValue("m");
      95         674 :   if (bd == 0.0) {
      96         223 :     vp_p(0) = 1.0;
      97     2230000 :     for(i=1;i<nSamples;i++) {
      98     2229777 :       x = i / dimensionless_iiR;
      99     2229777 :       vp_p(i) = 2.0 * j1(x)/x;
     100             :     }
     101             :   } else {
     102         451 :     Double areaRatio = square( dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m") );
     103         451 :     Double areaNorm = areaRatio - 1.0;
     104         451 :     Double lengthRatio = dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m");
     105         451 :     vp_p(0) = 1.0;
     106             :     //    cout << " areaRat = " << areaRatio << endl;
     107             :     //    cout << " areaNrom = " << areaNorm << endl;
     108             :     //    cout << " lengthRat = " << lengthRatio << endl;
     109     4510000 :     for(i=1;i<nSamples;i++) {
     110     4509549 :       x = i / dimensionless_iiR;
     111    13528647 :       vp_p(i) = ( areaRatio * 2.0 * j1(x)/x 
     112     4509549 :                   - 2.0 * j1( x * lengthRatio)/(x*lengthRatio) )/ areaNorm;
     113             :     }
     114             :   }
     115         674 : };
     116             : 
     117             : 
     118             : // Bool PBMath1DAiry::flushToTable(Table& beamSubTable, Int iRow)
     119             : //{};
     120             : 
     121             : void
     122          17 : PBMath1DAiry::summary(Int nValues)
     123             : {
     124          17 :   PBMath1D::summary(nValues);
     125          34 :    LogIO os(LogOrigin("PBMath1DAiry", "summary"));
     126          17 :    os << "   Dish Diameter: " << dishDiam_p.getValue("m") << " m " <<  LogIO::POST;
     127          17 :    os << "Blocked Diameter: " << blockedDiam_p.getValue("m") << " m " <<  LogIO::POST;
     128          17 : };
     129             : 
     130             : } //# NAMESPACE CASA - END
     131             : 

Generated by: LCOV version 1.16