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 22 : PBMath1DAiry::PBMath1DAiry(Quantity dishDiam, Quantity blockedDiam, 43 : Quantity maxRad, Quantity refFreq, 44 : BeamSquint squint, 45 22 : Bool useSymmetricBeam) : 46 : PBMath1D(maxRad, refFreq, true, squint, useSymmetricBeam), 47 22 : dishDiam_p(dishDiam), 48 22 : blockedDiam_p(blockedDiam) 49 : { 50 22 : fillPBArray(); 51 : 52 22 : if (useSymmetricBeam) { 53 0 : symmetrizeSquintedBeam(); 54 : } 55 22 : }; 56 : 57 44 : PBMath1DAiry::~PBMath1DAiry() 58 : { 59 44 : }; 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 22 : void PBMath1DAiry::fillPBArray() 77 : { 78 : 79 44 : LogIO os(LogOrigin("PBMath1DAiry", "fillPBArray")); 80 22 : uInt nSamples=10000; 81 22 : vp_p.resize(nSamples); 82 : 83 22 : 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 22 : Double dimensionless_maxRad = maximumRadius_p.getValue("'") * 89 22 : 7.016/(1.566*60.) * dishDiam_p.getValue("m") / 24.5; 90 22 : Double dimensionless_iiR = Double(nSamples-1)/dimensionless_maxRad; 91 : Double x; 92 : Double bd; 93 : uInt i; 94 22 : bd = blockedDiam_p.getValue("m"); 95 22 : if (bd == 0.0) { 96 0 : vp_p(0) = 1.0; 97 0 : for(i=1;i<nSamples;i++) { 98 0 : x = i / dimensionless_iiR; 99 0 : vp_p(i) = 2.0 * j1(x)/x; 100 : } 101 : } else { 102 22 : Double areaRatio = square( dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m") ); 103 22 : Double areaNorm = areaRatio - 1.0; 104 22 : Double lengthRatio = dishDiam_p.getValue("m")/ blockedDiam_p.getValue("m"); 105 22 : vp_p(0) = 1.0; 106 : // cout << " areaRat = " << areaRatio << endl; 107 : // cout << " areaNrom = " << areaNorm << endl; 108 : // cout << " lengthRat = " << lengthRatio << endl; 109 220000 : for(i=1;i<nSamples;i++) { 110 219978 : x = i / dimensionless_iiR; 111 439956 : vp_p(i) = ( areaRatio * 2.0 * j1(x)/x 112 219978 : - 2.0 * j1( x * lengthRatio)/(x*lengthRatio) )/ areaNorm; 113 : } 114 : } 115 22 : }; 116 : 117 : 118 : // Bool PBMath1DAiry::flushToTable(Table& beamSubTable, Int iRow) 119 : //{}; 120 : 121 : void 122 14 : PBMath1DAiry::summary(Int nValues) 123 : { 124 14 : PBMath1D::summary(nValues); 125 28 : LogIO os(LogOrigin("PBMath1DAiry", "summary")); 126 14 : os << " Dish Diameter: " << dishDiam_p.getValue("m") << " m " << LogIO::POST; 127 14 : os << "Blocked Diameter: " << blockedDiam_p.getValue("m") << " m " << LogIO::POST; 128 14 : }; 129 : 130 : } //# NAMESPACE CASA - END 131 :