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-11-06 17:42:47 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         694 : PBMath1DAiry::PBMath1DAiry(Quantity dishDiam, Quantity blockedDiam,
      43             :                            Quantity maxRad, Quantity refFreq, 
      44             :                            BeamSquint squint,
      45         694 :                            Bool useSymmetricBeam) :
      46             :   PBMath1D(maxRad, refFreq, true, squint, useSymmetricBeam),
      47         694 :   dishDiam_p(dishDiam),  
      48         694 :   blockedDiam_p(blockedDiam)
      49             : {
      50         694 :   fillPBArray();    
      51             : 
      52         694 :   if (useSymmetricBeam) {
      53           0 :     symmetrizeSquintedBeam();
      54             :   }
      55         694 : };
      56             : 
      57        1388 : PBMath1DAiry::~PBMath1DAiry()
      58             : {
      59        1388 : };
      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         694 : void PBMath1DAiry::fillPBArray()
      77             : {
      78             : 
      79        1388 :   LogIO os(LogOrigin("PBMath1DAiry", "fillPBArray"));
      80         694 :   uInt nSamples=10000;
      81         694 :   vp_p.resize(nSamples);
      82             : 
      83         694 :   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         694 :   Double dimensionless_maxRad = maximumRadius_p.getValue("'") * 
      89         694 :     7.016/(1.566*60.) * dishDiam_p.getValue("m") / 24.5;  
      90         694 :   Double dimensionless_iiR = Double(nSamples-1)/dimensionless_maxRad;
      91             :   Double x;
      92             :   Double bd;
      93             :   uInt i;
      94         694 :   bd = blockedDiam_p.getValue("m");
      95         694 :   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         470 :     Double areaRatio = square( dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m") );
     103         470 :     Double areaNorm = areaRatio - 1.0;
     104         470 :     Double lengthRatio = dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m");
     105         470 :     vp_p(0) = 1.0;
     106             :     //    cout << " areaRat = " << areaRatio << endl;
     107             :     //    cout << " areaNrom = " << areaNorm << endl;
     108             :     //    cout << " lengthRat = " << lengthRatio << endl;
     109     4700000 :     for(i=1;i<nSamples;i++) {
     110     4699530 :       x = i / dimensionless_iiR;
     111     9399060 :       vp_p(i) = ( areaRatio * 2.0 * j1(x)/x 
     112     4699530 :                   - 2.0 * j1( x * lengthRatio)/(x*lengthRatio) )/ areaNorm;
     113             :     }
     114             :   }
     115         694 : };
     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