Line data Source code
1 : //# FTMachine.cc: Implementation of FTMachine class 2 : //# Copyright (C) 1997,1998,2000,2001 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 addressed 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 : //# $Id$ 27 : 28 : #include <msvis/MSVis/VisibilityIterator2.h> 29 : #include <msvis/MSVis/VisBuffer2.h> 30 : #include <casacore/casa/Quanta/Euler.h> 31 : #include <casacore/casa/Quanta/RotMatrix.h> 32 : #include <casacore/measures/Measures/MDirection.h> 33 : #include <casacore/ms/MeasurementSets/MSColumns.h> 34 : #include <casacore/casa/BasicSL/Constants.h> 35 : #include <synthesis/TransformMachines2/ComponentFTMachine.h> 36 : #include <casacore/casa/Arrays/ArrayMath.h> 37 : #include <casacore/casa/Arrays/MatrixMath.h> 38 : #include <casacore/casa/Arrays/Array.h> 39 : #include <casacore/casa/Arrays/Vector.h> 40 : #include <casacore/casa/Arrays/Matrix.h> 41 : #include <casacore/casa/BasicSL/String.h> 42 : #include <casacore/casa/Utilities/Assert.h> 43 : #include <casacore/casa/Exceptions/Error.h> 44 : #include <casacore/measures/Measures/UVWMachine.h> 45 : #include <casacore/ms/MeasurementSets/MSColumns.h> 46 : #include <casacore/casa/OS/Timer.h> 47 : 48 : using namespace casacore; 49 : namespace casa { //# NAMESPACE CASA - BEGIN 50 : 51 : namespace refim{ //namespace for refator imaging 52 : 53 : using namespace casacore; 54 : using namespace casa; 55 : using namespace casacore; 56 : using namespace casa::refim; 57 : using namespace casacore; 58 : using namespace casa::vi; 59 : //---------------------------------------------------------------------- 60 804 : ComponentFTMachine::ComponentFTMachine() : numthreads_p(-1) 61 : { 62 804 : } 63 : 64 0 : LogIO& ComponentFTMachine::logIO() {return logIO_p;}; 65 : 66 : //---------------------------------------------------------------------- 67 : ComponentFTMachine& 68 0 : ComponentFTMachine::operator=(const ComponentFTMachine& other) 69 : { 70 : if(this!=&other) { 71 : }; 72 0 : return *this; 73 : }; 74 : 75 : //---------------------------------------------------------------------- 76 0 : ComponentFTMachine::ComponentFTMachine(const ComponentFTMachine& other) 77 : { 78 0 : operator=(other); 79 0 : } 80 : 81 : //---------------------------------------------------------------------- 82 804 : ComponentFTMachine::~ComponentFTMachine() { 83 804 : } 84 : 85 0 : void ComponentFTMachine::setnumthreads(const Int numthreads){ 86 0 : numthreads_p=numthreads; 87 0 : } 88 : 89 640 : void ComponentFTMachine::rotateUVW(Matrix<Double>& uvw, Vector<Double>& dphase, 90 : const VisBuffer2& vb, 91 : const MDirection& mDesired) 92 : { 93 : 94 : // 1. We need to convert this type (e.g. MDirection::SUN to the 95 : // type observed (e.g. MDirection::J2000). So first we get 96 : // the type and combine it with the specified frame that includes 97 : // the observing epoch. So we end up with e.g. the position of 98 : // the Sun on the specified epoch, expressed in J2000 coordinates. 99 : // We also add an MPosition as well so that for compact arrays we 100 : // can specify images in e.g. AZEL or HADEC. 101 : 102 640 : MSColumns msc(vb.ms()); 103 1280 : MeasFrame mFrame((MEpoch(Quantity(vb.time()(0), 104 1280 : msc.timeQuant()(0).getUnit() ), 105 1280 : msc.timeMeas()(0).getRef())), 106 1280 : msc.antenna().positionMeas()(0)); 107 : 108 640 : UVWMachine uvwMachine(mDesired, vb.phaseCenter(), mFrame, 109 640 : false, false); 110 : 111 : // Now we convert all rows and also calculate the 112 : // change in phase 113 640 : uInt nrows=dphase.nelements(); 114 640 : Vector<Double> thisRow(3); 115 640 : thisRow=0.0; 116 : uInt i; 117 226915 : for (uInt row=0;row<nrows;row++) { 118 905100 : for (i=0;i<3;i++) thisRow(i)=uvw(i,row); 119 226275 : uvwMachine.convertUVW(dphase(row), thisRow); 120 905100 : for (i=0;i<3;i++) uvw(i,row)=thisRow(i); 121 : } 122 : 123 640 : } 124 : 125 0 : void ComponentFTMachine::rotateUVW(Double*& uvw, Double*& dphase, const Int nrows, 126 : const VisBuffer2& vb, 127 : const MDirection& mDesired) 128 : { 129 : 130 : // 1. We need to convert this type (e.g. MDirection::SUN to the 131 : // type observed (e.g. MDirection::J2000). So first we get 132 : // the type and combine it with the specified frame that includes 133 : // the observing epoch. So we end up with e.g. the position of 134 : // the Sun on the specified epoch, expressed in J2000 coordinates. 135 : // We also add an MPosition as well so that for compact arrays we 136 : // can specify images in e.g. AZEL or HADEC. 137 0 : MSColumns msc(vb.ms()); 138 0 : MeasFrame mFrame((MEpoch(Quantity(vb.time()(0), msc.timeQuant()(0).getUnit()), msc.timeMeas()(0).getRef())), msc.antenna().positionMeas()(0)); 139 : 140 : 141 0 : UVWMachine uvwMachine(mDesired, vb.phaseCenter(), mFrame, 142 0 : false, false); 143 : 144 : // Now we convert all rows and also calculate the 145 : // change in phase 146 0 : Vector<Double> thisRow(3); 147 0 : thisRow=0.0; 148 : uInt i; 149 0 : for (Int row=0;row<nrows;row++) { 150 0 : for (i=0;i<3;i++) thisRow(i)=uvw[row*3+i]; 151 0 : uvwMachine.convertUVW(dphase[row], thisRow); 152 0 : for (i=0;i<3;i++) uvw[row*3+i]=thisRow(i); 153 : } 154 : 155 0 : } 156 : 157 0 : void ComponentFTMachine::ok() { 158 0 : } 159 : 160 : 161 : 162 : 163 : 164 : } //end namespce refim 165 : } //# NAMESPACE CASA - END 166 :