Line data Source code
1 : // -*- C++ -*- 2 : //# AzElAperture.cc: Implementation of the AzElAperture 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/AzElAperture.h> 30 : #include <ostream> 31 : using namespace casacore; 32 : namespace casa{ 33 : namespace refim{ 34 : // 35 0 : void AzElAperture::rotate(const VisBuffer2& vb, CFCell& cfc, const Double& rotAngleIncr) 36 : { 37 0 : LogIO log_l(LogOrigin("AzElAperture", "rotate")); 38 0 : Double R2D = 57.2957795131; 39 : // If the A-Term is a No-Op, the resulting CF is rotationally 40 : // symmetric. 41 0 : if (isNoOp()) return; 42 : 43 0 : Double actualPA = getPA(vb), currentCFPA = cfc.pa_p.getValue("rad"); 44 0 : cerr << "AzEL: ######### " << cfc.pa_p.getValue("deg") << " " << actualPA*R2D << " " << cfc.getStorage()->shape() << endl; 45 0 : Double dPA = currentCFPA-actualPA; 46 : //Double dPA = cachedCFCPA_p-actualPA; 47 0 : if (fabs(dPA) > fabs(rotAngleIncr)) 48 : // if (fabs(actualPA-currentCFPA) > 0.0) 49 : { 50 : //if (cachedCFCPA_p == 400.0) cachedCFCPA_p=currentCFPA; 51 : 52 0 : if (cachedCFC_p.nelements() == 0) 53 : { 54 0 : log_l << "Making a base copy of the current CFC@ PA=" << currentCFPA*R2D << LogIO::POST; 55 0 : cachedCFC_p.assign(*cfc.getStorage()); 56 0 : cachedCFCPA_p = cfc.pa_p.getValue("rad"); 57 : } 58 0 : dPA = cachedCFCPA_p-actualPA; 59 0 : Array<TT> inData; 60 : //inData.assign(*cfc.getStorage()); 61 0 : inData.assign(cachedCFC_p); 62 : // log_l << actualPA << " " << currentCFPA << LogIO::POST; 63 : // cerr << "dPA = " << actualPA << " " << currentCFPA << " " 64 : // << actualPA - currentCFPA << " " << &(*cfc.getStorage()) << endl; 65 0 : log_l << "Rotating the base CFC from PA=" << cachedCFCPA_p*R2D 66 : << " to " << actualPA*R2D << " " << dPA*R2D << " " 67 : << inData.shape() << " " 68 0 : << "SPW: " << vb.spectralWindows() 69 0 : << " Field: " << vb.fieldId() 70 0 : << LogIO::POST; 71 0 : SynthesisUtils::rotateComplexArray(log_l, inData, cfc.coordSys_p, 72 0 : *cfc.getStorage(), 73 : dPA);//,"LINEAR"); 74 : // currentCFPA-actualPA);//,"LINEAR"); 75 : // Update the PA value in the CF-Cache 76 0 : cfc.pa_p=Quantity(actualPA, "rad"); 77 : 78 : // static Int ii=0; 79 : // { 80 : // ostringstream name; 81 : // name << "cfc." << ii << ".im"; 82 : // cfc.makePersistent(name.str().c_str()); 83 : // ii++; 84 : // } 85 0 : } 86 0 : }; 87 : 88 0 : void AzElAperture::rotate2(const VisBuffer2& vb, CFCell& baseCFC, CFCell& cfc, const Double& rotAngleIncr) 89 : { 90 0 : LogIO log_l(LogOrigin("AzElAperture", "rotate")); 91 : 92 : // If the A-Term is a No-Op, the resulting CF is rotationally 93 : // symmetric. 94 0 : if (isNoOp()) return; 95 : 96 : (void)baseCFC; 97 : 98 0 : Double actualPA = getPA(vb), currentCFPA = cfc.pa_p.getValue("rad"); 99 : //Double baseCFCPA=baseCFC.pa_p.getValue("rad"); 100 : 101 0 : Double dPA = currentCFPA-actualPA; 102 : 103 0 : if (fabs(dPA) > fabs(rotAngleIncr)) 104 : { 105 0 : Array<TT> inData; 106 : //inData.assign(*baseCFC.getStorage()); 107 : //dPA = baseCFCPA-actualPA; 108 0 : dPA = currentCFPA-actualPA; 109 0 : inData.assign(*cfc.getStorage()); 110 : 111 0 : SynthesisUtils::rotateComplexArray(log_l, inData, cfc.coordSys_p, 112 0 : *cfc.getStorage(), 113 : dPA);//,"LINEAR"); 114 : // currentCFPA-actualPA);//,"LINEAR"); 115 0 : cfc.pa_p=Quantity(actualPA, "rad"); 116 0 : } 117 0 : }; 118 : }; 119 : };