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