source: branches/alma/src/Scantable.cpp@ 1754

Last change on this file since 1754 was 1707, checked in by WataruKawasaki, 15 years ago

New Development: No

JIRA Issue: Yes (CAS-1807)

Ready to Release: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sdflag

Description: added Scantable::getClipMask() and Scantable::srchChannelsToClip().


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 52.5 KB
RevLine 
[805]1//
2// C++ Implementation: Scantable
3//
4// Description:
5//
6//
7// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2005
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
[206]12#include <map>
[1446]13#include <fstream>
[206]14
[125]15#include <casa/aips.h>
[80]16#include <casa/iostream.h>
17#include <casa/iomanip.h>
[805]18#include <casa/OS/Path.h>
19#include <casa/OS/File.h>
[80]20#include <casa/Arrays/Array.h>
21#include <casa/Arrays/ArrayMath.h>
22#include <casa/Arrays/MaskArrMath.h>
23#include <casa/Arrays/ArrayLogical.h>
24#include <casa/Arrays/ArrayAccessor.h>
[1325]25#include <casa/Arrays/Vector.h>
[455]26#include <casa/Arrays/VectorSTLIterator.h>
[1446]27#include <casa/Arrays/Slice.h>
[418]28#include <casa/BasicMath/Math.h>
[504]29#include <casa/BasicSL/Constants.h>
[286]30#include <casa/Quanta/MVAngle.h>
[805]31#include <casa/Containers/RecordField.h>
[902]32#include <casa/Utilities/GenSort.h>
[1616]33#include <casa/Logging/LogIO.h>
[2]34
[80]35#include <tables/Tables/TableParse.h>
36#include <tables/Tables/TableDesc.h>
[488]37#include <tables/Tables/TableCopy.h>
[80]38#include <tables/Tables/SetupNewTab.h>
39#include <tables/Tables/ScaColDesc.h>
40#include <tables/Tables/ArrColDesc.h>
[805]41#include <tables/Tables/TableRow.h>
42#include <tables/Tables/TableVector.h>
43#include <tables/Tables/TableIter.h>
[2]44
[80]45#include <tables/Tables/ExprNode.h>
46#include <tables/Tables/TableRecord.h>
[1325]47#include <casa/Quanta/MVTime.h>
48#include <casa/Quanta/MVAngle.h>
49#include <measures/Measures/MeasRef.h>
50#include <measures/Measures/MeasTable.h>
51// needed to avoid error in .tcc
52#include <measures/Measures/MCDirection.h>
53//
54#include <measures/Measures/MDirection.h>
[80]55#include <measures/Measures/MFrequency.h>
[805]56#include <measures/Measures/MEpoch.h>
57#include <measures/TableMeasures/TableMeasRefDesc.h>
58#include <measures/TableMeasures/TableMeasValueDesc.h>
59#include <measures/TableMeasures/TableMeasDesc.h>
60#include <measures/TableMeasures/ScalarMeasColumn.h>
[105]61#include <coordinates/Coordinates/CoordinateUtil.h>
[2]62
[805]63#include "Scantable.h"
[896]64#include "STPolLinear.h"
[1189]65#include "STPolCircular.h"
[913]66#include "STPolStokes.h"
[878]67#include "STAttr.h"
[902]68#include "MathUtils.h"
[2]69
[125]70using namespace casa;
[2]71
[805]72namespace asap {
73
[896]74std::map<std::string, STPol::STPolFactory *> Scantable::factories_;
75
76void Scantable::initFactories() {
77 if ( factories_.empty() ) {
78 Scantable::factories_["linear"] = &STPolLinear::myFactory;
[1323]79 Scantable::factories_["circular"] = &STPolCircular::myFactory;
[913]80 Scantable::factories_["stokes"] = &STPolStokes::myFactory;
[896]81 }
82}
83
[805]84Scantable::Scantable(Table::TableType ttype) :
[852]85 type_(ttype)
[206]86{
[896]87 initFactories();
[805]88 setupMainTable();
[852]89 freqTable_ = STFrequencies(*this);
[805]90 table_.rwKeywordSet().defineTable("FREQUENCIES", freqTable_.table());
[852]91 weatherTable_ = STWeather(*this);
[805]92 table_.rwKeywordSet().defineTable("WEATHER", weatherTable_.table());
[852]93 focusTable_ = STFocus(*this);
[805]94 table_.rwKeywordSet().defineTable("FOCUS", focusTable_.table());
[852]95 tcalTable_ = STTcal(*this);
[805]96 table_.rwKeywordSet().defineTable("TCAL", tcalTable_.table());
[852]97 moleculeTable_ = STMolecules(*this);
[805]98 table_.rwKeywordSet().defineTable("MOLECULES", moleculeTable_.table());
[860]99 historyTable_ = STHistory(*this);
100 table_.rwKeywordSet().defineTable("HISTORY", historyTable_.table());
[959]101 fitTable_ = STFit(*this);
102 table_.rwKeywordSet().defineTable("FIT", fitTable_.table());
[805]103 originalTable_ = table_;
[322]104 attach();
[18]105}
[206]106
[805]107Scantable::Scantable(const std::string& name, Table::TableType ttype) :
[852]108 type_(ttype)
[206]109{
[896]110 initFactories();
[1656]111
[865]112 Table tab(name, Table::Update);
[1009]113 uInt version = tab.keywordSet().asuInt("VERSION");
[483]114 if (version != version_) {
115 throw(AipsError("Unsupported version of ASAP file."));
116 }
[1009]117 if ( type_ == Table::Memory ) {
[852]118 table_ = tab.copyToMemoryTable(generateName());
[1009]119 } else {
[805]120 table_ = tab;
[1009]121 }
122
[859]123 attachSubtables();
[805]124 originalTable_ = table_;
[329]125 attach();
[2]126}
[1656]127/*
128Scantable::Scantable(const std::string& name, Table::TableType ttype) :
129 type_(ttype)
130{
131 initFactories();
132 Table tab(name, Table::Update);
133 uInt version = tab.keywordSet().asuInt("VERSION");
134 if (version != version_) {
135 throw(AipsError("Unsupported version of ASAP file."));
136 }
137 if ( type_ == Table::Memory ) {
138 table_ = tab.copyToMemoryTable(generateName());
139 } else {
140 table_ = tab;
141 }
[2]142
[1656]143 attachSubtables();
144 originalTable_ = table_;
145 attach();
146}
147*/
148
[805]149Scantable::Scantable( const Scantable& other, bool clear )
[206]150{
[805]151 // with or without data
[859]152 String newname = String(generateName());
[865]153 type_ = other.table_.tableType();
[859]154 if ( other.table_.tableType() == Table::Memory ) {
155 if ( clear ) {
156 table_ = TableCopy::makeEmptyMemoryTable(newname,
157 other.table_, True);
158 } else
159 table_ = other.table_.copyToMemoryTable(newname);
[16]160 } else {
[915]161 other.table_.deepCopy(newname, Table::New, False,
162 other.table_.endianFormat(),
[865]163 Bool(clear));
164 table_ = Table(newname, Table::Update);
165 table_.markForDelete();
166 }
[1111]167 /// @todo reindex SCANNO, recompute nbeam, nif, npol
[915]168 if ( clear ) copySubtables(other);
[859]169 attachSubtables();
[805]170 originalTable_ = table_;
[322]171 attach();
[2]172}
173
[865]174void Scantable::copySubtables(const Scantable& other) {
175 Table t = table_.rwKeywordSet().asTable("FREQUENCIES");
176 TableCopy::copyRows(t, other.freqTable_.table());
177 t = table_.rwKeywordSet().asTable("FOCUS");
178 TableCopy::copyRows(t, other.focusTable_.table());
179 t = table_.rwKeywordSet().asTable("WEATHER");
180 TableCopy::copyRows(t, other.weatherTable_.table());
181 t = table_.rwKeywordSet().asTable("TCAL");
182 TableCopy::copyRows(t, other.tcalTable_.table());
183 t = table_.rwKeywordSet().asTable("MOLECULES");
184 TableCopy::copyRows(t, other.moleculeTable_.table());
185 t = table_.rwKeywordSet().asTable("HISTORY");
186 TableCopy::copyRows(t, other.historyTable_.table());
[972]187 t = table_.rwKeywordSet().asTable("FIT");
188 TableCopy::copyRows(t, other.fitTable_.table());
[865]189}
190
[859]191void Scantable::attachSubtables()
192{
193 freqTable_ = STFrequencies(table_);
194 focusTable_ = STFocus(table_);
195 weatherTable_ = STWeather(table_);
196 tcalTable_ = STTcal(table_);
197 moleculeTable_ = STMolecules(table_);
[860]198 historyTable_ = STHistory(table_);
[972]199 fitTable_ = STFit(table_);
[859]200}
201
[805]202Scantable::~Scantable()
[206]203{
[941]204 //cout << "~Scantable() " << this << endl;
[2]205}
206
[805]207void Scantable::setupMainTable()
[206]208{
[805]209 TableDesc td("", "1", TableDesc::Scratch);
210 td.comment() = "An ASAP Scantable";
[1009]211 td.rwKeywordSet().define("VERSION", uInt(version_));
[2]212
[805]213 // n Cycles
214 td.addColumn(ScalarColumnDesc<uInt>("SCANNO"));
215 // new index every nBeam x nIF x nPol
216 td.addColumn(ScalarColumnDesc<uInt>("CYCLENO"));
[2]217
[805]218 td.addColumn(ScalarColumnDesc<uInt>("BEAMNO"));
219 td.addColumn(ScalarColumnDesc<uInt>("IFNO"));
[972]220 // linear, circular, stokes
[805]221 td.rwKeywordSet().define("POLTYPE", String("linear"));
222 td.addColumn(ScalarColumnDesc<uInt>("POLNO"));
[138]223
[805]224 td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID"));
225 td.addColumn(ScalarColumnDesc<uInt>("MOLECULE_ID"));
226 td.addColumn(ScalarColumnDesc<Int>("REFBEAMNO"));
[80]227
[1656]228 td.addColumn(ScalarColumnDesc<uInt>("FLAGROW"));
229
[805]230 td.addColumn(ScalarColumnDesc<Double>("TIME"));
231 TableMeasRefDesc measRef(MEpoch::UTC); // UTC as default
232 TableMeasValueDesc measVal(td, "TIME");
233 TableMeasDesc<MEpoch> mepochCol(measVal, measRef);
234 mepochCol.write(td);
[483]235
[805]236 td.addColumn(ScalarColumnDesc<Double>("INTERVAL"));
237
[2]238 td.addColumn(ScalarColumnDesc<String>("SRCNAME"));
[805]239 // Type of source (on=0, off=1, other=-1)
[1603]240 ScalarColumnDesc<Int> stypeColumn("SRCTYPE");
241 stypeColumn.setDefault(Int(-1));
242 td.addColumn(stypeColumn);
[805]243 td.addColumn(ScalarColumnDesc<String>("FIELDNAME"));
244
245 //The actual Data Vectors
[2]246 td.addColumn(ArrayColumnDesc<Float>("SPECTRA"));
247 td.addColumn(ArrayColumnDesc<uChar>("FLAGTRA"));
[89]248 td.addColumn(ArrayColumnDesc<Float>("TSYS"));
[805]249
250 td.addColumn(ArrayColumnDesc<Double>("DIRECTION",
251 IPosition(1,2),
252 ColumnDesc::Direct));
253 TableMeasRefDesc mdirRef(MDirection::J2000); // default
254 TableMeasValueDesc tmvdMDir(td, "DIRECTION");
255 // the TableMeasDesc gives the column a type
256 TableMeasDesc<MDirection> mdirCol(tmvdMDir, mdirRef);
[987]257 // a uder set table type e.g. GALCTIC, B1950 ...
258 td.rwKeywordSet().define("DIRECTIONREF", String("J2000"));
[805]259 // writing create the measure column
260 mdirCol.write(td);
[923]261 td.addColumn(ScalarColumnDesc<Float>("AZIMUTH"));
262 td.addColumn(ScalarColumnDesc<Float>("ELEVATION"));
[105]263 td.addColumn(ScalarColumnDesc<Float>("PARANGLE"));
[1047]264 td.addColumn(ScalarColumnDesc<Float>("OPACITY"));
[105]265
[805]266 td.addColumn(ScalarColumnDesc<uInt>("TCAL_ID"));
[972]267 ScalarColumnDesc<Int> fitColumn("FIT_ID");
[973]268 fitColumn.setDefault(Int(-1));
[972]269 td.addColumn(fitColumn);
[805]270
271 td.addColumn(ScalarColumnDesc<uInt>("FOCUS_ID"));
272 td.addColumn(ScalarColumnDesc<uInt>("WEATHER_ID"));
273
[999]274 // columns which just get dragged along, as they aren't used in asap
275 td.addColumn(ScalarColumnDesc<Double>("SRCVELOCITY"));
276 td.addColumn(ArrayColumnDesc<Double>("SRCPROPERMOTION"));
277 td.addColumn(ArrayColumnDesc<Double>("SRCDIRECTION"));
278 td.addColumn(ArrayColumnDesc<Double>("SCANRATE"));
279
[805]280 td.rwKeywordSet().define("OBSMODE", String(""));
281
[418]282 // Now create Table SetUp from the description.
[859]283 SetupNewTable aNewTab(generateName(), td, Table::Scratch);
[852]284 table_ = Table(aNewTab, type_, 0);
[805]285 originalTable_ = table_;
286}
[418]287
[805]288void Scantable::attach()
[455]289{
[805]290 timeCol_.attach(table_, "TIME");
291 srcnCol_.attach(table_, "SRCNAME");
[1068]292 srctCol_.attach(table_, "SRCTYPE");
[805]293 specCol_.attach(table_, "SPECTRA");
294 flagsCol_.attach(table_, "FLAGTRA");
[865]295 tsysCol_.attach(table_, "TSYS");
[805]296 cycleCol_.attach(table_,"CYCLENO");
297 scanCol_.attach(table_, "SCANNO");
298 beamCol_.attach(table_, "BEAMNO");
[847]299 ifCol_.attach(table_, "IFNO");
300 polCol_.attach(table_, "POLNO");
[805]301 integrCol_.attach(table_, "INTERVAL");
302 azCol_.attach(table_, "AZIMUTH");
303 elCol_.attach(table_, "ELEVATION");
304 dirCol_.attach(table_, "DIRECTION");
305 paraCol_.attach(table_, "PARANGLE");
306 fldnCol_.attach(table_, "FIELDNAME");
307 rbeamCol_.attach(table_, "REFBEAMNO");
[455]308
[805]309 mfitidCol_.attach(table_,"FIT_ID");
310 mfreqidCol_.attach(table_, "FREQ_ID");
311 mtcalidCol_.attach(table_, "TCAL_ID");
312 mfocusidCol_.attach(table_, "FOCUS_ID");
313 mmolidCol_.attach(table_, "MOLECULE_ID");
[1656]314
315 //Add auxiliary column for row-based flagging (CAS-1433 Wataru Kawasaki)
316 attachAuxColumnDef(flagrowCol_, "FLAGROW", 0);
317
[455]318}
319
[1656]320template<class T, class T2>
321void Scantable::attachAuxColumnDef(ScalarColumn<T>& col,
322 const String& colName,
323 const T2& defValue)
324{
325 try {
326 col.attach(table_, colName);
327 } catch (TableError& err) {
328 String errMesg = err.getMesg();
329 if (errMesg == "Table column " + colName + " is unknown") {
330 table_.addColumn(ScalarColumnDesc<T>(colName));
331 col.attach(table_, colName);
332 col.fillColumn(static_cast<T>(defValue));
333 } else {
334 throw;
335 }
336 } catch (...) {
337 throw;
338 }
339}
340
341template<class T, class T2>
342void Scantable::attachAuxColumnDef(ArrayColumn<T>& col,
343 const String& colName,
344 const Array<T2>& defValue)
345{
346 try {
347 col.attach(table_, colName);
348 } catch (TableError& err) {
349 String errMesg = err.getMesg();
350 if (errMesg == "Table column " + colName + " is unknown") {
351 table_.addColumn(ArrayColumnDesc<T>(colName));
352 col.attach(table_, colName);
353
354 int size = 0;
355 ArrayIterator<T2>& it = defValue.begin();
356 while (it != defValue.end()) {
357 ++size;
358 ++it;
359 }
360 IPosition ip(1, size);
361 Array<T>& arr(ip);
362 for (int i = 0; i < size; ++i)
363 arr[i] = static_cast<T>(defValue[i]);
364
365 col.fillColumn(arr);
366 } else {
367 throw;
368 }
369 } catch (...) {
370 throw;
371 }
372}
373
[901]374void Scantable::setHeader(const STHeader& sdh)
[206]375{
[18]376 table_.rwKeywordSet().define("nIF", sdh.nif);
377 table_.rwKeywordSet().define("nBeam", sdh.nbeam);
378 table_.rwKeywordSet().define("nPol", sdh.npol);
379 table_.rwKeywordSet().define("nChan", sdh.nchan);
380 table_.rwKeywordSet().define("Observer", sdh.observer);
381 table_.rwKeywordSet().define("Project", sdh.project);
382 table_.rwKeywordSet().define("Obstype", sdh.obstype);
383 table_.rwKeywordSet().define("AntennaName", sdh.antennaname);
384 table_.rwKeywordSet().define("AntennaPosition", sdh.antennaposition);
385 table_.rwKeywordSet().define("Equinox", sdh.equinox);
386 table_.rwKeywordSet().define("FreqRefFrame", sdh.freqref);
387 table_.rwKeywordSet().define("FreqRefVal", sdh.reffreq);
388 table_.rwKeywordSet().define("Bandwidth", sdh.bandwidth);
389 table_.rwKeywordSet().define("UTC", sdh.utc);
[206]390 table_.rwKeywordSet().define("FluxUnit", sdh.fluxunit);
391 table_.rwKeywordSet().define("Epoch", sdh.epoch);
[905]392 table_.rwKeywordSet().define("POLTYPE", sdh.poltype);
[50]393}
[21]394
[901]395STHeader Scantable::getHeader() const
[206]396{
[901]397 STHeader sdh;
[21]398 table_.keywordSet().get("nBeam",sdh.nbeam);
399 table_.keywordSet().get("nIF",sdh.nif);
400 table_.keywordSet().get("nPol",sdh.npol);
401 table_.keywordSet().get("nChan",sdh.nchan);
402 table_.keywordSet().get("Observer", sdh.observer);
403 table_.keywordSet().get("Project", sdh.project);
404 table_.keywordSet().get("Obstype", sdh.obstype);
405 table_.keywordSet().get("AntennaName", sdh.antennaname);
406 table_.keywordSet().get("AntennaPosition", sdh.antennaposition);
407 table_.keywordSet().get("Equinox", sdh.equinox);
408 table_.keywordSet().get("FreqRefFrame", sdh.freqref);
409 table_.keywordSet().get("FreqRefVal", sdh.reffreq);
410 table_.keywordSet().get("Bandwidth", sdh.bandwidth);
411 table_.keywordSet().get("UTC", sdh.utc);
[206]412 table_.keywordSet().get("FluxUnit", sdh.fluxunit);
413 table_.keywordSet().get("Epoch", sdh.epoch);
[905]414 table_.keywordSet().get("POLTYPE", sdh.poltype);
[21]415 return sdh;
[18]416}
[805]417
[1360]418void Scantable::setSourceType( int stype )
[1068]419{
420 if ( stype < 0 || stype > 1 )
421 throw(AipsError("Illegal sourcetype."));
422 TableVector<Int> tabvec(table_, "SRCTYPE");
423 tabvec = Int(stype);
424}
425
[845]426bool Scantable::conformant( const Scantable& other )
427{
428 return this->getHeader().conformant(other.getHeader());
429}
430
431
[50]432
[805]433std::string Scantable::formatSec(Double x) const
[206]434{
[105]435 Double xcop = x;
436 MVTime mvt(xcop/24./3600.); // make days
[365]437
[105]438 if (x < 59.95)
[281]439 return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s";
[745]440 else if (x < 3599.95)
[281]441 return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_H,7)+" ";
442 else {
443 ostringstream oss;
444 oss << setw(2) << std::right << setprecision(1) << mvt.hour();
445 oss << ":" << mvt.string(MVTime::TIME_CLEAN_NO_H,7) << " ";
446 return String(oss);
[745]447 }
[105]448};
449
[805]450std::string Scantable::formatDirection(const MDirection& md) const
[281]451{
452 Vector<Double> t = md.getAngle(Unit(String("rad"))).getValue();
453 Int prec = 7;
454
455 MVAngle mvLon(t[0]);
456 String sLon = mvLon.string(MVAngle::TIME,prec);
[987]457 uInt tp = md.getRef().getType();
458 if (tp == MDirection::GALACTIC ||
459 tp == MDirection::SUPERGAL ) {
460 sLon = mvLon(0.0).string(MVAngle::ANGLE_CLEAN,prec);
461 }
[281]462 MVAngle mvLat(t[1]);
463 String sLat = mvLat.string(MVAngle::ANGLE+MVAngle::DIG2,prec);
[380]464 return sLon + String(" ") + sLat;
[281]465}
466
467
[805]468std::string Scantable::getFluxUnit() const
[206]469{
[847]470 return table_.keywordSet().asString("FluxUnit");
[206]471}
472
[805]473void Scantable::setFluxUnit(const std::string& unit)
[218]474{
475 String tmp(unit);
476 Unit tU(tmp);
477 if (tU==Unit("K") || tU==Unit("Jy")) {
478 table_.rwKeywordSet().define(String("FluxUnit"), tmp);
479 } else {
480 throw AipsError("Illegal unit - must be compatible with Jy or K");
481 }
482}
483
[805]484void Scantable::setInstrument(const std::string& name)
[236]485{
[805]486 bool throwIt = true;
[996]487 // create an Instrument to see if this is valid
488 STAttr::convertInstrument(name, throwIt);
[236]489 String nameU(name);
490 nameU.upcase();
491 table_.rwKeywordSet().define(String("AntennaName"), nameU);
492}
493
[1189]494void Scantable::setFeedType(const std::string& feedtype)
495{
496 if ( Scantable::factories_.find(feedtype) == Scantable::factories_.end() ) {
497 std::string msg = "Illegal feed type "+ feedtype;
498 throw(casa::AipsError(msg));
499 }
500 table_.rwKeywordSet().define(String("POLTYPE"), feedtype);
501}
502
[805]503MPosition Scantable::getAntennaPosition () const
504{
505 Vector<Double> antpos;
506 table_.keywordSet().get("AntennaPosition", antpos);
507 MVPosition mvpos(antpos(0),antpos(1),antpos(2));
508 return MPosition(mvpos);
509}
[281]510
[805]511void Scantable::makePersistent(const std::string& filename)
512{
513 String inname(filename);
514 Path path(inname);
[1111]515 /// @todo reindex SCANNO, recompute nbeam, nif, npol
[805]516 inname = path.expandedName();
517 table_.deepCopy(inname, Table::New);
518}
519
[837]520int Scantable::nbeam( int scanno ) const
[805]521{
522 if ( scanno < 0 ) {
523 Int n;
524 table_.keywordSet().get("nBeam",n);
525 return int(n);
[105]526 } else {
[805]527 // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
[888]528 Table t = table_(table_.col("SCANNO") == scanno);
529 ROTableRow row(t);
530 const TableRecord& rec = row.get(0);
531 Table subt = t( t.col("IFNO") == Int(rec.asuInt("IFNO"))
532 && t.col("POLNO") == Int(rec.asuInt("POLNO"))
533 && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
534 ROTableVector<uInt> v(subt, "BEAMNO");
[805]535 return int(v.nelements());
[105]536 }
[805]537 return 0;
538}
[455]539
[837]540int Scantable::nif( int scanno ) const
[805]541{
542 if ( scanno < 0 ) {
543 Int n;
544 table_.keywordSet().get("nIF",n);
545 return int(n);
546 } else {
547 // take the first POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these
[888]548 Table t = table_(table_.col("SCANNO") == scanno);
549 ROTableRow row(t);
550 const TableRecord& rec = row.get(0);
551 Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
552 && t.col("POLNO") == Int(rec.asuInt("POLNO"))
553 && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
554 if ( subt.nrow() == 0 ) return 0;
555 ROTableVector<uInt> v(subt, "IFNO");
[805]556 return int(v.nelements());
[2]557 }
[805]558 return 0;
559}
[321]560
[837]561int Scantable::npol( int scanno ) const
[805]562{
563 if ( scanno < 0 ) {
564 Int n;
565 table_.keywordSet().get("nPol",n);
566 return n;
567 } else {
568 // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
[888]569 Table t = table_(table_.col("SCANNO") == scanno);
570 ROTableRow row(t);
571 const TableRecord& rec = row.get(0);
572 Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
573 && t.col("IFNO") == Int(rec.asuInt("IFNO"))
574 && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
575 if ( subt.nrow() == 0 ) return 0;
576 ROTableVector<uInt> v(subt, "POLNO");
[805]577 return int(v.nelements());
[321]578 }
[805]579 return 0;
[2]580}
[805]581
[845]582int Scantable::ncycle( int scanno ) const
[206]583{
[805]584 if ( scanno < 0 ) {
[837]585 Block<String> cols(2);
586 cols[0] = "SCANNO";
587 cols[1] = "CYCLENO";
588 TableIterator it(table_, cols);
589 int n = 0;
590 while ( !it.pastEnd() ) {
591 ++n;
[902]592 ++it;
[837]593 }
594 return n;
[805]595 } else {
[888]596 Table t = table_(table_.col("SCANNO") == scanno);
597 ROTableRow row(t);
598 const TableRecord& rec = row.get(0);
599 Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
600 && t.col("POLNO") == Int(rec.asuInt("POLNO"))
601 && t.col("IFNO") == Int(rec.asuInt("IFNO")) );
602 if ( subt.nrow() == 0 ) return 0;
603 return int(subt.nrow());
[805]604 }
605 return 0;
[18]606}
[455]607
608
[845]609int Scantable::nrow( int scanno ) const
[805]610{
[845]611 return int(table_.nrow());
612}
613
614int Scantable::nchan( int ifno ) const
615{
616 if ( ifno < 0 ) {
[805]617 Int n;
618 table_.keywordSet().get("nChan",n);
619 return int(n);
620 } else {
[1603]621 // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't
622 // vary with these
[888]623 Table t = table_(table_.col("IFNO") == ifno);
624 if ( t.nrow() == 0 ) return 0;
625 ROArrayColumn<Float> v(t, "SPECTRA");
[923]626 return v.shape(0)(0);
[805]627 }
628 return 0;
[18]629}
[455]630
[1111]631int Scantable::nscan() const {
632 Vector<uInt> scannos(scanCol_.getColumn());
[1148]633 uInt nout = genSort( scannos, Sort::Ascending,
[1111]634 Sort::QuickSort|Sort::NoDuplicates );
635 return int(nout);
636}
637
[923]638int Scantable::getChannels(int whichrow) const
639{
640 return specCol_.shape(whichrow)(0);
641}
[847]642
643int Scantable::getBeam(int whichrow) const
644{
645 return beamCol_(whichrow);
646}
647
[1111]648std::vector<uint> Scantable::getNumbers(ScalarColumn<uInt>& col)
649{
650 Vector<uInt> nos(col.getColumn());
[1148]651 uInt n = genSort( nos, Sort::Ascending, Sort::QuickSort|Sort::NoDuplicates );
652 nos.resize(n, True);
[1111]653 std::vector<uint> stlout;
654 nos.tovector(stlout);
655 return stlout;
656}
657
[847]658int Scantable::getIF(int whichrow) const
659{
660 return ifCol_(whichrow);
661}
662
663int Scantable::getPol(int whichrow) const
664{
665 return polCol_(whichrow);
666}
667
[805]668std::string Scantable::formatTime(const MEpoch& me, bool showdate) const
669{
670 MVTime mvt(me.getValue());
671 if (showdate)
672 mvt.setFormat(MVTime::YMD);
673 else
674 mvt.setFormat(MVTime::TIME);
675 ostringstream oss;
676 oss << mvt;
677 return String(oss);
678}
[488]679
[805]680void Scantable::calculateAZEL()
681{
682 MPosition mp = getAntennaPosition();
683 MEpoch::ROScalarColumn timeCol(table_, "TIME");
684 ostringstream oss;
685 oss << "Computed azimuth/elevation using " << endl
686 << mp << endl;
[996]687 for (Int i=0; i<nrow(); ++i) {
[805]688 MEpoch me = timeCol(i);
[987]689 MDirection md = getDirection(i);
[805]690 oss << " Time: " << formatTime(me,False) << " Direction: " << formatDirection(md)
691 << endl << " => ";
692 MeasFrame frame(mp, me);
693 Vector<Double> azel =
694 MDirection::Convert(md, MDirection::Ref(MDirection::AZEL,
695 frame)
696 )().getAngle("rad").getValue();
[923]697 azCol_.put(i,Float(azel[0]));
698 elCol_.put(i,Float(azel[1]));
[805]699 oss << "azel: " << azel[0]/C::pi*180.0 << " "
700 << azel[1]/C::pi*180.0 << " (deg)" << endl;
[16]701 }
[805]702 pushLog(String(oss));
703}
[89]704
[1700]705void Scantable::clip(const Float uthres, const Float dthres, bool clipoutside, bool unflag)
706{
707 for (uInt i=0; i<table_.nrow(); ++i) {
708 Vector<uChar> flgs = flagsCol_(i);
[1707]709 srchChannelsToClip(i, uthres, dthres, clipoutside, unflag, flgs);
710 flagsCol_.put(i, flgs);
711 }
712}
713
714std::vector<bool> Scantable::getClipMask(int whichrow, const Float uthres, const Float dthres, bool clipoutside, bool unflag)
715{
716 Vector<uChar> flags;
717 flagsCol_.get(uInt(whichrow), flags);
718 srchChannelsToClip(uInt(whichrow), uthres, dthres, clipoutside, unflag, flags);
719 Vector<Bool> bflag(flags.shape());
720 convertArray(bflag, flags);
721 //bflag = !bflag;
722
723 std::vector<bool> mask;
724 bflag.tovector(mask);
725 return mask;
726}
727
728void Scantable::srchChannelsToClip(uInt whichrow, const Float uthres, const Float dthres, bool clipoutside, bool unflag,
729 Vector<uChar> flgs)
730{
731 Vector<Float> spcs = specCol_(whichrow);
[1706]732 uInt nchannel = nchan();
733 if (spcs.nelements() != nchannel) {
[1700]734 throw(AipsError("Data has incorrect number of channels"));
735 }
736 uChar userflag = 1 << 7;
737 if (unflag) {
738 userflag = 0 << 7;
739 }
740 if (clipoutside) {
[1706]741 for (uInt j = 0; j < nchannel; ++j) {
[1700]742 Float spc = spcs(j);
743 if ((spc >= uthres) || (spc <= dthres)) {
744 flgs(j) = userflag;
745 }
746 }
747 } else {
[1706]748 for (uInt j = 0; j < nchannel; ++j) {
[1700]749 Float spc = spcs(j);
750 if ((spc < uthres) && (spc > dthres)) {
751 flgs(j) = userflag;
752 }
753 }
754 }
755}
756
[1400]757void Scantable::flag(const std::vector<bool>& msk, bool unflag)
[865]758{
[1333]759 std::vector<bool>::const_iterator it;
760 uInt ntrue = 0;
761 for (it = msk.begin(); it != msk.end(); ++it) {
762 if ( *it ) {
763 ntrue++;
764 }
765 }
766 if ( selector_.empty() && (msk.size() == 0 || msk.size() == ntrue) )
[1000]767 throw(AipsError("Trying to flag whole scantable."));
768 if ( msk.size() == 0 ) {
769 uChar userflag = 1 << 7;
[1400]770 if ( unflag ) {
771 userflag = 0 << 7;
772 }
[1000]773 for ( uInt i=0; i<table_.nrow(); ++i) {
774 Vector<uChar> flgs = flagsCol_(i);
775 flgs = userflag;
776 flagsCol_.put(i, flgs);
777 }
778 return;
779 }
780 if ( int(msk.size()) != nchan() ) {
781 throw(AipsError("Mask has incorrect number of channels."));
782 }
783 for ( uInt i=0; i<table_.nrow(); ++i) {
784 Vector<uChar> flgs = flagsCol_(i);
785 if ( flgs.nelements() != msk.size() ) {
786 throw(AipsError("Mask has incorrect number of channels."
787 " Probably varying with IF. Please flag per IF"));
788 }
789 std::vector<bool>::const_iterator it;
790 uInt j = 0;
791 uChar userflag = 1 << 7;
[1400]792 if ( unflag ) {
793 userflag = 0 << 7;
794 }
[1000]795 for (it = msk.begin(); it != msk.end(); ++it) {
796 if ( *it ) {
797 flgs(j) = userflag;
798 }
799 ++j;
800 }
801 flagsCol_.put(i, flgs);
802 }
[865]803}
804
[1656]805void Scantable::flagRow(const std::vector<uInt>& rows, bool unflag)
806{
807 if ( selector_.empty() && (rows.size() == table_.nrow()) )
808 throw(AipsError("Trying to flag whole scantable."));
809
810 uInt rowflag = (unflag ? 0 : 1);
811 std::vector<uInt>::const_iterator it;
812 for (it = rows.begin(); it != rows.end(); ++it)
813 flagrowCol_.put(*it, rowflag);
814}
815
[805]816std::vector<bool> Scantable::getMask(int whichrow) const
817{
818 Vector<uChar> flags;
819 flagsCol_.get(uInt(whichrow), flags);
820 Vector<Bool> bflag(flags.shape());
821 convertArray(bflag, flags);
822 bflag = !bflag;
823 std::vector<bool> mask;
824 bflag.tovector(mask);
825 return mask;
826}
[89]827
[896]828std::vector<float> Scantable::getSpectrum( int whichrow,
[902]829 const std::string& poltype ) const
[805]830{
[905]831 String ptype = poltype;
832 if (poltype == "" ) ptype = getPolType();
[902]833 if ( whichrow < 0 || whichrow >= nrow() )
834 throw(AipsError("Illegal row number."));
[896]835 std::vector<float> out;
[805]836 Vector<Float> arr;
[896]837 uInt requestedpol = polCol_(whichrow);
838 String basetype = getPolType();
[905]839 if ( ptype == basetype ) {
[896]840 specCol_.get(whichrow, arr);
841 } else {
[1334]842 CountedPtr<STPol> stpol(STPol::getPolClass(Scantable::factories_, basetype));
843 uInt row = uInt(whichrow);
844 stpol->setSpectra(getPolMatrix(row));
845 Float fang,fhand,parang;
846 fang = focusTable_.getTotalFeedAngle(mfocusidCol_(row));
847 fhand = focusTable_.getFeedHand(mfocusidCol_(row));
848 parang = paraCol_(row);
849 /// @todo re-enable this
850 // disable total feed angle to support paralactifying Caswell style
851 stpol->setPhaseCorrections(parang, -parang, fhand);
852 arr = stpol->getSpectrum(requestedpol, ptype);
[896]853 }
[902]854 if ( arr.nelements() == 0 )
855 pushLog("Not enough polarisations present to do the conversion.");
[805]856 arr.tovector(out);
857 return out;
[89]858}
[212]859
[1360]860void Scantable::setSpectrum( const std::vector<float>& spec,
[884]861 int whichrow )
862{
863 Vector<Float> spectrum(spec);
864 Vector<Float> arr;
865 specCol_.get(whichrow, arr);
866 if ( spectrum.nelements() != arr.nelements() )
[896]867 throw AipsError("The spectrum has incorrect number of channels.");
[884]868 specCol_.put(whichrow, spectrum);
869}
870
871
[805]872String Scantable::generateName()
[745]873{
[805]874 return (File::newUniqueName("./","temp")).baseName();
[212]875}
876
[805]877const casa::Table& Scantable::table( ) const
[212]878{
[805]879 return table_;
[212]880}
881
[805]882casa::Table& Scantable::table( )
[386]883{
[805]884 return table_;
[386]885}
886
[896]887std::string Scantable::getPolType() const
888{
889 return table_.keywordSet().asString("POLTYPE");
890}
891
[805]892void Scantable::unsetSelection()
[380]893{
[805]894 table_ = originalTable_;
[847]895 attach();
[805]896 selector_.reset();
[380]897}
[386]898
[805]899void Scantable::setSelection( const STSelector& selection )
[430]900{
[805]901 Table tab = const_cast<STSelector&>(selection).apply(originalTable_);
902 if ( tab.nrow() == 0 ) {
903 throw(AipsError("Selection contains no data. Not applying it."));
904 }
905 table_ = tab;
[847]906 attach();
[805]907 selector_ = selection;
[430]908}
909
[837]910std::string Scantable::summary( bool verbose )
[447]911{
[805]912 // Format header info
913 ostringstream oss;
914 oss << endl;
915 oss << asap::SEPERATOR << endl;
916 oss << " Scan Table Summary" << endl;
917 oss << asap::SEPERATOR << endl;
918 oss.flags(std::ios_base::left);
919 oss << setw(15) << "Beams:" << setw(4) << nbeam() << endl
920 << setw(15) << "IFs:" << setw(4) << nif() << endl
[896]921 << setw(15) << "Polarisations:" << setw(4) << npol()
922 << "(" << getPolType() << ")" << endl
[805]923 << setw(15) << "Channels:" << setw(4) << nchan() << endl;
924 oss << endl;
925 String tmp;
[860]926 oss << setw(15) << "Observer:"
927 << table_.keywordSet().asString("Observer") << endl;
[805]928 oss << setw(15) << "Obs Date:" << getTime(-1,true) << endl;
929 table_.keywordSet().get("Project", tmp);
930 oss << setw(15) << "Project:" << tmp << endl;
931 table_.keywordSet().get("Obstype", tmp);
932 oss << setw(15) << "Obs. Type:" << tmp << endl;
933 table_.keywordSet().get("AntennaName", tmp);
934 oss << setw(15) << "Antenna Name:" << tmp << endl;
935 table_.keywordSet().get("FluxUnit", tmp);
936 oss << setw(15) << "Flux Unit:" << tmp << endl;
[1446]937 //Vector<Double> vec(moleculeTable_.getRestFrequencies());
938 int nid = moleculeTable_.nrow();
939 Bool firstline = True;
[805]940 oss << setw(15) << "Rest Freqs:";
[1446]941 for (int i=0; i<nid; i++) {
942 Table t = table_(table_.col("MOLECULE_ID") == i);
943 if (t.nrow() > 0) {
944 Vector<Double> vec(moleculeTable_.getRestFrequency(i));
945 if (vec.nelements() > 0) {
946 if (firstline) {
947 oss << setprecision(10) << vec << " [Hz]" << endl;
948 firstline=False;
949 }
950 else{
951 oss << setw(15)<<" " << setprecision(10) << vec << " [Hz]" << endl;
952 }
953 } else {
954 oss << "none" << endl;
955 }
956 }
[805]957 }
[941]958
959 oss << setw(15) << "Abcissa:" << getAbcissaLabel(0) << endl;
[805]960 oss << selector_.print() << endl;
961 oss << endl;
962 // main table
963 String dirtype = "Position ("
[987]964 + getDirectionRefString()
[805]965 + ")";
[941]966 oss << setw(5) << "Scan" << setw(15) << "Source"
967 << setw(10) << "Time" << setw(18) << "Integration" << endl;
968 oss << setw(5) << "" << setw(5) << "Beam" << setw(3) << "" << dirtype << endl;
969 oss << setw(10) << "" << setw(3) << "IF" << setw(6) << ""
[805]970 << setw(8) << "Frame" << setw(16)
971 << "RefVal" << setw(10) << "RefPix" << setw(12) << "Increment" <<endl;
972 oss << asap::SEPERATOR << endl;
973 TableIterator iter(table_, "SCANNO");
974 while (!iter.pastEnd()) {
975 Table subt = iter.table();
976 ROTableRow row(subt);
977 MEpoch::ROScalarColumn timeCol(subt,"TIME");
978 const TableRecord& rec = row.get(0);
979 oss << setw(4) << std::right << rec.asuInt("SCANNO")
980 << std::left << setw(1) << ""
981 << setw(15) << rec.asString("SRCNAME")
982 << setw(10) << formatTime(timeCol(0), false);
983 // count the cycles in the scan
984 TableIterator cyciter(subt, "CYCLENO");
985 int nint = 0;
986 while (!cyciter.pastEnd()) {
987 ++nint;
988 ++cyciter;
989 }
990 oss << setw(3) << std::right << nint << setw(3) << " x " << std::left
991 << setw(6) << formatSec(rec.asFloat("INTERVAL")) << endl;
[447]992
[805]993 TableIterator biter(subt, "BEAMNO");
994 while (!biter.pastEnd()) {
995 Table bsubt = biter.table();
996 ROTableRow brow(bsubt);
997 const TableRecord& brec = brow.get(0);
[1000]998 uInt row0 = bsubt.rowNumbers(table_)[0];
[941]999 oss << setw(5) << "" << setw(4) << std::right << brec.asuInt("BEAMNO")<< std::left;
[987]1000 oss << setw(4) << "" << formatDirection(getDirection(row0)) << endl;
[805]1001 TableIterator iiter(bsubt, "IFNO");
1002 while (!iiter.pastEnd()) {
1003 Table isubt = iiter.table();
1004 ROTableRow irow(isubt);
1005 const TableRecord& irec = irow.get(0);
[941]1006 oss << setw(10) << "";
1007 oss << setw(3) << std::right << irec.asuInt("IFNO") << std::left
[1451]1008 << setw(2) << "" << frequencies().print(irec.asuInt("FREQ_ID"))
1009 << endl;
[447]1010
[805]1011 ++iiter;
1012 }
1013 ++biter;
1014 }
1015 ++iter;
[447]1016 }
[805]1017 /// @todo implement verbose mode
1018 return String(oss);
[447]1019}
1020
[805]1021std::string Scantable::getTime(int whichrow, bool showdate) const
[777]1022{
[805]1023 MEpoch::ROScalarColumn timeCol(table_, "TIME");
1024 MEpoch me;
1025 if (whichrow > -1) {
1026 me = timeCol(uInt(whichrow));
1027 } else {
1028 Double tm;
1029 table_.keywordSet().get("UTC",tm);
1030 me = MEpoch(MVEpoch(tm));
[777]1031 }
[805]1032 return formatTime(me, showdate);
[777]1033}
[805]1034
[1603]1035MEpoch Scantable::getEpoch(int whichrow) const
1036{
1037 if (whichrow > -1) {
1038 return timeCol_(uInt(whichrow));
1039 } else {
1040 Double tm;
1041 table_.keywordSet().get("UTC",tm);
1042 return MEpoch(MVEpoch(tm));
1043 }
1044}
1045
[1068]1046std::string Scantable::getDirectionString(int whichrow) const
1047{
1048 return formatDirection(getDirection(uInt(whichrow)));
1049}
1050
[1360]1051std::vector< double > Scantable::getAbcissa( int whichrow ) const
[865]1052{
[1603]1053 if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal row number"));
[865]1054 std::vector<double> stlout;
1055 int nchan = specCol_(whichrow).nelements();
1056 String us = freqTable_.getUnitString();
1057 if ( us == "" || us == "pixel" || us == "channel" ) {
1058 for (int i=0; i<nchan; ++i) {
1059 stlout.push_back(double(i));
1060 }
1061 return stlout;
1062 }
1063
1064 const MPosition& mp = getAntennaPosition();
[987]1065 const MDirection& md = getDirection(whichrow);
[865]1066 const MEpoch& me = timeCol_(whichrow);
[1446]1067 //Double rf = moleculeTable_.getRestFrequency(mmolidCol_(whichrow));
1068 Vector<Double> rf = moleculeTable_.getRestFrequency(mmolidCol_(whichrow));
[865]1069 SpectralCoordinate spc =
1070 freqTable_.getSpectralCoordinate(md, mp, me, rf, mfreqidCol_(whichrow));
1071 Vector<Double> pixel(nchan);
1072 Vector<Double> world;
1073 indgen(pixel);
1074 if ( Unit(us) == Unit("Hz") ) {
1075 for ( int i=0; i < nchan; ++i) {
1076 Double world;
1077 spc.toWorld(world, pixel[i]);
1078 stlout.push_back(double(world));
1079 }
1080 } else if ( Unit(us) == Unit("km/s") ) {
1081 Vector<Double> world;
1082 spc.pixelToVelocity(world, pixel);
1083 world.tovector(stlout);
1084 }
1085 return stlout;
1086}
[1360]1087void Scantable::setDirectionRefString( const std::string & refstr )
[987]1088{
1089 MDirection::Types mdt;
1090 if (refstr != "" && !MDirection::getType(mdt, refstr)) {
1091 throw(AipsError("Illegal Direction frame."));
1092 }
1093 if ( refstr == "" ) {
1094 String defaultstr = MDirection::showType(dirCol_.getMeasRef().getType());
1095 table_.rwKeywordSet().define("DIRECTIONREF", defaultstr);
1096 } else {
1097 table_.rwKeywordSet().define("DIRECTIONREF", String(refstr));
1098 }
1099}
[865]1100
[1360]1101std::string Scantable::getDirectionRefString( ) const
[987]1102{
1103 return table_.keywordSet().asString("DIRECTIONREF");
1104}
1105
1106MDirection Scantable::getDirection(int whichrow ) const
1107{
1108 String usertype = table_.keywordSet().asString("DIRECTIONREF");
1109 String type = MDirection::showType(dirCol_.getMeasRef().getType());
1110 if ( usertype != type ) {
1111 MDirection::Types mdt;
1112 if (!MDirection::getType(mdt, usertype)) {
1113 throw(AipsError("Illegal Direction frame."));
1114 }
1115 return dirCol_.convert(uInt(whichrow), mdt);
1116 } else {
1117 return dirCol_(uInt(whichrow));
1118 }
1119}
1120
[847]1121std::string Scantable::getAbcissaLabel( int whichrow ) const
1122{
[996]1123 if ( whichrow > int(table_.nrow()) ) throw(AipsError("Illegal ro number"));
[847]1124 const MPosition& mp = getAntennaPosition();
[987]1125 const MDirection& md = getDirection(whichrow);
[847]1126 const MEpoch& me = timeCol_(whichrow);
[1446]1127 //const Double& rf = mmolidCol_(whichrow);
1128 const Vector<Double> rf = moleculeTable_.getRestFrequency(mmolidCol_(whichrow));
[847]1129 SpectralCoordinate spc =
1130 freqTable_.getSpectralCoordinate(md, mp, me, rf, mfreqidCol_(whichrow));
1131
1132 String s = "Channel";
1133 Unit u = Unit(freqTable_.getUnitString());
1134 if (u == Unit("km/s")) {
[1170]1135 s = CoordinateUtil::axisLabel(spc, 0, True,True, True);
[847]1136 } else if (u == Unit("Hz")) {
1137 Vector<String> wau(1);wau = u.getName();
1138 spc.setWorldAxisUnits(wau);
[1170]1139 s = CoordinateUtil::axisLabel(spc, 0, True, True, False);
[847]1140 }
1141 return s;
1142
1143}
1144
[1446]1145/**
1146void asap::Scantable::setRestFrequencies( double rf, const std::string& name,
[1170]1147 const std::string& unit )
[1446]1148**/
1149void Scantable::setRestFrequencies( vector<double> rf, const vector<std::string>& name,
1150 const std::string& unit )
1151
[847]1152{
[923]1153 ///@todo lookup in line table to fill in name and formattedname
[847]1154 Unit u(unit);
[1446]1155 //Quantum<Double> urf(rf, u);
1156 Quantum<Vector<Double> >urf(rf, u);
1157 Vector<String> formattedname(0);
1158 //cerr<<"Scantable::setRestFrequnecies="<<urf<<endl;
1159
1160 //uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), name, "");
1161 uInt id = moleculeTable_.addEntry(urf.getValue("Hz"), mathutil::toVectorString(name), formattedname);
[847]1162 TableVector<uInt> tabvec(table_, "MOLECULE_ID");
1163 tabvec = id;
1164}
1165
[1446]1166/**
1167void asap::Scantable::setRestFrequencies( const std::string& name )
[847]1168{
1169 throw(AipsError("setRestFrequencies( const std::string& name ) NYI"));
1170 ///@todo implement
1171}
[1446]1172**/
1173void Scantable::setRestFrequencies( const vector<std::string>& name )
1174{
1175 throw(AipsError("setRestFrequencies( const vector<std::string>& name ) NYI"));
1176 ///@todo implement
1177}
[847]1178
[1360]1179std::vector< unsigned int > Scantable::rownumbers( ) const
[852]1180{
1181 std::vector<unsigned int> stlout;
1182 Vector<uInt> vec = table_.rowNumbers();
1183 vec.tovector(stlout);
1184 return stlout;
1185}
1186
[865]1187
[1360]1188Matrix<Float> Scantable::getPolMatrix( uInt whichrow ) const
[896]1189{
1190 ROTableRow row(table_);
1191 const TableRecord& rec = row.get(whichrow);
1192 Table t =
1193 originalTable_( originalTable_.col("SCANNO") == Int(rec.asuInt("SCANNO"))
1194 && originalTable_.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
1195 && originalTable_.col("IFNO") == Int(rec.asuInt("IFNO"))
1196 && originalTable_.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
1197 ROArrayColumn<Float> speccol(t, "SPECTRA");
1198 return speccol.getColumn();
1199}
[865]1200
[1360]1201std::vector< std::string > Scantable::columnNames( ) const
[902]1202{
1203 Vector<String> vec = table_.tableDesc().columnNames();
1204 return mathutil::tovectorstring(vec);
1205}
[896]1206
[1360]1207MEpoch::Types Scantable::getTimeReference( ) const
[915]1208{
1209 return MEpoch::castType(timeCol_.getMeasRef().getType());
[972]1210}
[915]1211
[1360]1212void Scantable::addFit( const STFitEntry& fit, int row )
[972]1213{
[1616]1214 //cout << mfitidCol_(uInt(row)) << endl;
1215 LogIO os( LogOrigin( "Scantable", "addFit()", WHERE ) ) ;
1216 os << mfitidCol_(uInt(row)) << LogIO::POST ;
[972]1217 uInt id = fitTable_.addEntry(fit, mfitidCol_(uInt(row)));
1218 mfitidCol_.put(uInt(row), id);
1219}
[915]1220
[1360]1221void Scantable::shift(int npix)
1222{
1223 Vector<uInt> fids(mfreqidCol_.getColumn());
1224 genSort( fids, Sort::Ascending,
1225 Sort::QuickSort|Sort::NoDuplicates );
1226 for (uInt i=0; i<fids.nelements(); ++i) {
1227 frequencies().shiftRefPix(npix, i);
1228 }
1229}
[987]1230
[1387]1231std::string asap::Scantable::getAntennaName() const
1232{
1233 String out;
1234 table_.keywordSet().get("AntennaName", out);
1235 return out;
[987]1236}
[1387]1237
1238int asap::Scantable::checkScanInfo(const std::vector<int>& scanlist) const
1239{
1240 String tbpath;
1241 int ret = 0;
1242 if ( table_.keywordSet().isDefined("GBT_GO") ) {
1243 table_.keywordSet().get("GBT_GO", tbpath);
1244 Table t(tbpath,Table::Old);
1245 // check each scan if other scan of the pair exist
1246 int nscan = scanlist.size();
1247 for (int i = 0; i < nscan; i++) {
1248 Table subt = t( t.col("SCAN") == scanlist[i]+1 );
1249 if (subt.nrow()==0) {
[1616]1250 //cerr <<"Scan "<<scanlist[i]<<" cannot be found in the scantable."<<endl;
1251 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1252 os <<LogIO::WARN<<"Scan "<<scanlist[i]<<" cannot be found in the scantable."<<LogIO::POST;
[1387]1253 ret = 1;
1254 break;
1255 }
1256 ROTableRow row(subt);
1257 const TableRecord& rec = row.get(0);
1258 int scan1seqn = rec.asuInt("PROCSEQN");
1259 int laston1 = rec.asuInt("LASTON");
1260 if ( rec.asuInt("PROCSIZE")==2 ) {
1261 if ( i < nscan-1 ) {
1262 Table subt2 = t( t.col("SCAN") == scanlist[i+1]+1 );
1263 if ( subt2.nrow() == 0) {
[1616]1264 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1265
1266 //cerr<<"Scan "<<scanlist[i+1]<<" cannot be found in the scantable."<<endl;
1267 os<<LogIO::WARN<<"Scan "<<scanlist[i+1]<<" cannot be found in the scantable."<<LogIO::POST;
[1387]1268 ret = 1;
1269 break;
1270 }
1271 ROTableRow row2(subt2);
1272 const TableRecord& rec2 = row2.get(0);
1273 int scan2seqn = rec2.asuInt("PROCSEQN");
1274 int laston2 = rec2.asuInt("LASTON");
1275 if (scan1seqn == 1 && scan2seqn == 2) {
1276 if (laston1 == laston2) {
[1616]1277 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1278 //cerr<<"A valid scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl;
1279 os<<"A valid scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<LogIO::POST;
[1387]1280 i +=1;
1281 }
1282 else {
[1616]1283 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1284 //cerr<<"Incorrect scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<endl;
1285 os<<LogIO::WARN<<"Incorrect scan pair ["<<scanlist[i]<<","<<scanlist[i+1]<<"]"<<LogIO::POST;
[1387]1286 }
1287 }
1288 else if (scan1seqn==2 && scan2seqn == 1) {
1289 if (laston1 == laston2) {
[1616]1290 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1291 //cerr<<"["<<scanlist[i]<<","<<scanlist[i+1]<<"] is a valid scan pair but in incorrect order."<<endl;
1292 os<<LogIO::WARN<<"["<<scanlist[i]<<","<<scanlist[i+1]<<"] is a valid scan pair but in incorrect order."<<LogIO::POST;
[1387]1293 ret = 1;
1294 break;
1295 }
1296 }
1297 else {
[1616]1298 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1299 //cerr<<"The other scan for "<<scanlist[i]<<" appears to be missing. Check the input scan numbers."<<endl;
1300 os<<LogIO::WARN<<"The other scan for "<<scanlist[i]<<" appears to be missing. Check the input scan numbers."<<LogIO::POST;
[1387]1301 ret = 1;
1302 break;
1303 }
1304 }
1305 }
1306 else {
[1616]1307 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1308 //cerr<<"The scan does not appear to be standard obsevation."<<endl;
1309 os<<LogIO::WARN<<"The scan does not appear to be standard obsevation."<<LogIO::POST;
[1387]1310 }
1311 //if ( i >= nscan ) break;
1312 }
1313 }
1314 else {
[1616]1315 LogIO os( LogOrigin( "Scantable", "checkScanInfo()", WHERE ) ) ;
1316 //cerr<<"No reference to GBT_GO table."<<endl;
1317 os<<LogIO::WARN<<"No reference to GBT_GO table."<<LogIO::POST;
[1387]1318 ret = 1;
1319 }
1320 return ret;
1321}
1322
1323std::vector<double> asap::Scantable::getDirectionVector(int whichrow) const
1324{
1325 Vector<Double> Dir = dirCol_(whichrow).getAngle("rad").getValue();
1326 std::vector<double> dir;
1327 Dir.tovector(dir);
1328 return dir;
1329}
1330
[1446]1331void asap::Scantable::reshapeSpectrum( int nmin, int nmax )
1332 throw( casa::AipsError )
1333{
1334 // assumed that all rows have same nChan
1335 Vector<Float> arr = specCol_( 0 ) ;
1336 int nChan = arr.nelements() ;
1337
1338 // if nmin < 0 or nmax < 0, nothing to do
1339 if ( nmin < 0 ) {
1340 throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ;
1341 }
1342 if ( nmax < 0 ) {
1343 throw( casa::indexError<int>( nmax, "asap::Scantable::reshapeSpectrum: Invalid range. Negative index is specified." ) ) ;
1344 }
1345
1346 // if nmin > nmax, exchange values
1347 if ( nmin > nmax ) {
1348 int tmp = nmax ;
1349 nmax = nmin ;
1350 nmin = tmp ;
[1616]1351 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ;
1352 os << "Swap values. Applied range is ["
1353 << nmin << ", " << nmax << "]" << LogIO::POST ;
[1446]1354 }
1355
1356 // if nmin exceeds nChan, nothing to do
1357 if ( nmin >= nChan ) {
1358 throw( casa::indexError<int>( nmin, "asap::Scantable::reshapeSpectrum: Invalid range. Specified minimum exceeds nChan." ) ) ;
1359 }
1360
1361 // if nmax exceeds nChan, reset nmax to nChan
1362 if ( nmax >= nChan ) {
1363 if ( nmin == 0 ) {
1364 // nothing to do
[1616]1365 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ;
1366 os << "Whole range is selected. Nothing to do." << LogIO::POST ;
[1446]1367 return ;
1368 }
1369 else {
[1616]1370 LogIO os( LogOrigin( "Scantable", "reshapeSpectrum()", WHERE ) ) ;
1371 os << "Specified maximum exceeds nChan. Applied range is ["
1372 << nmin << ", " << nChan-1 << "]." << LogIO::POST ;
[1446]1373 nmax = nChan - 1 ;
1374 }
1375 }
1376
1377 // reshape specCol_ and flagCol_
1378 for ( int irow = 0 ; irow < nrow() ; irow++ ) {
1379 reshapeSpectrum( nmin, nmax, irow ) ;
1380 }
1381
1382 // update FREQUENCIES subtable
1383 Double refpix ;
1384 Double refval ;
1385 Double increment ;
1386 int freqnrow = freqTable_.table().nrow() ;
1387 Vector<uInt> oldId( freqnrow ) ;
1388 Vector<uInt> newId( freqnrow ) ;
1389 for ( int irow = 0 ; irow < freqnrow ; irow++ ) {
1390 freqTable_.getEntry( refpix, refval, increment, irow ) ;
1391 /***
1392 * need to shift refpix to nmin
1393 * note that channel nmin in old index will be channel 0 in new one
1394 ***/
1395 refval = refval - ( refpix - nmin ) * increment ;
1396 refpix = 0 ;
1397 freqTable_.setEntry( refpix, refval, increment, irow ) ;
1398 }
1399
1400 // update nchan
1401 int newsize = nmax - nmin + 1 ;
1402 table_.rwKeywordSet().define( "nChan", newsize ) ;
1403
1404 // update bandwidth
1405 // assumed all spectra in the scantable have same bandwidth
1406 table_.rwKeywordSet().define( "Bandwidth", increment * newsize ) ;
1407
1408 return ;
[1387]1409}
[1446]1410
1411void asap::Scantable::reshapeSpectrum( int nmin, int nmax, int irow )
1412{
1413 // reshape specCol_ and flagCol_
1414 Vector<Float> oldspec = specCol_( irow ) ;
1415 Vector<uChar> oldflag = flagsCol_( irow ) ;
1416 uInt newsize = nmax - nmin + 1 ;
1417 specCol_.put( irow, oldspec( Slice( nmin, newsize, 1 ) ) ) ;
1418 flagsCol_.put( irow, oldflag( Slice( nmin, newsize, 1 ) ) ) ;
1419
1420 return ;
1421}
1422
1423void asap::Scantable::regridChannel( int nChan, double dnu )
1424{
[1616]1425 LogIO os( LogOrigin( "Scantable", "regridChannel()", WHERE ) ) ;
1426 os << "Regrid abcissa with channel number " << nChan << " and spectral resoultion " << dnu << "Hz." << LogIO::POST ;
[1446]1427 // assumed that all rows have same nChan
1428 Vector<Float> arr = specCol_( 0 ) ;
1429 int oldsize = arr.nelements() ;
1430
1431 // if oldsize == nChan, nothing to do
1432 if ( oldsize == nChan ) {
[1616]1433 os << "Specified channel number is same as current one. Nothing to do." << LogIO::POST ;
[1446]1434 return ;
1435 }
1436
1437 // if oldChan < nChan, unphysical operation
1438 if ( oldsize < nChan ) {
[1616]1439 os << "Unphysical operation. Nothing to do." << LogIO::POST ;
[1446]1440 return ;
1441 }
1442
1443 // change channel number for specCol_ and flagCol_
1444 Vector<Float> newspec( nChan, 0 ) ;
1445 Vector<uChar> newflag( nChan, false ) ;
1446 vector<string> coordinfo = getCoordInfo() ;
1447 string oldinfo = coordinfo[0] ;
1448 coordinfo[0] = "Hz" ;
1449 setCoordInfo( coordinfo ) ;
1450 for ( int irow = 0 ; irow < nrow() ; irow++ ) {
1451 regridChannel( nChan, dnu, irow ) ;
1452 }
1453 coordinfo[0] = oldinfo ;
1454 setCoordInfo( coordinfo ) ;
1455
1456
1457 // NOTE: this method does not update metadata such as
1458 // FREQUENCIES subtable, nChan, Bandwidth, etc.
1459
1460 return ;
1461}
1462
1463void asap::Scantable::regridChannel( int nChan, double dnu, int irow )
1464{
1465 // logging
1466 //ofstream ofs( "average.log", std::ios::out | std::ios::app ) ;
1467 //ofs << "IFNO = " << getIF( irow ) << " irow = " << irow << endl ;
1468
1469 Vector<Float> oldspec = specCol_( irow ) ;
1470 Vector<uChar> oldflag = flagsCol_( irow ) ;
1471 Vector<Float> newspec( nChan, 0 ) ;
1472 Vector<uChar> newflag( nChan, false ) ;
1473
1474 // regrid
1475 vector<double> abcissa = getAbcissa( irow ) ;
1476 int oldsize = abcissa.size() ;
1477 double olddnu = abcissa[1] - abcissa[0] ;
[1610]1478 //int refChan = 0 ;
1479 //double frac = 0.0 ;
1480 //double wedge = 0.0 ;
1481 //double pile = 0.0 ;
1482 int ichan = 0 ;
[1446]1483 double wsum = 0.0 ;
[1610]1484 Vector<Float> z( nChan ) ;
1485 z[0] = abcissa[0] - 0.5 * olddnu + 0.5 * dnu ;
1486 for ( int ii = 1 ; ii < nChan ; ii++ )
1487 z[ii] = z[ii-1] + dnu ;
1488 Vector<Float> zi( nChan+1 ) ;
1489 Vector<Float> yi( oldsize + 1 ) ;
1490 zi[0] = z[0] - 0.5 * dnu ;
1491 zi[1] = z[0] + 0.5 * dnu ;
1492 for ( int ii = 2 ; ii < nChan ; ii++ )
1493 zi[ii] = zi[ii-1] + dnu ;
1494 zi[nChan] = z[nChan-1] + 0.5 * dnu ;
1495 yi[0] = abcissa[0] - 0.5 * olddnu ;
1496 yi[1] = abcissa[1] + 0.5 * olddnu ;
1497 for ( int ii = 2 ; ii < oldsize ; ii++ )
1498 yi[ii] = abcissa[ii-1] + olddnu ;
1499 yi[oldsize] = abcissa[oldsize-1] + 0.5 * olddnu ;
1500 if ( dnu > 0.0 ) {
1501 for ( int ii = 0 ; ii < nChan ; ii++ ) {
1502 double zl = zi[ii] ;
1503 double zr = zi[ii+1] ;
1504 for ( int j = ichan ; j < oldsize ; j++ ) {
1505 double yl = yi[j] ;
1506 double yr = yi[j+1] ;
1507 if ( yl <= zl ) {
1508 if ( yr <= zl ) {
1509 continue ;
1510 }
1511 else if ( yr <= zr ) {
1512 newspec[ii] += oldspec[j] * ( yr - zl ) ;
1513 newflag[ii] = newflag[ii] || oldflag[j] ;
1514 wsum += ( yr - zl ) ;
1515 }
1516 else {
1517 newspec[ii] += oldspec[j] * dnu ;
1518 newflag[ii] = newflag[ii] || oldflag[j] ;
1519 wsum += dnu ;
1520 ichan = j ;
1521 break ;
1522 }
1523 }
1524 else if ( yl < zr ) {
1525 if ( yr <= zr ) {
1526 newspec[ii] += oldspec[j] * ( yr - yl ) ;
1527 newflag[ii] = newflag[ii] || oldflag[j] ;
1528 wsum += ( yr - yl ) ;
1529 }
1530 else {
1531 newspec[ii] += oldspec[j] * ( zr - yl ) ;
1532 newflag[ii] = newflag[ii] || oldflag[j] ;
1533 wsum += ( zr - yl ) ;
1534 ichan = j ;
1535 break ;
1536 }
1537 }
1538 else {
1539 ichan = j - 1 ;
1540 break ;
1541 }
1542 }
1543 newspec[ii] /= wsum ;
1544 wsum = 0.0 ;
1545 }
[1446]1546 }
[1610]1547 else if ( dnu < 0.0 ) {
1548 for ( int ii = 0 ; ii < nChan ; ii++ ) {
1549 double zl = zi[ii] ;
1550 double zr = zi[ii+1] ;
1551 for ( int j = ichan ; j < oldsize ; j++ ) {
1552 double yl = yi[j] ;
1553 double yr = yi[j+1] ;
1554 if ( yl >= zl ) {
1555 if ( yr >= zl ) {
1556 continue ;
1557 }
1558 else if ( yr >= zr ) {
1559 newspec[ii] += oldspec[j] * abs( yr - zl ) ;
1560 newflag[ii] = newflag[ii] || oldflag[j] ;
1561 wsum += abs( yr - zl ) ;
1562 }
1563 else {
1564 newspec[ii] += oldspec[j] * abs( dnu ) ;
1565 newflag[ii] = newflag[ii] || oldflag[j] ;
1566 wsum += abs( dnu ) ;
1567 ichan = j ;
1568 break ;
1569 }
1570 }
1571 else if ( yl > zr ) {
1572 if ( yr >= zr ) {
1573 newspec[ii] += oldspec[j] * abs( yr - yl ) ;
1574 newflag[ii] = newflag[ii] || oldflag[j] ;
1575 wsum += abs( yr - yl ) ;
1576 }
1577 else {
1578 newspec[ii] += oldspec[j] * abs( zr - yl ) ;
1579 newflag[ii] = newflag[ii] || oldflag[j] ;
1580 wsum += abs( zr - yl ) ;
1581 ichan = j ;
1582 break ;
1583 }
1584 }
1585 else {
1586 ichan = j - 1 ;
1587 break ;
1588 }
1589 }
1590 newspec[ii] /= wsum ;
1591 wsum = 0.0 ;
[1446]1592 }
1593 }
[1610]1594// * ichan = 0
1595// ***/
1596// //ofs << "olddnu = " << olddnu << ", dnu = " << dnu << endl ;
1597// pile += dnu ;
1598// wedge = olddnu * ( refChan + 1 ) ;
1599// while ( wedge < pile ) {
1600// newspec[0] += olddnu * oldspec[refChan] ;
1601// newflag[0] = newflag[0] || oldflag[refChan] ;
1602// //ofs << "channel " << refChan << " is included in new channel 0" << endl ;
1603// refChan++ ;
1604// wedge += olddnu ;
1605// wsum += olddnu ;
1606// //ofs << "newspec[0] = " << newspec[0] << " wsum = " << wsum << endl ;
1607// }
1608// frac = ( wedge - pile ) / olddnu ;
1609// wsum += ( 1.0 - frac ) * olddnu ;
1610// newspec[0] += ( 1.0 - frac ) * olddnu * oldspec[refChan] ;
1611// newflag[0] = newflag[0] || oldflag[refChan] ;
1612// //ofs << "channel " << refChan << " is partly included in new channel 0" << " with fraction of " << ( 1.0 - frac ) << endl ;
1613// //ofs << "newspec[0] = " << newspec[0] << " wsum = " << wsum << endl ;
1614// newspec[0] /= wsum ;
1615// //ofs << "newspec[0] = " << newspec[0] << endl ;
1616// //ofs << "wedge = " << wedge << ", pile = " << pile << endl ;
[1446]1617
[1610]1618// /***
1619// * ichan = 1 - nChan-2
1620// ***/
1621// for ( int ichan = 1 ; ichan < nChan - 1 ; ichan++ ) {
1622// pile += dnu ;
1623// newspec[ichan] += frac * olddnu * oldspec[refChan] ;
1624// newflag[ichan] = newflag[ichan] || oldflag[refChan] ;
1625// //ofs << "channel " << refChan << " is partly included in new channel " << ichan << " with fraction of " << frac << endl ;
1626// refChan++ ;
1627// wedge += olddnu ;
1628// wsum = frac * olddnu ;
1629// //ofs << "newspec[" << ichan << "] = " << newspec[ichan] << " wsum = " << wsum << endl ;
1630// while ( wedge < pile ) {
1631// newspec[ichan] += olddnu * oldspec[refChan] ;
1632// newflag[ichan] = newflag[ichan] || oldflag[refChan] ;
1633// //ofs << "channel " << refChan << " is included in new channel " << ichan << endl ;
1634// refChan++ ;
1635// wedge += olddnu ;
1636// wsum += olddnu ;
1637// //ofs << "newspec[" << ichan << "] = " << newspec[ichan] << " wsum = " << wsum << endl ;
1638// }
1639// frac = ( wedge - pile ) / olddnu ;
1640// wsum += ( 1.0 - frac ) * olddnu ;
1641// newspec[ichan] += ( 1.0 - frac ) * olddnu * oldspec[refChan] ;
1642// newflag[ichan] = newflag[ichan] || oldflag[refChan] ;
1643// //ofs << "channel " << refChan << " is partly included in new channel " << ichan << " with fraction of " << ( 1.0 - frac ) << endl ;
1644// //ofs << "wedge = " << wedge << ", pile = " << pile << endl ;
1645// //ofs << "newspec[" << ichan << "] = " << newspec[ichan] << " wsum = " << wsum << endl ;
1646// newspec[ichan] /= wsum ;
1647// //ofs << "newspec[" << ichan << "] = " << newspec[ichan] << endl ;
1648// }
1649
1650// /***
1651// * ichan = nChan-1
1652// ***/
1653// // NOTE: Assumed that all spectra have the same bandwidth
1654// pile += dnu ;
1655// newspec[nChan-1] += frac * olddnu * oldspec[refChan] ;
1656// newflag[nChan-1] = newflag[nChan-1] || oldflag[refChan] ;
1657// //ofs << "channel " << refChan << " is partly included in new channel " << nChan-1 << " with fraction of " << frac << endl ;
1658// refChan++ ;
1659// wedge += olddnu ;
1660// wsum = frac * olddnu ;
1661// //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << " wsum = " << wsum << endl ;
1662// for ( int jchan = refChan ; jchan < oldsize ; jchan++ ) {
1663// newspec[nChan-1] += olddnu * oldspec[jchan] ;
1664// newflag[nChan-1] = newflag[nChan-1] || oldflag[jchan] ;
1665// wsum += olddnu ;
1666// //ofs << "channel " << jchan << " is included in new channel " << nChan-1 << " with fraction of " << frac << endl ;
1667// //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << " wsum = " << wsum << endl ;
1668// }
1669// //ofs << "wedge = " << wedge << ", pile = " << pile << endl ;
1670// //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << " wsum = " << wsum << endl ;
1671// newspec[nChan-1] /= wsum ;
1672// //ofs << "newspec[" << nChan - 1 << "] = " << newspec[nChan-1] << endl ;
[1446]1673
[1610]1674// specCol_.put( irow, newspec ) ;
1675// flagsCol_.put( irow, newflag ) ;
[1446]1676
[1610]1677// // ofs.close() ;
[1446]1678
[1610]1679
[1446]1680 return ;
1681}
1682
1683}
1684//namespace asap
Note: See TracBrowser for help on using the repository browser.