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/TransformMachines2/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 : using namespace refim; 40 0 : ATerm::ATerm(): CFTerms() 41 : { 42 : Int userValue; 43 : 44 0 : cachedOverSampling_p=OVERSAMPLING; 45 0 : userValue = SynthesisUtils::getenv("ATerm.OVERSAMPLING",OVERSAMPLING); 46 0 : if (userValue != cachedOverSampling_p) 47 : { 48 0 : cachedOverSampling_p = userValue; 49 0 : cerr << "Oversampling set to " << cachedOverSampling_p << endl; 50 : } 51 : 52 : 53 0 : cachedConvSize_p=CONVSIZE; 54 0 : userValue = SynthesisUtils::getenv("ATerm.CONVSIZE",CONVSIZE); 55 0 : if (userValue != cachedConvSize_p) 56 : { 57 0 : cachedConvSize_p = userValue; 58 : //cerr << "ConvFuncSize set to " << cachedConvSize_p << endl; 59 : } 60 0 : }; 61 : 62 0 : Int ATerm::makePBPolnCoords(//const VisBuffer&vb, 63 : const Vector<Int>& vbCorrType, 64 : const Int& convSize, 65 : const Int& convSampling, 66 : const CoordinateSystem& skyCoord, 67 : const Int& skyNx, const Int& /*skyNy*/, 68 : CoordinateSystem& feedCoord) 69 : // Vector<Int>& cfStokes) 70 : { 71 0 : feedCoord = skyCoord; 72 : // 73 : // Make a two dimensional image to calculate auto-correlation of 74 : // the ideal illumination pattern. We want this on a fine grid in 75 : // the UV plane 76 : // 77 0 : Int directionIndex=skyCoord.findCoordinate(Coordinate::DIRECTION); 78 0 : AlwaysAssert(directionIndex>=0, AipsError); 79 0 : DirectionCoordinate dc=skyCoord.directionCoordinate(directionIndex); 80 0 : Vector<Double> sampling; 81 0 : sampling = dc.increment(); 82 0 : sampling*=Double(convSampling); 83 0 : sampling*=Double(skyNx)/Double(convSize); 84 0 : dc.setIncrement(sampling); 85 : 86 : 87 0 : Vector<Double> unitVec(2); 88 0 : unitVec=convSize/2; 89 0 : dc.setReferencePixel(unitVec); 90 : 91 : // Set the reference value to that of the image 92 0 : feedCoord.replaceCoordinate(dc, directionIndex); 93 : 94 : // 95 : // Make an image with circular polarization axis. 96 : // 97 0 : Int NPol=0,M,N=0; 98 0 : M=polMap_p_base.nelements(); 99 0 : for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) NPol++; 100 0 : Vector<Int> poln(NPol); 101 : 102 : Int index; 103 0 : Vector<Int> inStokes; 104 0 : index = feedCoord.findCoordinate(Coordinate::STOKES); 105 0 : inStokes = feedCoord.stokesCoordinate(index).stokes(); 106 0 : N = 0; 107 : try 108 : { 109 : // cerr << "### " << polMap_p_base << " " << vb.corrType() << endl; 110 0 : for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) {poln(N) = vbCorrType(i);N++;} 111 0 : StokesCoordinate polnCoord(poln); 112 0 : Int StokesIndex = feedCoord.findCoordinate(Coordinate::STOKES); 113 0 : feedCoord.replaceCoordinate(polnCoord,StokesIndex); 114 : // cfStokes = poln; 115 0 : } 116 0 : catch(AipsError& x) 117 : { 118 0 : throw(SynthesisFTMachineError("Likely cause: Discrepancy between the poln. " 119 0 : "axis of the data and the image specifications.")); 120 0 : } 121 : 122 0 : return NPol; 123 0 : } 124 : };