Line data Source code
1 : //# PBMath1DPoly.cc: Implementation for PBMath1DPoly 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/BasicSL/Complex.h> 31 : #include <casacore/casa/BasicMath/Math.h> 32 : #include <synthesis/TransformMachines/PBMath1DPoly.h> 33 : #include <casacore/casa/Quanta.h> 34 : #include <casacore/measures/Measures.h> 35 : 36 : 37 : 38 : using namespace casacore; 39 : namespace casa { //# NAMESPACE CASA - BEGIN 40 : 41 1603 : PBMath1DPoly::PBMath1DPoly(const Vector<Double>& coeff, Quantity maxRad, 42 : Quantity refFreq, 43 : Bool isThisVP, 44 : BeamSquint squint, 45 1603 : Bool useSymmetricBeam) : 46 : PBMath1D(maxRad, refFreq, isThisVP, squint, useSymmetricBeam), 47 1603 : coeff_p(coeff) 48 : { 49 1603 : fillPBArray(); 50 : 51 1603 : if (useSymmetricBeam) { 52 1130 : symmetrizeSquintedBeam(); 53 : } 54 1603 : }; 55 : 56 : 57 : 58 3170 : PBMath1DPoly::~PBMath1DPoly() 59 : { 60 3170 : }; 61 : 62 : 63 0 : PBMath1DPoly& PBMath1DPoly::operator=(const PBMath1DPoly& other) 64 : { 65 0 : if (this == &other) 66 0 : return *this; 67 : 68 0 : PBMath1D::operator=(other); 69 0 : coeff_p = other.coeff_p; 70 0 : return *this; 71 : }; 72 : 73 : 74 : 75 1603 : void PBMath1DPoly::fillPBArray() 76 : { 77 : 78 4809 : LogIO os(LogOrigin("PBMath1DPoly", "fillPBArray")); 79 1603 : uInt nSamples=10000; 80 1603 : vp_p.resize(nSamples); 81 : 82 1603 : inverseIncrementRadius_p=Double(nSamples-1)/maximumRadius_p.getValue("'"); 83 : Double x2; 84 : Double y; 85 : Double taper; 86 : 87 16031603 : for(uInt i=0;i<nSamples;i++) { 88 16030000 : taper = 0.0; 89 16030000 : x2 = square( (Double(i)/inverseIncrementRadius_p) ); 90 16030000 : y = 1; 91 81230000 : for (uInt j=0;j<coeff_p.nelements();j++) { 92 65200000 : taper += y * coeff_p(j); 93 65200000 : y *= x2; 94 : } 95 16030000 : if (isThisVP_p) { 96 0 : vp_p(i) = taper; 97 : } else { 98 16030000 : vp_p(i) = sqrt(taper); 99 : } 100 : } 101 1603 : }; 102 : 103 : 104 : //Bool PBMath1DPoly::flushToTable(Table& beamSubTable, Int iRow) 105 : //{}; 106 : 107 : 108 : void 109 0 : PBMath1DPoly::summary(Int nValues) 110 : { 111 0 : PBMath1D::summary(nValues); 112 0 : LogIO os(LogOrigin("PBMath1DPoly", "summary")); 113 0 : os << "Even Powered Coefficients: " << coeff_p << LogIO::POST; 114 0 : }; 115 : 116 : } //# NAMESPACE CASA - END 117 :