LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMath1DAiry.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 38 46 82.6 %
Date: 2024-12-11 20:54:31 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: 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             : #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         697 : PBMath1DAiry::PBMath1DAiry(Quantity dishDiam, Quantity blockedDiam,
      43             :                            Quantity maxRad, Quantity refFreq, 
      44             :                            BeamSquint squint,
      45         697 :                            Bool useSymmetricBeam) :
      46             :   PBMath1D(maxRad, refFreq, true, squint, useSymmetricBeam),
      47         697 :   dishDiam_p(dishDiam),  
      48         697 :   blockedDiam_p(blockedDiam)
      49             : {
      50         697 :   fillPBArray();    
      51             : 
      52         697 :   if (useSymmetricBeam) {
      53           0 :     symmetrizeSquintedBeam();
      54             :   }
      55         697 : };
      56             : 
      57        1394 : PBMath1DAiry::~PBMath1DAiry()
      58             : {
      59        1394 : };
      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         697 : void PBMath1DAiry::fillPBArray()
      77             : {
      78             : 
      79        1394 :   LogIO os(LogOrigin("PBMath1DAiry", "fillPBArray"));
      80         697 :   uInt nSamples=10000;
      81         697 :   vp_p.resize(nSamples);
      82             : 
      83         697 :   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         697 :   Double dimensionless_maxRad = maximumRadius_p.getValue("'") * 
      89         697 :     7.016/(1.566*60.) * dishDiam_p.getValue("m") / 24.5;  
      90         697 :   Double dimensionless_iiR = Double(nSamples-1)/dimensionless_maxRad;
      91             :   Double x;
      92             :   Double bd;
      93             :   uInt i;
      94         697 :   bd = blockedDiam_p.getValue("m");
      95         697 :   if (bd == 0.0) {
      96         224 :     vp_p(0) = 1.0;
      97     2240000 :     for(i=1;i<nSamples;i++) {
      98     2239776 :       x = i / dimensionless_iiR;
      99     2239776 :       vp_p(i) = 2.0 * j1(x)/x;
     100             :     }
     101             :   } else {
     102         473 :     Double areaRatio = square( dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m") );
     103         473 :     Double areaNorm = areaRatio - 1.0;
     104         473 :     Double lengthRatio = dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m");
     105         473 :     vp_p(0) = 1.0;
     106             :     //    cout << " areaRat = " << areaRatio << endl;
     107             :     //    cout << " areaNrom = " << areaNorm << endl;
     108             :     //    cout << " lengthRat = " << lengthRatio << endl;
     109     4730000 :     for(i=1;i<nSamples;i++) {
     110     4729527 :       x = i / dimensionless_iiR;
     111     9459054 :       vp_p(i) = ( areaRatio * 2.0 * j1(x)/x 
     112     4729527 :                   - 2.0 * j1( x * lengthRatio)/(x*lengthRatio) )/ areaNorm;
     113             :     }
     114             :   }
     115         697 : };
     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