Line data Source code
1 : // -*- C++ -*- 2 : //# EVLAAperture.cc: Implementation of the EVLAAperture class 3 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003 4 : //# Associated Universities, Inc. Washington DC, USA. 5 : //# 6 : //# This library is free software; you can redistribute it and/or modify it 7 : //# under the terms of the GNU Library General Public License as published by 8 : //# the Free Software Foundation; either version 2 of the License, or (at your 9 : //# option) any later version. 10 : //# 11 : //# This library is distributed in the hope that it will be useful, but WITHOUT 12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 14 : //# License for more details. 15 : //# 16 : //# You should have received a copy of the GNU Library General Public License 17 : //# along with this library; if not, write to the Free Software Foundation, 18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 19 : //# 20 : //# Correspondence concerning AIPS++ should be addressed as follows: 21 : //# Internet email: casa-feedback@nrao.edu. 22 : //# Postal address: AIPS++ Project Office 23 : //# National Radio Astronomy Observatory 24 : //# 520 Edgemont Road 25 : //# Charlottesville, VA 22903-2475 USA 26 : //# 27 : //# $Id$ 28 : // 29 : #include <synthesis/TransformMachines/ATerm.h> 30 : #include <synthesis/TransformMachines/SynthesisError.h> 31 : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h> 32 : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h> 33 : #include <casacore/coordinates/Coordinates/StokesCoordinate.h> 34 : // 35 : //--------------------------------------------------------------------- 36 : // 37 : using namespace casacore; 38 : namespace casa{ 39 : 40 0 : ATerm::ATerm() 41 0 : : CFTerms() 42 : { 43 : Int userValue; 44 : 45 0 : cachedOverSampling_p=OVERSAMPLING; 46 0 : userValue = SynthesisUtils::getenv("ATerm.OVERSAMPLING",OVERSAMPLING); 47 0 : if (userValue != cachedOverSampling_p) 48 : { 49 0 : cachedOverSampling_p = userValue; 50 : // cerr << "Oversampling set to " << cachedOverSampling_p << endl; 51 : } 52 : 53 : 54 0 : cachedConvSize_p=CONVSIZE; 55 0 : userValue = SynthesisUtils::getenv("ATerm.CONVSIZE",CONVSIZE); 56 0 : if (userValue != cachedConvSize_p) 57 : { 58 0 : cachedConvSize_p = userValue; 59 : //cerr << "ConvFuncSize set to " << cachedConvSize_p << endl; 60 : } 61 0 : }; 62 : 63 0 : Int ATerm::makePBPolnCoords(//const VisBuffer&vb, 64 : const Vector<Int>& vbCorrType, 65 : const Int& convSize, 66 : const Int& convSampling, 67 : const CoordinateSystem& skyCoord, 68 : const Int& skyNx, const Int& /*skyNy*/, 69 : CoordinateSystem& feedCoord) 70 : // Vector<Int>& cfStokes) 71 : { 72 0 : feedCoord = skyCoord; 73 : // 74 : // Make a two dimensional image to calculate auto-correlation of 75 : // the ideal illumination pattern. We want this on a fine grid in 76 : // the UV plane 77 : // 78 0 : Int directionIndex=skyCoord.findCoordinate(Coordinate::DIRECTION); 79 0 : AlwaysAssert(directionIndex>=0, AipsError); 80 0 : DirectionCoordinate dc=skyCoord.directionCoordinate(directionIndex); 81 0 : Vector<Double> sampling; 82 0 : sampling = dc.increment(); 83 0 : sampling*=Double(convSampling); 84 0 : sampling*=Double(skyNx)/Double(convSize); 85 0 : dc.setIncrement(sampling); 86 : 87 : 88 0 : Vector<Double> unitVec(2); 89 0 : unitVec=convSize/2; 90 0 : dc.setReferencePixel(unitVec); 91 : 92 : // Set the reference value to that of the image 93 0 : feedCoord.replaceCoordinate(dc, directionIndex); 94 : 95 : // 96 : // Make an image with circular polarization axis. 97 : // 98 0 : Int NPol=0,M,N=0; 99 0 : M=polMap_p_base.nelements(); 100 0 : for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) NPol++; 101 0 : Vector<Int> poln(NPol); 102 : 103 : Int index; 104 0 : Vector<Int> inStokes; 105 0 : index = feedCoord.findCoordinate(Coordinate::STOKES); 106 0 : inStokes = feedCoord.stokesCoordinate(index).stokes(); 107 0 : N = 0; 108 : try 109 : { 110 : // cerr << "### " << polMap_p_base << " " << vb.corrType() << endl; 111 0 : for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) {poln(N) = vbCorrType(i);N++;} 112 0 : StokesCoordinate polnCoord(poln); 113 0 : Int StokesIndex = feedCoord.findCoordinate(Coordinate::STOKES); 114 0 : feedCoord.replaceCoordinate(polnCoord,StokesIndex); 115 : // cfStokes = poln; 116 0 : } 117 0 : catch(AipsError& x) 118 : { 119 0 : throw(SynthesisFTMachineError("Likely cause: Discrepancy between the poln. " 120 0 : "axis of the data and the image specifications.")); 121 0 : } 122 : 123 0 : return NPol; 124 0 : } 125 : 126 0 : inline Int ATerm::getConvSize() 127 : { 128 0 : return cachedConvSize_p; 129 : // Int defaultConvSize=CONVSIZE, userValue; 130 : // userValue = SynthesisUtils::getenv("ATerm.CONVSIZE",CONVSIZE); 131 : // if (userValue != defaultConvSize) 132 : // { 133 : // defaultConvSize = userValue; 134 : // cerr << "ConvFuncSize set to " << defaultConvSize << endl; 135 : // } 136 : // return defaultConvSize; 137 : }; 138 : 139 0 : inline Int ATerm::getOversampling() 140 : { 141 0 : return cachedOverSampling_p; 142 : // Int defaultOversampling=OVERSAMPLING, userValue; 143 : // userValue = SynthesisUtils::getenv("ATerm.OVERSAMPLING",OVERSAMPLING); 144 : // if (userValue != defaultOversampling) 145 : // { 146 : // defaultOversampling = userValue; 147 : // cerr << "Oversampling set to " << defaultOversampling << endl; 148 : // } 149 : // return defaultOversampling; 150 : } 151 : };