[2] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# SDMemTable.cc: A MemoryTable container for single dish integrations |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2004 |
---|
[125] | 5 | //# ATNF |
---|
[2] | 6 | //# |
---|
| 7 | //# This program is free software; you can redistribute it and/or modify it |
---|
| 8 | //# under the terms of the GNU General Public License as published by the Free |
---|
| 9 | //# Software Foundation; either version 2 of the License, or (at your option) |
---|
| 10 | //# any later version. |
---|
| 11 | //# |
---|
| 12 | //# This program is distributed in the hope that it will be useful, but |
---|
| 13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 15 | //# Public License for more details. |
---|
| 16 | //# |
---|
| 17 | //# You should have received a copy of the GNU General Public License along |
---|
| 18 | //# with this program; if not, write to the Free Software Foundation, Inc., |
---|
| 19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
---|
| 20 | //# |
---|
| 21 | //# Correspondence concerning this software should be addressed as follows: |
---|
| 22 | //# Internet email: Malte.Marquarding@csiro.au |
---|
| 23 | //# Postal address: Malte Marquarding, |
---|
| 24 | //# Australia Telescope National Facility, |
---|
| 25 | //# P.O. Box 76, |
---|
| 26 | //# Epping, NSW, 2121, |
---|
| 27 | //# AUSTRALIA |
---|
| 28 | //# |
---|
| 29 | //# $Id: |
---|
| 30 | //#--------------------------------------------------------------------------- |
---|
| 31 | |
---|
[206] | 32 | #include <map> |
---|
| 33 | |
---|
[125] | 34 | #include <casa/aips.h> |
---|
[80] | 35 | #include <casa/iostream.h> |
---|
| 36 | #include <casa/iomanip.h> |
---|
| 37 | #include <casa/Arrays/Array.h> |
---|
| 38 | #include <casa/Arrays/ArrayMath.h> |
---|
| 39 | #include <casa/Arrays/MaskArrMath.h> |
---|
| 40 | #include <casa/Arrays/ArrayLogical.h> |
---|
| 41 | #include <casa/Arrays/ArrayAccessor.h> |
---|
[206] | 42 | #include <casa/Arrays/Vector.h> |
---|
[418] | 43 | #include <casa/BasicMath/Math.h> |
---|
[286] | 44 | #include <casa/Quanta/MVAngle.h> |
---|
[2] | 45 | |
---|
[80] | 46 | #include <tables/Tables/TableParse.h> |
---|
| 47 | #include <tables/Tables/TableDesc.h> |
---|
| 48 | #include <tables/Tables/SetupNewTab.h> |
---|
| 49 | #include <tables/Tables/ScaColDesc.h> |
---|
| 50 | #include <tables/Tables/ArrColDesc.h> |
---|
[2] | 51 | |
---|
[80] | 52 | #include <tables/Tables/ExprNode.h> |
---|
| 53 | #include <tables/Tables/TableRecord.h> |
---|
| 54 | #include <measures/Measures/MFrequency.h> |
---|
| 55 | #include <measures/Measures/MeasTable.h> |
---|
[105] | 56 | #include <coordinates/Coordinates/CoordinateUtil.h> |
---|
[80] | 57 | #include <casa/Quanta/MVTime.h> |
---|
[281] | 58 | #include <casa/Quanta/MVAngle.h> |
---|
[2] | 59 | |
---|
[215] | 60 | #include "SDDefs.h" |
---|
[2] | 61 | #include "SDMemTable.h" |
---|
| 62 | #include "SDContainer.h" |
---|
[365] | 63 | #include "MathUtils.h" |
---|
[418] | 64 | #include "SDPol.h" |
---|
[2] | 65 | |
---|
[206] | 66 | |
---|
[125] | 67 | using namespace casa; |
---|
[83] | 68 | using namespace asap; |
---|
[2] | 69 | |
---|
[18] | 70 | SDMemTable::SDMemTable() : |
---|
| 71 | IFSel_(0), |
---|
| 72 | beamSel_(0), |
---|
[206] | 73 | polSel_(0) |
---|
| 74 | { |
---|
[18] | 75 | setup(); |
---|
[322] | 76 | attach(); |
---|
[18] | 77 | } |
---|
[206] | 78 | |
---|
[2] | 79 | SDMemTable::SDMemTable(const std::string& name) : |
---|
| 80 | IFSel_(0), |
---|
| 81 | beamSel_(0), |
---|
[206] | 82 | polSel_(0) |
---|
| 83 | { |
---|
[50] | 84 | Table tab(name); |
---|
[22] | 85 | table_ = tab.copyToMemoryTable("dummy"); |
---|
[206] | 86 | //cerr << "hello from C SDMemTable @ " << this << endl; |
---|
[329] | 87 | attach(); |
---|
[2] | 88 | } |
---|
| 89 | |
---|
[206] | 90 | SDMemTable::SDMemTable(const SDMemTable& other, Bool clear) |
---|
| 91 | { |
---|
[148] | 92 | IFSel_= other.IFSel_; |
---|
| 93 | beamSel_= other.beamSel_; |
---|
| 94 | polSel_= other.polSel_; |
---|
| 95 | chanMask_ = other.chanMask_; |
---|
| 96 | table_ = other.table_.copyToMemoryTable(String("dummy")); |
---|
[2] | 97 | // clear all rows() |
---|
[16] | 98 | if (clear) { |
---|
[148] | 99 | table_.removeRow(this->table_.rowNumbers()); |
---|
[16] | 100 | } else { |
---|
[148] | 101 | IFSel_ = other.IFSel_; |
---|
| 102 | beamSel_ = other.beamSel_; |
---|
| 103 | polSel_ = other.polSel_; |
---|
[16] | 104 | } |
---|
[322] | 105 | // |
---|
| 106 | attach(); |
---|
[206] | 107 | //cerr << "hello from CC SDMemTable @ " << this << endl; |
---|
[2] | 108 | } |
---|
| 109 | |
---|
[80] | 110 | SDMemTable::SDMemTable(const Table& tab, const std::string& exprs) : |
---|
[2] | 111 | IFSel_(0), |
---|
| 112 | beamSel_(0), |
---|
[206] | 113 | polSel_(0) |
---|
| 114 | { |
---|
[380] | 115 | cout << exprs << endl; |
---|
[2] | 116 | Table t = tableCommand(exprs,tab); |
---|
[89] | 117 | if (t.nrow() == 0) |
---|
| 118 | throw(AipsError("Query unsuccessful.")); |
---|
[22] | 119 | table_ = t.copyToMemoryTable("dummy"); |
---|
[329] | 120 | attach(); |
---|
[380] | 121 | renumber(); |
---|
[2] | 122 | } |
---|
| 123 | |
---|
[206] | 124 | SDMemTable::~SDMemTable() |
---|
| 125 | { |
---|
[105] | 126 | //cerr << "goodbye from SDMemTable @ " << this << endl; |
---|
[2] | 127 | } |
---|
| 128 | |
---|
[206] | 129 | SDMemTable SDMemTable::getScan(Int scanID) const |
---|
| 130 | { |
---|
[80] | 131 | String cond("SELECT * from $1 WHERE SCANID == "); |
---|
| 132 | cond += String::toString(scanID); |
---|
| 133 | return SDMemTable(table_, cond); |
---|
[2] | 134 | } |
---|
| 135 | |
---|
[206] | 136 | SDMemTable &SDMemTable::operator=(const SDMemTable& other) |
---|
| 137 | { |
---|
[148] | 138 | if (this != &other) { |
---|
| 139 | IFSel_= other.IFSel_; |
---|
| 140 | beamSel_= other.beamSel_; |
---|
| 141 | polSel_= other.polSel_; |
---|
| 142 | chanMask_.resize(0); |
---|
| 143 | chanMask_ = other.chanMask_; |
---|
| 144 | table_ = other.table_.copyToMemoryTable(String("dummy")); |
---|
[322] | 145 | attach(); |
---|
[206] | 146 | } |
---|
| 147 | //cerr << "hello from ASS SDMemTable @ " << this << endl; |
---|
[138] | 148 | return *this; |
---|
| 149 | } |
---|
| 150 | |
---|
[206] | 151 | SDMemTable SDMemTable::getSource(const std::string& source) const |
---|
| 152 | { |
---|
[80] | 153 | String cond("SELECT * from $1 WHERE SRCNAME == "); |
---|
| 154 | cond += source; |
---|
| 155 | return SDMemTable(table_, cond); |
---|
| 156 | } |
---|
| 157 | |
---|
[206] | 158 | void SDMemTable::setup() |
---|
| 159 | { |
---|
[2] | 160 | TableDesc td("", "1", TableDesc::Scratch); |
---|
| 161 | td.comment() = "A SDMemTable"; |
---|
[322] | 162 | // |
---|
[2] | 163 | td.addColumn(ScalarColumnDesc<Double>("TIME")); |
---|
| 164 | td.addColumn(ScalarColumnDesc<String>("SRCNAME")); |
---|
| 165 | td.addColumn(ArrayColumnDesc<Float>("SPECTRA")); |
---|
| 166 | td.addColumn(ArrayColumnDesc<uChar>("FLAGTRA")); |
---|
[89] | 167 | td.addColumn(ArrayColumnDesc<Float>("TSYS")); |
---|
[418] | 168 | td.addColumn(ArrayColumnDesc<Float>("STOKES")); |
---|
[89] | 169 | td.addColumn(ScalarColumnDesc<Int>("SCANID")); |
---|
| 170 | td.addColumn(ScalarColumnDesc<Double>("INTERVAL")); |
---|
[39] | 171 | td.addColumn(ArrayColumnDesc<uInt>("FREQID")); |
---|
[386] | 172 | td.addColumn(ArrayColumnDesc<uInt>("RESTFREQID")); |
---|
[78] | 173 | td.addColumn(ArrayColumnDesc<Double>("DIRECTION")); |
---|
[105] | 174 | td.addColumn(ScalarColumnDesc<String>("FIELDNAME")); |
---|
| 175 | td.addColumn(ScalarColumnDesc<String>("TCALTIME")); |
---|
| 176 | td.addColumn(ArrayColumnDesc<Float>("TCAL")); |
---|
| 177 | td.addColumn(ScalarColumnDesc<Float>("AZIMUTH")); |
---|
| 178 | td.addColumn(ScalarColumnDesc<Float>("ELEVATION")); |
---|
| 179 | td.addColumn(ScalarColumnDesc<Float>("PARANGLE")); |
---|
| 180 | td.addColumn(ScalarColumnDesc<Int>("REFBEAM")); |
---|
[206] | 181 | td.addColumn(ArrayColumnDesc<String>("HISTORY")); |
---|
[105] | 182 | |
---|
[418] | 183 | // Now create Table SetUp from the description. |
---|
[18] | 184 | |
---|
[22] | 185 | SetupNewTable aNewTab("dummy", td, Table::New); |
---|
[418] | 186 | |
---|
| 187 | // Bind the Stokes Virtual machine to the STOKES column |
---|
| 188 | // Because we don't know how many polarizations will |
---|
| 189 | // be in the data at this point, we must bind the |
---|
| 190 | // Virtual Engine regardless. The STOKES column won't |
---|
| 191 | // be accessed if not appropriate (nPol=4) |
---|
| 192 | |
---|
| 193 | SDStokesEngine stokesEngine(String("STOKES"), String("SPECTRA")); |
---|
| 194 | aNewTab.bindColumn ("STOKES", stokesEngine); |
---|
| 195 | |
---|
| 196 | // Create Table |
---|
| 197 | |
---|
[89] | 198 | table_ = Table(aNewTab, Table::Memory, 0); |
---|
[2] | 199 | } |
---|
| 200 | |
---|
[418] | 201 | |
---|
[380] | 202 | void SDMemTable::attach() |
---|
[322] | 203 | { |
---|
| 204 | timeCol_.attach(table_, "TIME"); |
---|
| 205 | srcnCol_.attach(table_, "SRCNAME"); |
---|
| 206 | specCol_.attach(table_, "SPECTRA"); |
---|
| 207 | flagsCol_.attach(table_, "FLAGTRA"); |
---|
| 208 | tsCol_.attach(table_, "TSYS"); |
---|
[418] | 209 | stokesCol_.attach(table_, "STOKES"); |
---|
[322] | 210 | scanCol_.attach(table_, "SCANID"); |
---|
| 211 | integrCol_.attach(table_, "INTERVAL"); |
---|
| 212 | freqidCol_.attach(table_, "FREQID"); |
---|
[386] | 213 | restfreqidCol_.attach(table_, "RESTFREQID"); |
---|
[322] | 214 | dirCol_.attach(table_, "DIRECTION"); |
---|
| 215 | fldnCol_.attach(table_, "FIELDNAME"); |
---|
| 216 | tcaltCol_.attach(table_, "TCALTIME"); |
---|
| 217 | tcalCol_.attach(table_, "TCAL"); |
---|
| 218 | azCol_.attach(table_, "AZIMUTH"); |
---|
| 219 | elCol_.attach(table_, "ELEVATION"); |
---|
| 220 | paraCol_.attach(table_, "PARANGLE"); |
---|
| 221 | rbeamCol_.attach(table_, "REFBEAM"); |
---|
| 222 | histCol_.attach(table_, "HISTORY"); |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | |
---|
[206] | 226 | std::string SDMemTable::getSourceName(Int whichRow) const |
---|
| 227 | { |
---|
[2] | 228 | String name; |
---|
[322] | 229 | srcnCol_.get(whichRow, name); |
---|
[2] | 230 | return name; |
---|
| 231 | } |
---|
| 232 | |
---|
[281] | 233 | std::string SDMemTable::getTime(Int whichRow, Bool showDate) const |
---|
[206] | 234 | { |
---|
[2] | 235 | Double tm; |
---|
[281] | 236 | if (whichRow > -1) { |
---|
[322] | 237 | timeCol_.get(whichRow, tm); |
---|
[281] | 238 | } else { |
---|
| 239 | table_.keywordSet().get("UTC",tm); |
---|
| 240 | } |
---|
[50] | 241 | MVTime mvt(tm); |
---|
[281] | 242 | if (showDate) |
---|
| 243 | mvt.setFormat(MVTime::YMD); |
---|
| 244 | else |
---|
| 245 | mvt.setFormat(MVTime::TIME); |
---|
[50] | 246 | ostringstream oss; |
---|
| 247 | oss << mvt; |
---|
[281] | 248 | return String(oss); |
---|
[2] | 249 | } |
---|
[281] | 250 | |
---|
[206] | 251 | double SDMemTable::getInterval(Int whichRow) const |
---|
| 252 | { |
---|
[50] | 253 | Double intval; |
---|
[322] | 254 | integrCol_.get(whichRow, intval); |
---|
[50] | 255 | return intval; |
---|
| 256 | } |
---|
[2] | 257 | |
---|
[206] | 258 | bool SDMemTable::setIF(Int whichIF) |
---|
| 259 | { |
---|
[50] | 260 | if ( whichIF >= 0 && whichIF < nIF()) { |
---|
[2] | 261 | IFSel_ = whichIF; |
---|
| 262 | return true; |
---|
[50] | 263 | } |
---|
| 264 | return false; |
---|
[2] | 265 | } |
---|
[50] | 266 | |
---|
[206] | 267 | bool SDMemTable::setBeam(Int whichBeam) |
---|
| 268 | { |
---|
[50] | 269 | if ( whichBeam >= 0 && whichBeam < nBeam()) { |
---|
[2] | 270 | beamSel_ = whichBeam; |
---|
| 271 | return true; |
---|
[50] | 272 | } |
---|
| 273 | return false; |
---|
| 274 | } |
---|
[2] | 275 | |
---|
[206] | 276 | bool SDMemTable::setPol(Int whichPol) |
---|
| 277 | { |
---|
[50] | 278 | if ( whichPol >= 0 && whichPol < nPol()) { |
---|
[2] | 279 | polSel_ = whichPol; |
---|
| 280 | return true; |
---|
[50] | 281 | } |
---|
| 282 | return false; |
---|
[2] | 283 | } |
---|
| 284 | |
---|
[380] | 285 | void SDMemTable::resetCursor() |
---|
[303] | 286 | { |
---|
| 287 | polSel_ = 0; |
---|
| 288 | IFSel_ = 0; |
---|
| 289 | beamSel_ = 0; |
---|
| 290 | } |
---|
| 291 | |
---|
[206] | 292 | bool SDMemTable::setMask(std::vector<int> whichChans) |
---|
| 293 | { |
---|
[16] | 294 | std::vector<int>::iterator it; |
---|
[322] | 295 | uInt n = flagsCol_.shape(0)(3); |
---|
[105] | 296 | if (whichChans.empty()) { |
---|
| 297 | chanMask_ = std::vector<bool>(n,true); |
---|
| 298 | return true; |
---|
| 299 | } |
---|
[16] | 300 | chanMask_.resize(n,true); |
---|
[39] | 301 | for (it = whichChans.begin(); it != whichChans.end(); ++it) { |
---|
[105] | 302 | if (*it < n) { |
---|
[16] | 303 | chanMask_[*it] = false; |
---|
[105] | 304 | } |
---|
[16] | 305 | } |
---|
[2] | 306 | return true; |
---|
| 307 | } |
---|
| 308 | |
---|
[16] | 309 | std::vector<bool> SDMemTable::getMask(Int whichRow) const { |
---|
| 310 | std::vector<bool> mask; |
---|
| 311 | Array<uChar> arr; |
---|
[322] | 312 | flagsCol_.get(whichRow, arr); |
---|
[206] | 313 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(arr); |
---|
[16] | 314 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 315 | ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0); |
---|
[16] | 316 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 317 | ArrayAccessor<uChar, Axis<asap::PolAxis> > aa2(aa1); |
---|
[16] | 318 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
| 319 | |
---|
| 320 | Bool useUserMask = ( chanMask_.size() == arr.shape()(3) ); |
---|
| 321 | |
---|
| 322 | std::vector<bool> tmp; |
---|
| 323 | tmp = chanMask_; // WHY the fxxx do I have to make a copy here |
---|
| 324 | std::vector<bool>::iterator miter; |
---|
| 325 | miter = tmp.begin(); |
---|
| 326 | |
---|
[206] | 327 | for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[16] | 328 | bool out =!static_cast<bool>(*i); |
---|
| 329 | if (useUserMask) { |
---|
| 330 | out = out && (*miter); |
---|
| 331 | miter++; |
---|
| 332 | } |
---|
| 333 | mask.push_back(out); |
---|
[89] | 334 | } |
---|
[16] | 335 | return mask; |
---|
[2] | 336 | } |
---|
[418] | 337 | |
---|
| 338 | |
---|
| 339 | |
---|
[206] | 340 | std::vector<float> SDMemTable::getSpectrum(Int whichRow) const |
---|
| 341 | { |
---|
[430] | 342 | |
---|
[2] | 343 | Array<Float> arr; |
---|
[322] | 344 | specCol_.get(whichRow, arr); |
---|
[418] | 345 | return getFloatSpectrum (arr); |
---|
| 346 | } |
---|
| 347 | |
---|
[426] | 348 | std::vector<float> SDMemTable::getStokesSpectrum(Int whichRow, Bool doPol, Float paOffset) const |
---|
[418] | 349 | // |
---|
| 350 | // Gets |
---|
| 351 | // doPol=False : I,Q,U,V |
---|
| 352 | // doPol=True : I,P,PA,V ; P = sqrt(Q**2+U**2), PA = 0.5*atan2(Q,U) |
---|
| 353 | // |
---|
| 354 | { |
---|
[430] | 355 | AlwaysAssert(asap::nAxes==4,AipsError); |
---|
[428] | 356 | if (nPol()!=1 && nPol()!=2 && nPol()!=4) { |
---|
| 357 | throw (AipsError("You must have 1,2 or 4 polarizations to get the Stokes parameters")); |
---|
[418] | 358 | } |
---|
| 359 | Array<Float> arr; |
---|
| 360 | stokesCol_.get(whichRow, arr); |
---|
| 361 | // |
---|
[430] | 362 | if (doPol && (polSel_==1 || polSel_==2)) { // Q,U --> P, P.A. |
---|
| 363 | |
---|
| 364 | // Set current cursor location |
---|
| 365 | |
---|
[418] | 366 | const IPosition& shape = arr.shape(); |
---|
[430] | 367 | IPosition start, end; |
---|
| 368 | setCursorSlice (start, end, shape); |
---|
| 369 | |
---|
| 370 | // Get Q and U slices |
---|
| 371 | |
---|
| 372 | Array<Float> Q = SDPolUtil::getStokesSlice (arr,start,end,"Q"); |
---|
| 373 | Array<Float> U = SDPolUtil::getStokesSlice (arr,start,end,"U"); |
---|
| 374 | |
---|
| 375 | // Compute output |
---|
| 376 | |
---|
[418] | 377 | Array<Float> out; |
---|
| 378 | if (polSel_==1) { // P |
---|
| 379 | out = SDPolUtil::polarizedIntensity(Q,U); |
---|
| 380 | } else if (polSel_==2) { // P.A. |
---|
[426] | 381 | out = SDPolUtil::positionAngle(Q,U) + paOffset; |
---|
[418] | 382 | } |
---|
[430] | 383 | |
---|
| 384 | // Copy to output |
---|
| 385 | |
---|
[418] | 386 | IPosition vecShape(1,shape(asap::ChanAxis)); |
---|
| 387 | Vector<Float> outV = out.reform(vecShape); |
---|
[430] | 388 | return convertVector(outV); |
---|
[418] | 389 | } else { |
---|
[430] | 390 | |
---|
| 391 | // Selects at the cursor location |
---|
| 392 | |
---|
| 393 | return getFloatSpectrum (arr); |
---|
[418] | 394 | } |
---|
| 395 | } |
---|
| 396 | |
---|
[430] | 397 | std::vector<float> SDMemTable::getCircularSpectrum(Int whichRow, Bool doRR) const |
---|
| 398 | // |
---|
| 399 | // Gets |
---|
| 400 | // RR = I + V |
---|
| 401 | // LL = I - V |
---|
| 402 | // |
---|
| 403 | { |
---|
| 404 | AlwaysAssert(asap::nAxes==4,AipsError); |
---|
| 405 | if (nPol()!=4) { |
---|
| 406 | throw (AipsError("You must have 4 polarizations to get RR or LL")); |
---|
| 407 | } |
---|
| 408 | Array<Float> arr; |
---|
| 409 | stokesCol_.get(whichRow, arr); |
---|
| 410 | |
---|
| 411 | // Set current cursor location |
---|
| 412 | |
---|
| 413 | const IPosition& shape = arr.shape(); |
---|
| 414 | IPosition start, end; |
---|
| 415 | setCursorSlice (start, end, shape); |
---|
| 416 | |
---|
| 417 | // Get I and V slices |
---|
| 418 | |
---|
| 419 | Array<Float> I = SDPolUtil::getStokesSlice (arr,start,end,"I"); |
---|
| 420 | Array<Float> V = SDPolUtil::getStokesSlice (arr,start,end,"V"); |
---|
| 421 | |
---|
| 422 | // Compute output |
---|
| 423 | |
---|
| 424 | Array<Float> out = SDPolUtil::circularPolarizationFromStokes (I, V, doRR); |
---|
| 425 | |
---|
| 426 | // Copy to output |
---|
| 427 | |
---|
| 428 | IPosition vecShape(1,shape(asap::ChanAxis)); |
---|
| 429 | Vector<Float> outV = out.reform(vecShape); |
---|
| 430 | return convertVector(outV); |
---|
| 431 | } |
---|
| 432 | |
---|
[418] | 433 | std::vector<float> SDMemTable::getFloatSpectrum (const Array<Float>& arr) const |
---|
[430] | 434 | // |
---|
| 435 | // Get spectrum at cursor location |
---|
| 436 | // |
---|
[418] | 437 | { |
---|
| 438 | |
---|
| 439 | // Iterate and extract |
---|
| 440 | |
---|
[206] | 441 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr); |
---|
[2] | 442 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 443 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); |
---|
[2] | 444 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 445 | ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1); |
---|
[16] | 446 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
[418] | 447 | // |
---|
| 448 | std::vector<float> spectrum; |
---|
[206] | 449 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[16] | 450 | spectrum.push_back(*i); |
---|
[2] | 451 | } |
---|
| 452 | return spectrum; |
---|
| 453 | } |
---|
[418] | 454 | |
---|
| 455 | |
---|
[206] | 456 | std::vector<string> SDMemTable::getCoordInfo() const |
---|
| 457 | { |
---|
[105] | 458 | String un; |
---|
| 459 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
| 460 | String sunit; |
---|
| 461 | t.keywordSet().get("UNIT",sunit); |
---|
| 462 | String dpl; |
---|
| 463 | t.keywordSet().get("DOPPLER",dpl); |
---|
| 464 | if (dpl == "") dpl = "RADIO"; |
---|
| 465 | String rfrm; |
---|
| 466 | t.keywordSet().get("REFFRAME",rfrm); |
---|
| 467 | std::vector<string> inf; |
---|
| 468 | inf.push_back(sunit); |
---|
| 469 | inf.push_back(rfrm); |
---|
| 470 | inf.push_back(dpl); |
---|
[263] | 471 | t.keywordSet().get("BASEREFFRAME",rfrm); |
---|
| 472 | inf.push_back(rfrm); |
---|
[105] | 473 | return inf; |
---|
| 474 | } |
---|
[39] | 475 | |
---|
[206] | 476 | void SDMemTable::setCoordInfo(std::vector<string> theinfo) |
---|
| 477 | { |
---|
[105] | 478 | std::vector<string>::iterator it; |
---|
[306] | 479 | String un,rfrm, brfrm,dpl; |
---|
| 480 | un = theinfo[0]; // Abcissa unit |
---|
| 481 | rfrm = theinfo[1]; // Active (or conversion) frame |
---|
| 482 | dpl = theinfo[2]; // Doppler |
---|
| 483 | brfrm = theinfo[3]; // Base frame |
---|
| 484 | // |
---|
[105] | 485 | Table t = table_.rwKeywordSet().asTable("FREQUENCIES"); |
---|
[306] | 486 | // |
---|
[105] | 487 | Vector<Double> rstf; |
---|
| 488 | t.keywordSet().get("RESTFREQS",rstf); |
---|
[306] | 489 | // |
---|
[105] | 490 | Bool canDo = True; |
---|
| 491 | Unit u1("km/s");Unit u2("Hz"); |
---|
| 492 | if (Unit(un) == u1) { |
---|
| 493 | Vector<Double> rstf; |
---|
| 494 | t.keywordSet().get("RESTFREQS",rstf); |
---|
| 495 | if (rstf.nelements() == 0) { |
---|
| 496 | throw(AipsError("Can't set unit to km/s if no restfrequencies are specified")); |
---|
| 497 | } |
---|
| 498 | } else if (Unit(un) != u2 && un != "") { |
---|
| 499 | throw(AipsError("Unit not conformant with Spectral Coordinates")); |
---|
| 500 | } |
---|
| 501 | t.rwKeywordSet().define("UNIT", un); |
---|
[275] | 502 | // |
---|
[105] | 503 | MFrequency::Types mdr; |
---|
| 504 | if (!MFrequency::getType(mdr, rfrm)) { |
---|
| 505 | |
---|
| 506 | Int a,b;const uInt* c; |
---|
| 507 | const String* valid = MFrequency::allMyTypes(a, b, c); |
---|
| 508 | String pfix = "Please specify a legal frame type. Types are\n"; |
---|
| 509 | throw(AipsError(pfix+(*valid))); |
---|
| 510 | } else { |
---|
| 511 | t.rwKeywordSet().define("REFFRAME",rfrm); |
---|
| 512 | } |
---|
[275] | 513 | // |
---|
| 514 | MDoppler::Types dtype; |
---|
| 515 | dpl.upcase(); |
---|
| 516 | if (!MDoppler::getType(dtype, dpl)) { |
---|
| 517 | throw(AipsError("Doppler type unknown")); |
---|
| 518 | } else { |
---|
| 519 | t.rwKeywordSet().define("DOPPLER",dpl); |
---|
| 520 | } |
---|
[306] | 521 | // |
---|
| 522 | if (!MFrequency::getType(mdr, brfrm)) { |
---|
| 523 | Int a,b;const uInt* c; |
---|
| 524 | const String* valid = MFrequency::allMyTypes(a, b, c); |
---|
| 525 | String pfix = "Please specify a legal frame type. Types are\n"; |
---|
| 526 | throw(AipsError(pfix+(*valid))); |
---|
| 527 | } else { |
---|
| 528 | t.rwKeywordSet().define("BASEREFFRAME",brfrm); |
---|
| 529 | } |
---|
[105] | 530 | } |
---|
| 531 | |
---|
[286] | 532 | |
---|
[206] | 533 | std::vector<double> SDMemTable::getAbcissa(Int whichRow) const |
---|
| 534 | { |
---|
[286] | 535 | std::vector<double> abc(nChan()); |
---|
[206] | 536 | |
---|
[286] | 537 | // Get header units keyword |
---|
[206] | 538 | |
---|
[286] | 539 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
[105] | 540 | String sunit; |
---|
| 541 | t.keywordSet().get("UNIT",sunit); |
---|
| 542 | if (sunit == "") sunit = "pixel"; |
---|
| 543 | Unit u(sunit); |
---|
[286] | 544 | |
---|
| 545 | // Easy if just wanting pixels |
---|
| 546 | |
---|
| 547 | if (sunit==String("pixel")) { |
---|
| 548 | // assume channels/pixels |
---|
| 549 | std::vector<double>::iterator it; |
---|
| 550 | uInt i=0; |
---|
| 551 | for (it = abc.begin(); it != abc.end(); ++it) { |
---|
| 552 | (*it) = Double(i++); |
---|
| 553 | } |
---|
| 554 | // |
---|
| 555 | return abc; |
---|
[78] | 556 | } |
---|
| 557 | |
---|
[386] | 558 | // Continue with km/s or Hz. Get FreqIDs |
---|
[286] | 559 | |
---|
[347] | 560 | Vector<uInt> freqIDs; |
---|
| 561 | freqidCol_.get(whichRow, freqIDs); |
---|
| 562 | uInt freqID = freqIDs(IFSel_); |
---|
[386] | 563 | restfreqidCol_.get(whichRow, freqIDs); |
---|
| 564 | uInt restFreqID = freqIDs(IFSel_); |
---|
[286] | 565 | |
---|
| 566 | // Get SpectralCoordinate, set reference frame conversion, |
---|
| 567 | // velocity conversion, and rest freq state |
---|
| 568 | |
---|
[386] | 569 | SpectralCoordinate spc = getSpectralCoordinate(freqID, restFreqID, whichRow); |
---|
[286] | 570 | Vector<Double> pixel(nChan()); |
---|
| 571 | indgen(pixel); |
---|
| 572 | // |
---|
| 573 | if (u == Unit("km/s")) { |
---|
| 574 | Vector<Double> world; |
---|
| 575 | spc.pixelToVelocity(world,pixel); |
---|
| 576 | std::vector<double>::iterator it; |
---|
| 577 | uInt i = 0; |
---|
| 578 | for (it = abc.begin(); it != abc.end(); ++it) { |
---|
| 579 | (*it) = world[i]; |
---|
| 580 | i++; |
---|
| 581 | } |
---|
[39] | 582 | } else if (u == Unit("Hz")) { |
---|
[286] | 583 | |
---|
| 584 | // Set world axis units |
---|
| 585 | |
---|
[39] | 586 | Vector<String> wau(1); wau = u.getName(); |
---|
| 587 | spc.setWorldAxisUnits(wau); |
---|
[286] | 588 | // |
---|
[39] | 589 | std::vector<double>::iterator it; |
---|
| 590 | Double tmp; |
---|
| 591 | uInt i = 0; |
---|
[286] | 592 | for (it = abc.begin(); it != abc.end(); ++it) { |
---|
| 593 | spc.toWorld(tmp,pixel[i]); |
---|
[39] | 594 | (*it) = tmp; |
---|
| 595 | i++; |
---|
| 596 | } |
---|
| 597 | } |
---|
[286] | 598 | return abc; |
---|
[39] | 599 | } |
---|
| 600 | |
---|
[164] | 601 | std::string SDMemTable::getAbcissaString(Int whichRow) const |
---|
[105] | 602 | { |
---|
| 603 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
[286] | 604 | // |
---|
[105] | 605 | String sunit; |
---|
| 606 | t.keywordSet().get("UNIT",sunit); |
---|
| 607 | if (sunit == "") sunit = "pixel"; |
---|
| 608 | Unit u(sunit); |
---|
[286] | 609 | // |
---|
[347] | 610 | Vector<uInt> freqIDs; |
---|
| 611 | freqidCol_.get(whichRow, freqIDs); |
---|
[386] | 612 | uInt freqID = freqIDs(IFSel_); |
---|
| 613 | restfreqidCol_.get(whichRow, freqIDs); |
---|
| 614 | uInt restFreqID = freqIDs(IFSel_); |
---|
[286] | 615 | |
---|
| 616 | // Get SpectralCoordinate, with frame, velocity, rest freq state set |
---|
| 617 | |
---|
[386] | 618 | SpectralCoordinate spc = getSpectralCoordinate(freqID, restFreqID, whichRow); |
---|
[275] | 619 | // |
---|
[105] | 620 | String s = "Channel"; |
---|
| 621 | if (u == Unit("km/s")) { |
---|
| 622 | s = CoordinateUtil::axisLabel(spc,0,True,True,True); |
---|
| 623 | } else if (u == Unit("Hz")) { |
---|
| 624 | Vector<String> wau(1);wau = u.getName(); |
---|
| 625 | spc.setWorldAxisUnits(wau); |
---|
[286] | 626 | // |
---|
| 627 | s = CoordinateUtil::axisLabel(spc,0,True,True,False); |
---|
[105] | 628 | } |
---|
| 629 | return s; |
---|
| 630 | } |
---|
| 631 | |
---|
[206] | 632 | void SDMemTable::setSpectrum(std::vector<float> spectrum, int whichRow) |
---|
| 633 | { |
---|
[89] | 634 | Array<Float> arr; |
---|
[322] | 635 | specCol_.get(whichRow, arr); |
---|
[89] | 636 | if (spectrum.size() != arr.shape()(3)) { |
---|
| 637 | throw(AipsError("Attempting to set spectrum with incorrect length.")); |
---|
| 638 | } |
---|
| 639 | |
---|
[206] | 640 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr); |
---|
[89] | 641 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 642 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); |
---|
[89] | 643 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 644 | ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1); |
---|
[89] | 645 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
| 646 | |
---|
| 647 | std::vector<float>::iterator it = spectrum.begin(); |
---|
[206] | 648 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[89] | 649 | (*i) = Float(*it); |
---|
| 650 | it++; |
---|
| 651 | } |
---|
[322] | 652 | specCol_.put(whichRow, arr); |
---|
[89] | 653 | } |
---|
| 654 | |
---|
[206] | 655 | void SDMemTable::getSpectrum(Vector<Float>& spectrum, Int whichRow) const |
---|
| 656 | { |
---|
[21] | 657 | Array<Float> arr; |
---|
[322] | 658 | specCol_.get(whichRow, arr); |
---|
[418] | 659 | |
---|
| 660 | // Iterate and extract |
---|
| 661 | |
---|
[21] | 662 | spectrum.resize(arr.shape()(3)); |
---|
[206] | 663 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr); |
---|
[21] | 664 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 665 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); |
---|
[21] | 666 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 667 | ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1); |
---|
[21] | 668 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
[418] | 669 | // |
---|
[206] | 670 | ArrayAccessor<Float, Axis<asap::BeamAxis> > va(spectrum); |
---|
| 671 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[21] | 672 | (*va) = (*i); |
---|
| 673 | va++; |
---|
| 674 | } |
---|
| 675 | } |
---|
[418] | 676 | |
---|
| 677 | |
---|
[89] | 678 | /* |
---|
[68] | 679 | void SDMemTable::getMask(Vector<Bool>& mask, Int whichRow) const { |
---|
[21] | 680 | Array<uChar> arr; |
---|
[322] | 681 | flagsCol_.get(whichRow, arr); |
---|
[21] | 682 | mask.resize(arr.shape()(3)); |
---|
| 683 | |
---|
[206] | 684 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(arr); |
---|
[21] | 685 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 686 | ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0); |
---|
[21] | 687 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 688 | ArrayAccessor<uChar, Axis<asap::PolAxis> > aa2(aa1); |
---|
[21] | 689 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
| 690 | |
---|
| 691 | Bool useUserMask = ( chanMask_.size() == arr.shape()(3) ); |
---|
[89] | 692 | |
---|
[206] | 693 | ArrayAccessor<Bool, Axis<asap::BeamAxis> > va(mask); |
---|
[21] | 694 | std::vector<bool> tmp; |
---|
| 695 | tmp = chanMask_; // WHY the fxxx do I have to make a copy here. The |
---|
[89] | 696 | // iterator should work on chanMask_?? |
---|
[21] | 697 | std::vector<bool>::iterator miter; |
---|
| 698 | miter = tmp.begin(); |
---|
| 699 | |
---|
[206] | 700 | for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[21] | 701 | bool out =!static_cast<bool>(*i); |
---|
| 702 | if (useUserMask) { |
---|
| 703 | out = out && (*miter); |
---|
| 704 | miter++; |
---|
| 705 | } |
---|
| 706 | (*va) = out; |
---|
| 707 | va++; |
---|
[89] | 708 | } |
---|
[21] | 709 | } |
---|
[89] | 710 | */ |
---|
[439] | 711 | MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, Bool useSelection, |
---|
| 712 | Bool toStokes) const |
---|
[164] | 713 | { |
---|
[441] | 714 | |
---|
| 715 | // Get flags |
---|
| 716 | |
---|
| 717 | Array<uChar> farr; |
---|
| 718 | flagsCol_.get(whichRow, farr); |
---|
| 719 | |
---|
| 720 | // Get data and convert mask |
---|
| 721 | |
---|
[2] | 722 | Array<Float> arr; |
---|
[441] | 723 | Array<Bool> mask; |
---|
| 724 | uInt polSel = polSel_; |
---|
[439] | 725 | if (toStokes) { |
---|
| 726 | stokesCol_.get(whichRow, arr); |
---|
[441] | 727 | // |
---|
| 728 | Array<Bool> tMask(farr.shape()); |
---|
| 729 | convertArray(tMask, farr); |
---|
| 730 | mask = SDPolUtil::stokesMask (tMask, True); |
---|
| 731 | // |
---|
| 732 | IPosition shape = arr.shape(); |
---|
| 733 | uInt nPol = shape(asap::PolAxis); |
---|
| 734 | if (nPol<=2) polSel = 0; // XX and XX,YY -> I |
---|
[439] | 735 | } else { |
---|
| 736 | specCol_.get(whichRow, arr); |
---|
[441] | 737 | mask.resize(farr.shape()); |
---|
| 738 | convertArray(mask, farr); |
---|
[439] | 739 | } |
---|
[441] | 740 | // |
---|
[2] | 741 | MaskedArray<Float> marr; |
---|
[16] | 742 | if (useSelection) { |
---|
[206] | 743 | ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr); |
---|
[16] | 744 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 745 | ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); |
---|
[16] | 746 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 747 | ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1); |
---|
[441] | 748 | aa2.reset(aa2.begin(uInt(polSel)));// go to pol |
---|
[89] | 749 | |
---|
[441] | 750 | ArrayAccessor<Bool, Axis<asap::BeamAxis> > baa0(mask); |
---|
[16] | 751 | baa0.reset(baa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 752 | ArrayAccessor<Bool, Axis<asap::IFAxis> > baa1(baa0); |
---|
[16] | 753 | baa1.reset(baa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 754 | ArrayAccessor<Bool, Axis<asap::PolAxis> > baa2(baa1); |
---|
[441] | 755 | baa2.reset(baa2.begin(uInt(polSel)));// go to pol |
---|
[16] | 756 | |
---|
| 757 | Vector<Float> a(arr.shape()(3)); |
---|
[441] | 758 | Vector<Bool> b(mask.shape()(3)); |
---|
[206] | 759 | ArrayAccessor<Float, Axis<asap::BeamAxis> > a0(a); |
---|
| 760 | ArrayAccessor<Bool, Axis<asap::BeamAxis> > b0(b); |
---|
[16] | 761 | |
---|
[206] | 762 | ArrayAccessor<Bool, Axis<asap::ChanAxis> > j(baa2); |
---|
| 763 | for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); |
---|
| 764 | i != i.end(); ++i) { |
---|
[16] | 765 | (*a0) = (*i); |
---|
| 766 | (*b0) = !(*j); |
---|
| 767 | j++; |
---|
| 768 | a0++; |
---|
| 769 | b0++; |
---|
| 770 | } |
---|
| 771 | marr.setData(a,b); |
---|
| 772 | } else { |
---|
[441] | 773 | marr.setData(arr,!mask); |
---|
[16] | 774 | } |
---|
[2] | 775 | return marr; |
---|
| 776 | } |
---|
| 777 | |
---|
[206] | 778 | Float SDMemTable::getTsys(Int whichRow) const |
---|
| 779 | { |
---|
[2] | 780 | Array<Float> arr; |
---|
[322] | 781 | tsCol_.get(whichRow, arr); |
---|
[2] | 782 | Float out; |
---|
[418] | 783 | // |
---|
[2] | 784 | IPosition ip(arr.shape()); |
---|
[418] | 785 | ip(asap::BeamAxis) = beamSel_; |
---|
| 786 | ip(asap::IFAxis) = IFSel_; |
---|
| 787 | ip(asap::PolAxis) = polSel_; |
---|
| 788 | ip(asap::ChanAxis)=0; // First channel only |
---|
| 789 | // |
---|
[2] | 790 | out = arr(ip); |
---|
| 791 | return out; |
---|
| 792 | } |
---|
| 793 | |
---|
[281] | 794 | MDirection SDMemTable::getDirection(Int whichRow, Bool refBeam) const |
---|
[206] | 795 | { |
---|
[212] | 796 | MDirection::Types mdr = getDirectionReference(); |
---|
[206] | 797 | Array<Double> posit; |
---|
[322] | 798 | dirCol_.get(whichRow,posit); |
---|
[206] | 799 | Vector<Double> wpos(2); |
---|
[380] | 800 | Int rb; |
---|
| 801 | rbeamCol_.get(whichRow,rb); |
---|
[206] | 802 | wpos[0] = posit(IPosition(2,beamSel_,0)); |
---|
| 803 | wpos[1] = posit(IPosition(2,beamSel_,1)); |
---|
[380] | 804 | if (refBeam && rb > -1) { // use refBeam instead if it exists |
---|
| 805 | wpos[0] = posit(IPosition(2,rb,0)); |
---|
| 806 | wpos[1] = posit(IPosition(2,rb,1)); |
---|
| 807 | } |
---|
| 808 | |
---|
[206] | 809 | Quantum<Double> lon(wpos[0],Unit(String("rad"))); |
---|
| 810 | Quantum<Double> lat(wpos[1],Unit(String("rad"))); |
---|
[286] | 811 | return MDirection(lon, lat, mdr); |
---|
[206] | 812 | } |
---|
[39] | 813 | |
---|
[380] | 814 | MEpoch SDMemTable::getEpoch(Int whichRow) const |
---|
[206] | 815 | { |
---|
[286] | 816 | MEpoch::Types met = getTimeReference(); |
---|
| 817 | // |
---|
| 818 | Double obstime; |
---|
[322] | 819 | timeCol_.get(whichRow,obstime); |
---|
[286] | 820 | MVEpoch tm2(Quantum<Double>(obstime, Unit(String("d")))); |
---|
| 821 | return MEpoch(tm2, met); |
---|
| 822 | } |
---|
| 823 | |
---|
| 824 | MPosition SDMemTable::getAntennaPosition () const |
---|
| 825 | { |
---|
| 826 | Vector<Double> antpos; |
---|
| 827 | table_.keywordSet().get("AntennaPosition", antpos); |
---|
| 828 | MVPosition mvpos(antpos(0),antpos(1),antpos(2)); |
---|
| 829 | return MPosition(mvpos); |
---|
| 830 | } |
---|
| 831 | |
---|
| 832 | |
---|
[347] | 833 | SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID) const |
---|
[286] | 834 | { |
---|
[206] | 835 | |
---|
[39] | 836 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
[347] | 837 | if (freqID> t.nrow() ) { |
---|
| 838 | throw(AipsError("SDMemTable::getSpectralCoordinate - freqID out of range")); |
---|
[39] | 839 | } |
---|
[89] | 840 | |
---|
[39] | 841 | Double rp,rv,inc; |
---|
| 842 | String rf; |
---|
| 843 | ROScalarColumn<Double> rpc(t, "REFPIX"); |
---|
| 844 | ROScalarColumn<Double> rvc(t, "REFVAL"); |
---|
| 845 | ROScalarColumn<Double> incc(t, "INCREMENT"); |
---|
[105] | 846 | t.keywordSet().get("BASEREFFRAME",rf); |
---|
[89] | 847 | |
---|
[286] | 848 | // Create SpectralCoordinate (units Hz) |
---|
| 849 | |
---|
[39] | 850 | MFrequency::Types mft; |
---|
| 851 | if (!MFrequency::getType(mft, rf)) { |
---|
| 852 | cerr << "Frequency type unknown assuming TOPO" << endl; |
---|
[89] | 853 | mft = MFrequency::TOPO; |
---|
| 854 | } |
---|
[347] | 855 | rpc.get(freqID, rp); |
---|
| 856 | rvc.get(freqID, rv); |
---|
| 857 | incc.get(freqID, inc); |
---|
[286] | 858 | // |
---|
[39] | 859 | SpectralCoordinate spec(mft,rv,inc,rp); |
---|
[286] | 860 | // |
---|
| 861 | return spec; |
---|
| 862 | } |
---|
| 863 | |
---|
| 864 | |
---|
[386] | 865 | SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID, uInt restFreqID, |
---|
| 866 | uInt whichRow) const |
---|
[286] | 867 | { |
---|
[385] | 868 | |
---|
[286] | 869 | // Create basic SC |
---|
| 870 | |
---|
[347] | 871 | SpectralCoordinate spec = getSpectralCoordinate (freqID); |
---|
[286] | 872 | // |
---|
| 873 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
| 874 | |
---|
[386] | 875 | // Set rest frequency |
---|
[286] | 876 | |
---|
[386] | 877 | Vector<Double> restFreqIDs; |
---|
| 878 | t.keywordSet().get("RESTFREQS",restFreqIDs); |
---|
| 879 | if (restFreqID < restFreqIDs.nelements()) { // SHould always be true |
---|
| 880 | spec.setRestFrequency(restFreqIDs(restFreqID),True); |
---|
[286] | 881 | } |
---|
| 882 | |
---|
| 883 | // Set up frame conversion layer |
---|
| 884 | |
---|
| 885 | String frm; |
---|
| 886 | t.keywordSet().get("REFFRAME",frm); |
---|
| 887 | if (frm == "") frm = "TOPO"; |
---|
| 888 | MFrequency::Types mtype; |
---|
| 889 | if (!MFrequency::getType(mtype, frm)) { |
---|
[347] | 890 | cerr << "Frequency type unknown assuming TOPO" << endl; // SHould never happen |
---|
[286] | 891 | mtype = MFrequency::TOPO; |
---|
| 892 | } |
---|
| 893 | |
---|
| 894 | // Set reference frame conversion (requires row) |
---|
| 895 | |
---|
[401] | 896 | MDirection dir = getDirection(whichRow); |
---|
[286] | 897 | MEpoch epoch = getEpoch(whichRow); |
---|
| 898 | MPosition pos = getAntennaPosition(); |
---|
[401] | 899 | // |
---|
| 900 | if (!spec.setReferenceConversion(mtype,epoch,pos,dir)) { |
---|
[286] | 901 | throw(AipsError("Couldn't convert frequency frame.")); |
---|
| 902 | } |
---|
| 903 | |
---|
| 904 | // Now velocity conversion if appropriate |
---|
| 905 | |
---|
| 906 | String unitStr; |
---|
| 907 | t.keywordSet().get("UNIT",unitStr); |
---|
| 908 | // |
---|
| 909 | String dpl; |
---|
| 910 | t.keywordSet().get("DOPPLER",dpl); |
---|
| 911 | MDoppler::Types dtype; |
---|
| 912 | MDoppler::getType(dtype, dpl); |
---|
| 913 | |
---|
| 914 | // Only set velocity unit if non-blank and non-Hz |
---|
| 915 | |
---|
| 916 | if (!unitStr.empty()) { |
---|
| 917 | Unit unitU(unitStr); |
---|
| 918 | if (unitU==Unit("Hz")) { |
---|
| 919 | } else { |
---|
| 920 | spec.setVelocity(unitStr, dtype); |
---|
| 921 | } |
---|
| 922 | } |
---|
| 923 | // |
---|
[39] | 924 | return spec; |
---|
| 925 | } |
---|
| 926 | |
---|
[286] | 927 | |
---|
[89] | 928 | Bool SDMemTable::setCoordinate(const SpectralCoordinate& speccord, |
---|
[347] | 929 | uInt freqID) { |
---|
[50] | 930 | Table t = table_.rwKeywordSet().asTable("FREQUENCIES"); |
---|
[347] | 931 | if (freqID > t.nrow() ) { |
---|
[89] | 932 | throw(AipsError("SDMemTable::setCoordinate - coord no out of range")); |
---|
[50] | 933 | } |
---|
| 934 | ScalarColumn<Double> rpc(t, "REFPIX"); |
---|
| 935 | ScalarColumn<Double> rvc(t, "REFVAL"); |
---|
| 936 | ScalarColumn<Double> incc(t, "INCREMENT"); |
---|
[89] | 937 | |
---|
[347] | 938 | rpc.put(freqID, speccord.referencePixel()[0]); |
---|
| 939 | rvc.put(freqID, speccord.referenceValue()[0]); |
---|
| 940 | incc.put(freqID, speccord.increment()[0]); |
---|
[50] | 941 | |
---|
| 942 | return True; |
---|
| 943 | } |
---|
| 944 | |
---|
[89] | 945 | Int SDMemTable::nCoordinates() const |
---|
| 946 | { |
---|
| 947 | return table_.keywordSet().asTable("FREQUENCIES").nrow(); |
---|
| 948 | } |
---|
[50] | 949 | |
---|
[89] | 950 | |
---|
[251] | 951 | std::vector<double> SDMemTable::getRestFreqs() const |
---|
| 952 | { |
---|
| 953 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
| 954 | Vector<Double> tvec; |
---|
| 955 | t.keywordSet().get("RESTFREQS",tvec); |
---|
| 956 | std::vector<double> stlout; |
---|
| 957 | tvec.tovector(stlout); |
---|
| 958 | return stlout; |
---|
| 959 | } |
---|
| 960 | |
---|
[206] | 961 | bool SDMemTable::putSDFreqTable(const SDFrequencyTable& sdft) |
---|
| 962 | { |
---|
[39] | 963 | TableDesc td("", "1", TableDesc::Scratch); |
---|
| 964 | td.addColumn(ScalarColumnDesc<Double>("REFPIX")); |
---|
| 965 | td.addColumn(ScalarColumnDesc<Double>("REFVAL")); |
---|
| 966 | td.addColumn(ScalarColumnDesc<Double>("INCREMENT")); |
---|
| 967 | SetupNewTable aNewTab("freqs", td, Table::New); |
---|
| 968 | Table aTable (aNewTab, Table::Memory, sdft.length()); |
---|
| 969 | ScalarColumn<Double> sc0(aTable, "REFPIX"); |
---|
| 970 | ScalarColumn<Double> sc1(aTable, "REFVAL"); |
---|
| 971 | ScalarColumn<Double> sc2(aTable, "INCREMENT"); |
---|
| 972 | for (uInt i=0; i < sdft.length(); ++i) { |
---|
| 973 | sc0.put(i,sdft.referencePixel(i)); |
---|
| 974 | sc1.put(i,sdft.referenceValue(i)); |
---|
| 975 | sc2.put(i,sdft.increment(i)); |
---|
| 976 | } |
---|
[105] | 977 | String rf = sdft.refFrame(); |
---|
| 978 | if (rf.contains("TOPO")) rf = "TOPO"; |
---|
| 979 | |
---|
| 980 | aTable.rwKeywordSet().define("BASEREFFRAME", rf); |
---|
| 981 | aTable.rwKeywordSet().define("REFFRAME", rf); |
---|
[39] | 982 | aTable.rwKeywordSet().define("EQUINOX", sdft.equinox()); |
---|
[105] | 983 | aTable.rwKeywordSet().define("UNIT", String("")); |
---|
| 984 | aTable.rwKeywordSet().define("DOPPLER", String("RADIO")); |
---|
[89] | 985 | Vector<Double> rfvec; |
---|
[206] | 986 | String rfunit; |
---|
| 987 | sdft.restFrequencies(rfvec,rfunit); |
---|
| 988 | Quantum<Vector<Double> > q(rfvec, rfunit); |
---|
| 989 | rfvec.resize(); |
---|
| 990 | rfvec = q.getValue("Hz"); |
---|
[89] | 991 | aTable.rwKeywordSet().define("RESTFREQS", rfvec); |
---|
[39] | 992 | table_.rwKeywordSet().defineTable ("FREQUENCIES", aTable); |
---|
| 993 | return True; |
---|
| 994 | } |
---|
| 995 | |
---|
[206] | 996 | SDFrequencyTable SDMemTable::getSDFreqTable() const |
---|
| 997 | { |
---|
[251] | 998 | const Table& t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
[39] | 999 | SDFrequencyTable sdft; |
---|
[306] | 1000 | |
---|
| 1001 | // Add refpix/refval/incr. What are the units ? Hz I suppose |
---|
| 1002 | // but it's nowhere described... |
---|
| 1003 | |
---|
| 1004 | Vector<Double> refPix, refVal, incr; |
---|
| 1005 | ScalarColumn<Double> refPixCol(t, "REFPIX"); |
---|
| 1006 | ScalarColumn<Double> refValCol(t, "REFVAL"); |
---|
| 1007 | ScalarColumn<Double> incrCol(t, "INCREMENT"); |
---|
| 1008 | refPix = refPixCol.getColumn(); |
---|
| 1009 | refVal = refValCol.getColumn(); |
---|
| 1010 | incr = incrCol.getColumn(); |
---|
| 1011 | // |
---|
| 1012 | uInt n = refPix.nelements(); |
---|
| 1013 | for (uInt i=0; i<n; i++) { |
---|
| 1014 | sdft.addFrequency(refPix[i], refVal[i], incr[i]); |
---|
| 1015 | } |
---|
| 1016 | |
---|
| 1017 | // Frequency reference frame. I don't know if this |
---|
| 1018 | // is the correct frame. It might be 'REFFRAME' |
---|
| 1019 | // rather than 'BASEREFFRAME' ? |
---|
| 1020 | |
---|
| 1021 | String baseFrame; |
---|
| 1022 | t.keywordSet().get("BASEREFFRAME",baseFrame); |
---|
| 1023 | sdft.setRefFrame(baseFrame); |
---|
| 1024 | |
---|
| 1025 | // Equinox |
---|
| 1026 | |
---|
| 1027 | Float equinox; |
---|
| 1028 | t.keywordSet().get("EQUINOX", equinox); |
---|
| 1029 | sdft.setEquinox(equinox); |
---|
| 1030 | |
---|
| 1031 | // Rest Frequency |
---|
| 1032 | |
---|
| 1033 | Vector<Double> restFreqs; |
---|
| 1034 | t.keywordSet().get("RESTFREQS", restFreqs); |
---|
| 1035 | for (uInt i=0; i<restFreqs.nelements(); i++) { |
---|
| 1036 | sdft.addRestFrequency(restFreqs[i]); |
---|
| 1037 | } |
---|
| 1038 | sdft.setRestFrequencyUnit(String("Hz")); |
---|
| 1039 | // |
---|
[39] | 1040 | return sdft; |
---|
| 1041 | } |
---|
| 1042 | |
---|
[206] | 1043 | bool SDMemTable::putSDContainer(const SDContainer& sdc) |
---|
| 1044 | { |
---|
[2] | 1045 | uInt rno = table_.nrow(); |
---|
| 1046 | table_.addRow(); |
---|
[386] | 1047 | // |
---|
[322] | 1048 | timeCol_.put(rno, sdc.timestamp); |
---|
| 1049 | srcnCol_.put(rno, sdc.sourcename); |
---|
| 1050 | fldnCol_.put(rno, sdc.fieldname); |
---|
| 1051 | specCol_.put(rno, sdc.getSpectrum()); |
---|
| 1052 | flagsCol_.put(rno, sdc.getFlags()); |
---|
| 1053 | tsCol_.put(rno, sdc.getTsys()); |
---|
| 1054 | scanCol_.put(rno, sdc.scanid); |
---|
| 1055 | integrCol_.put(rno, sdc.interval); |
---|
| 1056 | freqidCol_.put(rno, sdc.getFreqMap()); |
---|
[386] | 1057 | restfreqidCol_.put(rno, sdc.getRestFreqMap()); |
---|
[322] | 1058 | dirCol_.put(rno, sdc.getDirection()); |
---|
| 1059 | rbeamCol_.put(rno, sdc.refbeam); |
---|
| 1060 | tcalCol_.put(rno, sdc.tcal); |
---|
| 1061 | tcaltCol_.put(rno, sdc.tcaltime); |
---|
| 1062 | azCol_.put(rno, sdc.azimuth); |
---|
| 1063 | elCol_.put(rno, sdc.elevation); |
---|
| 1064 | paraCol_.put(rno, sdc.parangle); |
---|
| 1065 | histCol_.put(rno, sdc.getHistory()); |
---|
[386] | 1066 | // |
---|
[2] | 1067 | return true; |
---|
| 1068 | } |
---|
[18] | 1069 | |
---|
[206] | 1070 | SDContainer SDMemTable::getSDContainer(uInt whichRow) const |
---|
| 1071 | { |
---|
[21] | 1072 | SDContainer sdc(nBeam(),nIF(),nPol(),nChan()); |
---|
[322] | 1073 | timeCol_.get(whichRow, sdc.timestamp); |
---|
| 1074 | srcnCol_.get(whichRow, sdc.sourcename); |
---|
| 1075 | integrCol_.get(whichRow, sdc.interval); |
---|
| 1076 | scanCol_.get(whichRow, sdc.scanid); |
---|
| 1077 | fldnCol_.get(whichRow, sdc.fieldname); |
---|
| 1078 | rbeamCol_.get(whichRow, sdc.refbeam); |
---|
| 1079 | azCol_.get(whichRow, sdc.azimuth); |
---|
| 1080 | elCol_.get(whichRow, sdc.elevation); |
---|
| 1081 | paraCol_.get(whichRow, sdc.parangle); |
---|
[105] | 1082 | Vector<Float> tc; |
---|
[322] | 1083 | tcalCol_.get(whichRow, tc); |
---|
[105] | 1084 | sdc.tcal[0] = tc[0];sdc.tcal[1] = tc[1]; |
---|
[322] | 1085 | tcaltCol_.get(whichRow, sdc.tcaltime); |
---|
[386] | 1086 | // |
---|
[21] | 1087 | Array<Float> spectrum; |
---|
| 1088 | Array<Float> tsys; |
---|
| 1089 | Array<uChar> flagtrum; |
---|
[39] | 1090 | Vector<uInt> fmap; |
---|
[78] | 1091 | Array<Double> direction; |
---|
[206] | 1092 | Vector<String> histo; |
---|
[386] | 1093 | // |
---|
[322] | 1094 | specCol_.get(whichRow, spectrum); |
---|
[21] | 1095 | sdc.putSpectrum(spectrum); |
---|
[322] | 1096 | flagsCol_.get(whichRow, flagtrum); |
---|
[21] | 1097 | sdc.putFlags(flagtrum); |
---|
[322] | 1098 | tsCol_.get(whichRow, tsys); |
---|
[21] | 1099 | sdc.putTsys(tsys); |
---|
[322] | 1100 | freqidCol_.get(whichRow, fmap); |
---|
[39] | 1101 | sdc.putFreqMap(fmap); |
---|
[386] | 1102 | restfreqidCol_.get(whichRow, fmap); |
---|
| 1103 | sdc.putRestFreqMap(fmap); |
---|
[322] | 1104 | dirCol_.get(whichRow, direction); |
---|
[78] | 1105 | sdc.putDirection(direction); |
---|
[322] | 1106 | histCol_.get(whichRow, histo); |
---|
[206] | 1107 | sdc.putHistory(histo); |
---|
[21] | 1108 | return sdc; |
---|
| 1109 | } |
---|
[78] | 1110 | |
---|
[206] | 1111 | bool SDMemTable::putSDHeader(const SDHeader& sdh) |
---|
| 1112 | { |
---|
[18] | 1113 | table_.rwKeywordSet().define("nIF", sdh.nif); |
---|
| 1114 | table_.rwKeywordSet().define("nBeam", sdh.nbeam); |
---|
| 1115 | table_.rwKeywordSet().define("nPol", sdh.npol); |
---|
| 1116 | table_.rwKeywordSet().define("nChan", sdh.nchan); |
---|
| 1117 | table_.rwKeywordSet().define("Observer", sdh.observer); |
---|
| 1118 | table_.rwKeywordSet().define("Project", sdh.project); |
---|
| 1119 | table_.rwKeywordSet().define("Obstype", sdh.obstype); |
---|
| 1120 | table_.rwKeywordSet().define("AntennaName", sdh.antennaname); |
---|
| 1121 | table_.rwKeywordSet().define("AntennaPosition", sdh.antennaposition); |
---|
| 1122 | table_.rwKeywordSet().define("Equinox", sdh.equinox); |
---|
| 1123 | table_.rwKeywordSet().define("FreqRefFrame", sdh.freqref); |
---|
| 1124 | table_.rwKeywordSet().define("FreqRefVal", sdh.reffreq); |
---|
| 1125 | table_.rwKeywordSet().define("Bandwidth", sdh.bandwidth); |
---|
| 1126 | table_.rwKeywordSet().define("UTC", sdh.utc); |
---|
[206] | 1127 | table_.rwKeywordSet().define("FluxUnit", sdh.fluxunit); |
---|
| 1128 | table_.rwKeywordSet().define("Epoch", sdh.epoch); |
---|
[18] | 1129 | return true; |
---|
[50] | 1130 | } |
---|
[21] | 1131 | |
---|
[206] | 1132 | SDHeader SDMemTable::getSDHeader() const |
---|
| 1133 | { |
---|
[21] | 1134 | SDHeader sdh; |
---|
| 1135 | table_.keywordSet().get("nBeam",sdh.nbeam); |
---|
| 1136 | table_.keywordSet().get("nIF",sdh.nif); |
---|
| 1137 | table_.keywordSet().get("nPol",sdh.npol); |
---|
| 1138 | table_.keywordSet().get("nChan",sdh.nchan); |
---|
| 1139 | table_.keywordSet().get("Observer", sdh.observer); |
---|
| 1140 | table_.keywordSet().get("Project", sdh.project); |
---|
| 1141 | table_.keywordSet().get("Obstype", sdh.obstype); |
---|
| 1142 | table_.keywordSet().get("AntennaName", sdh.antennaname); |
---|
| 1143 | table_.keywordSet().get("AntennaPosition", sdh.antennaposition); |
---|
| 1144 | table_.keywordSet().get("Equinox", sdh.equinox); |
---|
| 1145 | table_.keywordSet().get("FreqRefFrame", sdh.freqref); |
---|
| 1146 | table_.keywordSet().get("FreqRefVal", sdh.reffreq); |
---|
| 1147 | table_.keywordSet().get("Bandwidth", sdh.bandwidth); |
---|
| 1148 | table_.keywordSet().get("UTC", sdh.utc); |
---|
[206] | 1149 | table_.keywordSet().get("FluxUnit", sdh.fluxunit); |
---|
| 1150 | table_.keywordSet().get("Epoch", sdh.epoch); |
---|
[21] | 1151 | return sdh; |
---|
[18] | 1152 | } |
---|
[206] | 1153 | void SDMemTable::makePersistent(const std::string& filename) |
---|
| 1154 | { |
---|
[2] | 1155 | table_.deepCopy(filename,Table::New); |
---|
| 1156 | } |
---|
| 1157 | |
---|
[89] | 1158 | Int SDMemTable::nScan() const { |
---|
[50] | 1159 | Int n = 0; |
---|
| 1160 | Int previous = -1;Int current=0; |
---|
[322] | 1161 | for (uInt i=0; i< scanCol_.nrow();i++) { |
---|
| 1162 | scanCol_.getScalar(i,current); |
---|
[50] | 1163 | if (previous != current) { |
---|
[89] | 1164 | previous = current; |
---|
[50] | 1165 | n++; |
---|
| 1166 | } |
---|
| 1167 | } |
---|
| 1168 | return n; |
---|
| 1169 | } |
---|
| 1170 | |
---|
[260] | 1171 | String SDMemTable::formatSec(Double x) const |
---|
[206] | 1172 | { |
---|
[105] | 1173 | Double xcop = x; |
---|
| 1174 | MVTime mvt(xcop/24./3600.); // make days |
---|
[365] | 1175 | |
---|
[105] | 1176 | if (x < 59.95) |
---|
[281] | 1177 | return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s"; |
---|
| 1178 | else if (x < 3599.95) |
---|
| 1179 | return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_H,7)+" "; |
---|
| 1180 | else { |
---|
| 1181 | ostringstream oss; |
---|
| 1182 | oss << setw(2) << std::right << setprecision(1) << mvt.hour(); |
---|
| 1183 | oss << ":" << mvt.string(MVTime::TIME_CLEAN_NO_H,7) << " "; |
---|
| 1184 | return String(oss); |
---|
| 1185 | } |
---|
[105] | 1186 | }; |
---|
| 1187 | |
---|
[281] | 1188 | String SDMemTable::formatDirection(const MDirection& md) const |
---|
| 1189 | { |
---|
| 1190 | Vector<Double> t = md.getAngle(Unit(String("rad"))).getValue(); |
---|
| 1191 | Int prec = 7; |
---|
| 1192 | |
---|
| 1193 | MVAngle mvLon(t[0]); |
---|
| 1194 | String sLon = mvLon.string(MVAngle::TIME,prec); |
---|
| 1195 | MVAngle mvLat(t[1]); |
---|
| 1196 | String sLat = mvLat.string(MVAngle::ANGLE+MVAngle::DIG2,prec); |
---|
[380] | 1197 | return sLon + String(" ") + sLat; |
---|
[281] | 1198 | } |
---|
| 1199 | |
---|
| 1200 | |
---|
[206] | 1201 | std::string SDMemTable::getFluxUnit() const |
---|
| 1202 | { |
---|
| 1203 | String tmp; |
---|
| 1204 | table_.keywordSet().get("FluxUnit", tmp); |
---|
| 1205 | return tmp; |
---|
| 1206 | } |
---|
| 1207 | |
---|
[218] | 1208 | void SDMemTable::setFluxUnit(const std::string& unit) |
---|
| 1209 | { |
---|
| 1210 | String tmp(unit); |
---|
| 1211 | Unit tU(tmp); |
---|
| 1212 | if (tU==Unit("K") || tU==Unit("Jy")) { |
---|
| 1213 | table_.rwKeywordSet().define(String("FluxUnit"), tmp); |
---|
| 1214 | } else { |
---|
| 1215 | throw AipsError("Illegal unit - must be compatible with Jy or K"); |
---|
| 1216 | } |
---|
| 1217 | } |
---|
| 1218 | |
---|
[275] | 1219 | |
---|
[236] | 1220 | void SDMemTable::setInstrument(const std::string& name) |
---|
| 1221 | { |
---|
| 1222 | Bool throwIt = True; |
---|
| 1223 | Instrument ins = convertInstrument (name, throwIt); |
---|
| 1224 | String nameU(name); |
---|
| 1225 | nameU.upcase(); |
---|
| 1226 | table_.rwKeywordSet().define(String("AntennaName"), nameU); |
---|
| 1227 | } |
---|
| 1228 | |
---|
[380] | 1229 | std::string SDMemTable::summary(bool verbose) const { |
---|
[281] | 1230 | |
---|
[385] | 1231 | // Format header info |
---|
| 1232 | |
---|
[89] | 1233 | ostringstream oss; |
---|
| 1234 | oss << endl; |
---|
[380] | 1235 | oss << "--------------------------------------------------------------------------------" << endl; |
---|
[89] | 1236 | oss << " Scan Table Summary" << endl; |
---|
[380] | 1237 | oss << "--------------------------------------------------------------------------------" << endl; |
---|
[89] | 1238 | oss.flags(std::ios_base::left); |
---|
| 1239 | oss << setw(15) << "Beams:" << setw(4) << nBeam() << endl |
---|
| 1240 | << setw(15) << "IFs:" << setw(4) << nIF() << endl |
---|
| 1241 | << setw(15) << "Polarisations:" << setw(4) << nPol() << endl |
---|
| 1242 | << setw(15) << "Channels:" << setw(4) << nChan() << endl; |
---|
| 1243 | oss << endl; |
---|
| 1244 | String tmp; |
---|
| 1245 | table_.keywordSet().get("Observer", tmp); |
---|
| 1246 | oss << setw(15) << "Observer:" << tmp << endl; |
---|
[281] | 1247 | oss << setw(15) << "Obs Date:" << getTime(-1,True) << endl; |
---|
[89] | 1248 | table_.keywordSet().get("Project", tmp); |
---|
| 1249 | oss << setw(15) << "Project:" << tmp << endl; |
---|
| 1250 | table_.keywordSet().get("Obstype", tmp); |
---|
| 1251 | oss << setw(15) << "Obs. Type:" << tmp << endl; |
---|
| 1252 | table_.keywordSet().get("AntennaName", tmp); |
---|
| 1253 | oss << setw(15) << "Antenna Name:" << tmp << endl; |
---|
[206] | 1254 | table_.keywordSet().get("FluxUnit", tmp); |
---|
| 1255 | oss << setw(15) << "Flux Unit:" << tmp << endl; |
---|
[260] | 1256 | Table t = table_.keywordSet().asTable("FREQUENCIES"); |
---|
[105] | 1257 | Vector<Double> vec; |
---|
| 1258 | t.keywordSet().get("RESTFREQS",vec); |
---|
| 1259 | oss << setw(15) << "Rest Freqs:"; |
---|
| 1260 | if (vec.nelements() > 0) { |
---|
| 1261 | oss << setprecision(0) << vec << " [Hz]" << endl; |
---|
| 1262 | } else { |
---|
| 1263 | oss << "None set" << endl; |
---|
| 1264 | } |
---|
[158] | 1265 | oss << setw(15) << "Abcissa:" << getAbcissaString() << endl; |
---|
[105] | 1266 | oss << setw(15) << "Cursor:" << "Beam[" << getBeam() << "] " |
---|
| 1267 | << "IF[" << getIF() << "] " << "Pol[" << getPol() << "]" << endl; |
---|
[89] | 1268 | oss << endl; |
---|
[365] | 1269 | // |
---|
[385] | 1270 | String dirtype ="Position ("+ MDirection::showType(getDirectionReference()) + ")"; |
---|
[380] | 1271 | oss << setw(5) << "Scan" |
---|
[281] | 1272 | << setw(15) << "Source" |
---|
[380] | 1273 | << setw(24) << dirtype |
---|
[281] | 1274 | << setw(10) << "Time" |
---|
[365] | 1275 | << setw(18) << "Integration" |
---|
[380] | 1276 | << setw(7) << "FreqIDs" << endl; |
---|
| 1277 | oss << "--------------------------------------------------------------------------------" << endl; |
---|
[281] | 1278 | |
---|
[385] | 1279 | // Generate list of scan start and end integrations |
---|
| 1280 | |
---|
| 1281 | Vector<Int> scanIDs = scanCol_.getColumn(); |
---|
| 1282 | Vector<uInt> startInt, endInt; |
---|
| 1283 | mathutil::scanBoundaries(startInt, endInt, scanIDs); |
---|
[365] | 1284 | // |
---|
[385] | 1285 | const uInt nScans = startInt.nelements(); |
---|
[365] | 1286 | String name; |
---|
| 1287 | Vector<uInt> freqIDs, listFQ; |
---|
[385] | 1288 | uInt nInt; |
---|
[365] | 1289 | // |
---|
[385] | 1290 | for (uInt i=0; i<nScans; i++) { |
---|
[367] | 1291 | |
---|
[385] | 1292 | // Get things from first integration of scan |
---|
[367] | 1293 | |
---|
[385] | 1294 | String time = getTime(startInt(i),False); |
---|
| 1295 | String tInt = formatSec(Double(getInterval(startInt(i)))); |
---|
| 1296 | String posit = formatDirection(getDirection(startInt(i),True)); |
---|
| 1297 | srcnCol_.getScalar(startInt(i),name); |
---|
| 1298 | |
---|
| 1299 | // Find all the FreqIDs in this scan |
---|
| 1300 | |
---|
| 1301 | listFQ.resize(0); |
---|
| 1302 | for (uInt j=startInt(i); j<endInt(i)+1; j++) { |
---|
| 1303 | freqidCol_.get(j, freqIDs); |
---|
| 1304 | for (uInt k=0; k<freqIDs.nelements(); k++) { |
---|
| 1305 | mathutil::addEntry(listFQ, freqIDs(k)); |
---|
| 1306 | } |
---|
[367] | 1307 | } |
---|
[385] | 1308 | // |
---|
| 1309 | nInt = endInt(i) - startInt(i) + 1; |
---|
| 1310 | oss << setw(3) << std::right << i << std::left << setw(2) << " " |
---|
[365] | 1311 | << setw(15) << name |
---|
[380] | 1312 | << setw(24) << posit |
---|
[385] | 1313 | << setw(10) << time |
---|
[380] | 1314 | << setw(3) << std::right << nInt << setw(3) << " x " << std::left |
---|
[385] | 1315 | << setw(6) << tInt |
---|
[365] | 1316 | << " " << listFQ << endl; |
---|
[2] | 1317 | } |
---|
[89] | 1318 | oss << endl; |
---|
[385] | 1319 | oss << "Table contains " << table_.nrow() << " integration(s) in " << nScans << " scan(s)." << endl; |
---|
[321] | 1320 | |
---|
| 1321 | // Frequency Table |
---|
[385] | 1322 | |
---|
[380] | 1323 | if (verbose) { |
---|
| 1324 | std::vector<string> info = getCoordInfo(); |
---|
| 1325 | SDFrequencyTable sdft = getSDFreqTable(); |
---|
| 1326 | oss << endl << endl; |
---|
| 1327 | oss << "FreqID Frame RefFreq(Hz) RefPix Increment(Hz)" << endl; |
---|
| 1328 | oss << "--------------------------------------------------------------------------------" << endl; |
---|
| 1329 | for (uInt i=0; i<sdft.length(); i++) { |
---|
| 1330 | oss << setw(8) << i << setw(8) |
---|
| 1331 | << info[3] << setw(16) << setprecision(8) |
---|
| 1332 | << sdft.referenceValue(i) << setw(10) |
---|
| 1333 | << sdft.referencePixel(i) << setw(12) |
---|
| 1334 | << sdft.increment(i) << endl; |
---|
| 1335 | } |
---|
| 1336 | oss << "--------------------------------------------------------------------------------" << endl; |
---|
[321] | 1337 | } |
---|
[89] | 1338 | return String(oss); |
---|
[2] | 1339 | } |
---|
[18] | 1340 | |
---|
[206] | 1341 | Int SDMemTable::nBeam() const |
---|
| 1342 | { |
---|
[18] | 1343 | Int n; |
---|
| 1344 | table_.keywordSet().get("nBeam",n); |
---|
| 1345 | return n; |
---|
| 1346 | } |
---|
| 1347 | Int SDMemTable::nIF() const { |
---|
| 1348 | Int n; |
---|
| 1349 | table_.keywordSet().get("nIF",n); |
---|
| 1350 | return n; |
---|
| 1351 | } |
---|
| 1352 | Int SDMemTable::nPol() const { |
---|
| 1353 | Int n; |
---|
| 1354 | table_.keywordSet().get("nPol",n); |
---|
| 1355 | return n; |
---|
| 1356 | } |
---|
| 1357 | Int SDMemTable::nChan() const { |
---|
| 1358 | Int n; |
---|
| 1359 | table_.keywordSet().get("nChan",n); |
---|
| 1360 | return n; |
---|
| 1361 | } |
---|
[206] | 1362 | bool SDMemTable::appendHistory(const std::string& hist, int whichRow) |
---|
| 1363 | { |
---|
| 1364 | Vector<String> history; |
---|
[322] | 1365 | histCol_.get(whichRow, history); |
---|
[206] | 1366 | history.resize(history.nelements()+1,True); |
---|
| 1367 | history[history.nelements()-1] = hist; |
---|
[322] | 1368 | histCol_.put(whichRow, history); |
---|
[206] | 1369 | } |
---|
| 1370 | |
---|
| 1371 | std::vector<std::string> SDMemTable::history(int whichRow) const |
---|
| 1372 | { |
---|
| 1373 | Vector<String> history; |
---|
[322] | 1374 | histCol_.get(whichRow, history); |
---|
[206] | 1375 | std::vector<std::string> stlout; |
---|
| 1376 | // there is no Array<String>.tovector(std::vector<std::string>), so |
---|
| 1377 | // do it by hand |
---|
| 1378 | for (uInt i=0; i<history.nelements(); ++i) { |
---|
| 1379 | stlout.push_back(history[i]); |
---|
| 1380 | } |
---|
| 1381 | return stlout; |
---|
| 1382 | } |
---|
[16] | 1383 | /* |
---|
[18] | 1384 | void SDMemTable::maskChannels(const std::vector<Int>& whichChans ) { |
---|
[89] | 1385 | |
---|
[16] | 1386 | std::vector<int>::iterator it; |
---|
[206] | 1387 | ArrayAccessor<uChar, Axis<asap::PolAxis> > j(flags_); |
---|
[16] | 1388 | for (it = whichChans.begin(); it != whichChans.end(); it++) { |
---|
| 1389 | j.reset(j.begin(uInt(*it))); |
---|
[206] | 1390 | for (ArrayAccessor<uChar, Axis<asap::BeamAxis> > i(j); i != i.end(); ++i) { |
---|
| 1391 | for (ArrayAccessor<uChar, Axis<asap::IFAxis> > ii(i); ii != ii.end(); ++ii) { |
---|
| 1392 | for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > iii(ii); |
---|
[89] | 1393 | iii != iii.end(); ++iii) { |
---|
| 1394 | (*iii) = |
---|
| 1395 | } |
---|
[16] | 1396 | } |
---|
| 1397 | } |
---|
| 1398 | } |
---|
[89] | 1399 | |
---|
[16] | 1400 | } |
---|
| 1401 | */ |
---|
[206] | 1402 | void SDMemTable::flag(int whichRow) |
---|
| 1403 | { |
---|
[89] | 1404 | Array<uChar> arr; |
---|
[322] | 1405 | flagsCol_.get(whichRow, arr); |
---|
[89] | 1406 | |
---|
[206] | 1407 | ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(arr); |
---|
[89] | 1408 | aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam |
---|
[206] | 1409 | ArrayAccessor<uChar, Axis<asap::IFAxis> > aa1(aa0); |
---|
[89] | 1410 | aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF |
---|
[206] | 1411 | ArrayAccessor<uChar, Axis<asap::PolAxis> > aa2(aa1); |
---|
[89] | 1412 | aa2.reset(aa2.begin(uInt(polSel_)));// go to pol |
---|
| 1413 | |
---|
[206] | 1414 | for (ArrayAccessor<uChar, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) { |
---|
[89] | 1415 | (*i) = uChar(True); |
---|
| 1416 | } |
---|
| 1417 | |
---|
[322] | 1418 | flagsCol_.put(whichRow, arr); |
---|
[89] | 1419 | } |
---|
[212] | 1420 | |
---|
[281] | 1421 | MDirection::Types SDMemTable::getDirectionReference() const |
---|
[212] | 1422 | { |
---|
| 1423 | Float eq; |
---|
| 1424 | table_.keywordSet().get("Equinox",eq); |
---|
| 1425 | std::map<float,string> mp; |
---|
| 1426 | mp[2000.0] = "J2000"; |
---|
| 1427 | mp[1950.0] = "B1950"; |
---|
| 1428 | MDirection::Types mdr; |
---|
| 1429 | if (!MDirection::getType(mdr, mp[eq])) { |
---|
| 1430 | mdr = MDirection::J2000; |
---|
| 1431 | cerr << "Unknown equinox using J2000" << endl; |
---|
| 1432 | } |
---|
| 1433 | // |
---|
| 1434 | return mdr; |
---|
| 1435 | } |
---|
| 1436 | |
---|
[380] | 1437 | MEpoch::Types SDMemTable::getTimeReference() const |
---|
[212] | 1438 | { |
---|
| 1439 | MEpoch::Types met; |
---|
| 1440 | String ep; |
---|
| 1441 | table_.keywordSet().get("Epoch",ep); |
---|
| 1442 | if (!MEpoch::getType(met, ep)) { |
---|
[387] | 1443 | cerr << "Epoch type unknown - using UTC" << endl; |
---|
[212] | 1444 | met = MEpoch::UTC; |
---|
| 1445 | } |
---|
| 1446 | // |
---|
| 1447 | return met; |
---|
| 1448 | } |
---|
| 1449 | |
---|
[236] | 1450 | |
---|
[380] | 1451 | Instrument SDMemTable::convertInstrument(const String& instrument, |
---|
| 1452 | Bool throwIt) |
---|
[236] | 1453 | { |
---|
| 1454 | String t(instrument); |
---|
| 1455 | t.upcase(); |
---|
[293] | 1456 | |
---|
| 1457 | // The strings are what SDReader returns, after cunning interrogation |
---|
| 1458 | // of station names... :-( |
---|
| 1459 | |
---|
[236] | 1460 | Instrument inst = asap::UNKNOWN; |
---|
[293] | 1461 | if (t==String("DSS-43")) { |
---|
[236] | 1462 | inst = TIDBINBILLA; |
---|
| 1463 | } else if (t==String("ATPKSMB")) { |
---|
[292] | 1464 | inst = ATPKSMB; |
---|
| 1465 | } else if (t==String("ATPKSHOH")) { |
---|
| 1466 | inst = ATPKSHOH; |
---|
| 1467 | } else if (t==String("ATMOPRA")) { |
---|
| 1468 | inst = ATMOPRA; |
---|
| 1469 | } else if (t==String("CEDUNA")) { |
---|
| 1470 | inst = CEDUNA; |
---|
| 1471 | } else if (t==String("HOBART")) { |
---|
| 1472 | inst = HOBART; |
---|
[236] | 1473 | } else { |
---|
[380] | 1474 | if (throwIt) { |
---|
| 1475 | throw AipsError("Unrecognized instrument - use function scan.set_instrument to set"); |
---|
| 1476 | } |
---|
[236] | 1477 | } |
---|
| 1478 | return inst; |
---|
| 1479 | } |
---|
| 1480 | |
---|
[401] | 1481 | Bool SDMemTable::setRestFreqs (const Vector<Double>& restFreqsIn, |
---|
| 1482 | const String& sUnit, |
---|
| 1483 | const vector<string>& lines, |
---|
| 1484 | const String& source, |
---|
| 1485 | Int whichIF) |
---|
[386] | 1486 | { |
---|
| 1487 | const Int nIFs = nIF(); |
---|
| 1488 | if (whichIF>=nIFs) { |
---|
| 1489 | throw(AipsError("Illegal IF index")); |
---|
| 1490 | } |
---|
| 1491 | |
---|
[401] | 1492 | // FInd vector of restfrequencies |
---|
| 1493 | // Double takes precedence over String |
---|
| 1494 | |
---|
| 1495 | Unit unit; |
---|
| 1496 | Vector<Double> restFreqs; |
---|
| 1497 | if (restFreqsIn.nelements()>0) { |
---|
| 1498 | restFreqs.resize(restFreqsIn.nelements()); |
---|
| 1499 | restFreqs = restFreqsIn; |
---|
| 1500 | unit = Unit(sUnit); |
---|
| 1501 | } else if (lines.size()>0) { |
---|
| 1502 | const uInt nLines = lines.size(); |
---|
| 1503 | unit = Unit("Hz"); |
---|
| 1504 | restFreqs.resize(nLines); |
---|
| 1505 | MFrequency lineFreq; |
---|
| 1506 | for (uInt i=0; i<nLines; i++) { |
---|
| 1507 | String tS(lines[i]); |
---|
| 1508 | tS.upcase(); |
---|
| 1509 | if (MeasTable::Line(lineFreq, tS)) { |
---|
| 1510 | restFreqs[i] = lineFreq.getValue().getValue(); // Hz |
---|
| 1511 | } else { |
---|
| 1512 | String s = String(lines[i]) + String(" is an unrecognized spectral line"); |
---|
| 1513 | throw(AipsError(s)); |
---|
| 1514 | } |
---|
| 1515 | } |
---|
| 1516 | } else { |
---|
| 1517 | throw(AipsError("You have not specified any rest frequencies or lines")); |
---|
| 1518 | } |
---|
| 1519 | |
---|
[392] | 1520 | // If multiple restfreqs, must be length nIF. In this |
---|
| 1521 | // case we will just replace the rest frequencies |
---|
| 1522 | // |
---|
[386] | 1523 | |
---|
[392] | 1524 | const uInt nRestFreqs = restFreqs.nelements(); |
---|
| 1525 | Int idx = -1; |
---|
[386] | 1526 | SDFrequencyTable sdft = getSDFreqTable(); |
---|
| 1527 | |
---|
[392] | 1528 | if (nRestFreqs>1) { |
---|
| 1529 | |
---|
| 1530 | // Replace restFreqs, one per IF |
---|
| 1531 | |
---|
| 1532 | if (nRestFreqs != nIFs) { |
---|
| 1533 | throw (AipsError("Number of rest frequencies must be equal to the number of IFs")); |
---|
| 1534 | } |
---|
[414] | 1535 | cout << "Replacing rest frequencies with given list, one per IF" << endl; |
---|
[392] | 1536 | // |
---|
| 1537 | sdft.deleteRestFrequencies(); |
---|
| 1538 | for (uInt i=0; i<nRestFreqs; i++) { |
---|
| 1539 | Quantum<Double> rf(restFreqs[i], unit); |
---|
| 1540 | sdft.addRestFrequency(rf.getValue("Hz")); |
---|
| 1541 | } |
---|
| 1542 | } else { |
---|
| 1543 | |
---|
| 1544 | // Add new rest freq |
---|
| 1545 | |
---|
| 1546 | Quantum<Double> rf(restFreqs[0], unit); |
---|
| 1547 | idx = sdft.addRestFrequency(rf.getValue("Hz")); |
---|
[414] | 1548 | cout << "Selecting given rest frequency" << endl; |
---|
[392] | 1549 | } |
---|
| 1550 | |
---|
[386] | 1551 | // Replace |
---|
| 1552 | |
---|
| 1553 | Bool empty = source.empty(); |
---|
| 1554 | Bool ok = False; |
---|
| 1555 | if (putSDFreqTable(sdft)) { |
---|
| 1556 | const uInt nRow = table_.nrow(); |
---|
| 1557 | String srcName; |
---|
| 1558 | Vector<uInt> restFreqIDs; |
---|
| 1559 | for (uInt i=0; i<nRow; i++) { |
---|
| 1560 | srcnCol_.get(i, srcName); |
---|
| 1561 | restfreqidCol_.get(i,restFreqIDs); |
---|
[392] | 1562 | // |
---|
| 1563 | if (idx==-1) { |
---|
| 1564 | |
---|
| 1565 | // Replace vector of restFreqs; one per IF. |
---|
| 1566 | // No selection possible |
---|
| 1567 | |
---|
| 1568 | for (uInt i=0; i<nIFs; i++) restFreqIDs[i] = i; |
---|
| 1569 | } else { |
---|
| 1570 | |
---|
| 1571 | // Set RestFreqID for selected data |
---|
| 1572 | |
---|
| 1573 | if (empty || source==srcName) { |
---|
| 1574 | if (whichIF<0) { |
---|
| 1575 | restFreqIDs = idx; |
---|
| 1576 | } else { |
---|
| 1577 | restFreqIDs[whichIF] = idx; |
---|
| 1578 | } |
---|
[386] | 1579 | } |
---|
| 1580 | } |
---|
| 1581 | // |
---|
| 1582 | restfreqidCol_.put(i,restFreqIDs); |
---|
| 1583 | } |
---|
| 1584 | ok = True; |
---|
| 1585 | } else { |
---|
| 1586 | ok = False; |
---|
| 1587 | } |
---|
| 1588 | // |
---|
| 1589 | return ok; |
---|
| 1590 | } |
---|
| 1591 | |
---|
[414] | 1592 | void SDMemTable::spectralLines() const |
---|
[401] | 1593 | { |
---|
| 1594 | Vector<String> lines = MeasTable::Lines(); |
---|
| 1595 | MFrequency lineFreq; |
---|
| 1596 | Double freq; |
---|
| 1597 | // |
---|
[414] | 1598 | cout.flags(std::ios_base::left); |
---|
| 1599 | cout << "Line Frequency (Hz)" << endl; |
---|
| 1600 | cout << "-----------------------" << endl; |
---|
[401] | 1601 | for (uInt i=0; i<lines.nelements(); i++) { |
---|
| 1602 | MeasTable::Line(lineFreq, lines[i]); |
---|
| 1603 | freq = lineFreq.getValue().getValue(); // Hz |
---|
| 1604 | // |
---|
[414] | 1605 | cout << setw(11) << lines[i] << setprecision(10) << freq << endl; |
---|
[401] | 1606 | } |
---|
| 1607 | } |
---|
[386] | 1608 | |
---|
[380] | 1609 | void SDMemTable::renumber() |
---|
| 1610 | { |
---|
| 1611 | uInt nRow = scanCol_.nrow(); |
---|
| 1612 | Int newscanid = 0; |
---|
| 1613 | Int cIdx;// the current scanid |
---|
| 1614 | // get the first scanid |
---|
| 1615 | scanCol_.getScalar(0,cIdx); |
---|
| 1616 | Int pIdx = cIdx;// the scanid of the previous row |
---|
| 1617 | for (uInt i=0; i<nRow;++i) { |
---|
| 1618 | scanCol_.getScalar(i,cIdx); |
---|
| 1619 | if (pIdx == cIdx) { |
---|
| 1620 | // renumber |
---|
| 1621 | scanCol_.put(i,newscanid); |
---|
| 1622 | } else { |
---|
| 1623 | ++newscanid; |
---|
| 1624 | pIdx = cIdx; // store scanid |
---|
| 1625 | --i; // don't increment next loop |
---|
| 1626 | } |
---|
| 1627 | } |
---|
| 1628 | } |
---|
[386] | 1629 | |
---|
[418] | 1630 | |
---|
[433] | 1631 | void SDMemTable::rotateXYPhase (Float value, Bool doAll) |
---|
[418] | 1632 | // |
---|
| 1633 | // phase in degrees |
---|
[430] | 1634 | // Applies to all Beams and IFs |
---|
| 1635 | // Might want to optionally select on Beam/IF |
---|
[418] | 1636 | // |
---|
| 1637 | { |
---|
| 1638 | if (nPol() != 4) { |
---|
| 1639 | throw(AipsError("You must have 4 polarizations to run this function")); |
---|
| 1640 | } |
---|
| 1641 | // |
---|
| 1642 | IPosition start(asap::nAxes,0); |
---|
| 1643 | IPosition end(asap::nAxes); |
---|
| 1644 | // |
---|
| 1645 | uInt nRow = specCol_.nrow(); |
---|
| 1646 | Array<Float> data; |
---|
| 1647 | for (uInt i=0; i<nRow;++i) { |
---|
| 1648 | specCol_.get(i,data); |
---|
[433] | 1649 | IPosition shape = data.shape(); |
---|
[418] | 1650 | |
---|
[433] | 1651 | // Set slice |
---|
| 1652 | |
---|
| 1653 | if (!doAll) { |
---|
| 1654 | setCursorSlice (start, end, shape); |
---|
| 1655 | } else { |
---|
| 1656 | end = shape-1; |
---|
| 1657 | } |
---|
| 1658 | |
---|
[418] | 1659 | // Get polarization slice references |
---|
| 1660 | |
---|
| 1661 | start(asap::PolAxis) = 2; |
---|
| 1662 | end(asap::PolAxis) = 2; |
---|
| 1663 | Array<Float> C3 = data(start,end); |
---|
| 1664 | // |
---|
| 1665 | start(asap::PolAxis) = 3; |
---|
| 1666 | end(asap::PolAxis) = 3; |
---|
| 1667 | Array<Float> C4 = data(start,end); |
---|
| 1668 | |
---|
| 1669 | // Rotate |
---|
| 1670 | |
---|
| 1671 | SDPolUtil::rotateXYPhase(C3, C4, value); |
---|
| 1672 | |
---|
| 1673 | // Put |
---|
| 1674 | |
---|
| 1675 | specCol_.put(i,data); |
---|
| 1676 | } |
---|
| 1677 | } |
---|
[430] | 1678 | |
---|
| 1679 | |
---|
| 1680 | void SDMemTable::setCursorSlice (IPosition& start, IPosition& end, |
---|
| 1681 | const IPosition& shape) const |
---|
| 1682 | { |
---|
| 1683 | const uInt nDim = shape.nelements(); |
---|
| 1684 | start.resize(nDim); |
---|
| 1685 | end.resize(nDim); |
---|
| 1686 | // |
---|
| 1687 | start(asap::BeamAxis) = beamSel_; |
---|
| 1688 | end(asap::BeamAxis) = beamSel_; |
---|
| 1689 | // |
---|
| 1690 | start(asap::IFAxis) = IFSel_; |
---|
| 1691 | end(asap::IFAxis) = IFSel_; |
---|
| 1692 | // |
---|
| 1693 | start(asap::PolAxis) = polSel_; |
---|
| 1694 | end(asap::PolAxis) = polSel_; |
---|
| 1695 | // |
---|
| 1696 | start(asap::ChanAxis) = 0; |
---|
| 1697 | end(asap::ChanAxis) = shape(asap::ChanAxis) - 1; |
---|
| 1698 | } |
---|
| 1699 | |
---|
| 1700 | |
---|
| 1701 | std::vector<float> SDMemTable::convertVector (const Vector<Float>& in) const |
---|
| 1702 | { |
---|
| 1703 | std::vector<float> out(in.nelements()); |
---|
| 1704 | for (uInt i=0; i<in.nelements(); i++) { |
---|
| 1705 | out[i] = in[i]; |
---|
| 1706 | } |
---|
| 1707 | return out; |
---|
| 1708 | } |
---|
| 1709 | |
---|