Changeset 865
- Timestamp:
- 03/06/06 10:39:18 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r860 r865 85 85 type_(ttype) 86 86 { 87 Table tab(name );87 Table tab(name, Table::Update); 88 88 Int version; 89 89 tab.keywordSet().get("VERSION", version); … … 104 104 // with or without data 105 105 String newname = String(generateName()); 106 type_ = other.table_.tableType(); 106 107 if ( other.table_.tableType() == Table::Memory ) { 107 108 if ( clear ) { 108 cout << "copy ctor memory clear" << endl;109 109 table_ = TableCopy::makeEmptyMemoryTable(newname, 110 110 other.table_, True); … … 112 112 table_ = other.table_.copyToMemoryTable(newname); 113 113 } else { 114 if ( clear ) { 115 cout << "copy ctor clear" << endl; 116 other.table_.deepCopy(newname, Table::New); 117 cout << "reading table" << endl; 118 table_ = Table(newname, Table::Scratch); 119 cout << "removing rows" << endl; 120 table_.removeRow(table_.rowNumbers()); 121 122 } else { 123 cout << "copy ctor no clear" << endl; 124 other.table_.deepCopy(newname, Table::Scratch); 125 table_ = Table(newname, Table::Scratch); 126 } 127 } 128 //table_.rwKeywordSet().renameTables(newname, table_.tableName()); 129 //cout << table_.keywordSet().asTable("TCAL").tableName() << endl; 114 other.table_.deepCopy(newname, Table::New, False, Table::AipsrcEndian, 115 Bool(clear)); 116 table_ = Table(newname, Table::Update); 117 copySubtables(other); 118 table_.markForDelete(); 119 } 120 130 121 attachSubtables(); 131 122 originalTable_ = table_; 132 123 attach(); 124 } 125 126 void Scantable::copySubtables(const Scantable& other) { 127 Table t = table_.rwKeywordSet().asTable("FREQUENCIES"); 128 TableCopy::copyRows(t, other.freqTable_.table()); 129 t = table_.rwKeywordSet().asTable("FOCUS"); 130 TableCopy::copyRows(t, other.focusTable_.table()); 131 t = table_.rwKeywordSet().asTable("WEATHER"); 132 TableCopy::copyRows(t, other.weatherTable_.table()); 133 t = table_.rwKeywordSet().asTable("TCAL"); 134 TableCopy::copyRows(t, other.tcalTable_.table()); 135 t = table_.rwKeywordSet().asTable("MOLECULES"); 136 TableCopy::copyRows(t, other.moleculeTable_.table()); 137 t = table_.rwKeywordSet().asTable("HISTORY"); 138 TableCopy::copyRows(t, other.historyTable_.table()); 133 139 } 134 140 … … 235 241 specCol_.attach(table_, "SPECTRA"); 236 242 flagsCol_.attach(table_, "FLAGTRA"); 237 ts Col_.attach(table_, "TSYS");243 tsysCol_.attach(table_, "TSYS"); 238 244 cycleCol_.attach(table_,"CYCLENO"); 239 245 scanCol_.attach(table_, "SCANNO"); … … 390 396 Path path(inname); 391 397 inname = path.expandedName(); 392 //cout << table_.tableName() << endl;393 //cout << freqTable_.table().tableName() << endl;394 398 table_.deepCopy(inname, Table::New); 395 //Table t = Table(inname, Table::Update);396 //cout << t.keywordSet().asTable("FREQUENCIES").tableName() << endl;397 399 } 398 400 … … 551 553 } 552 554 pushLog(String(oss)); 555 } 556 557 void Scantable::flag() 558 { 559 if ( selector_.empty() ) 560 throw(AipsError("Trying to flag whole scantable. Aborted.")); 553 561 } 554 562 … … 726 734 } 727 735 736 std::vector< double > asap::Scantable::getAbcissa( int whichrow ) const 737 { 738 if ( whichrow > table_.nrow() ) throw(AipsError("Illegal ro number")); 739 std::vector<double> stlout; 740 int nchan = specCol_(whichrow).nelements(); 741 cout << nchan << endl; 742 String us = freqTable_.getUnitString(); 743 if ( us == "" || us == "pixel" || us == "channel" ) { 744 for (int i=0; i<nchan; ++i) { 745 stlout.push_back(double(i)); 746 } 747 return stlout; 748 } 749 750 const MPosition& mp = getAntennaPosition(); 751 const MDirection& md = dirCol_(whichrow); 752 const MEpoch& me = timeCol_(whichrow); 753 Double rf = moleculeTable_.getRestFrequency(mmolidCol_(whichrow)); 754 SpectralCoordinate spc = 755 freqTable_.getSpectralCoordinate(md, mp, me, rf, mfreqidCol_(whichrow)); 756 Vector<Double> pixel(nchan); 757 Vector<Double> world; 758 indgen(pixel); 759 if ( Unit(us) == Unit("Hz") ) { 760 for ( int i=0; i < nchan; ++i) { 761 Double world; 762 spc.toWorld(world, pixel[i]); 763 stlout.push_back(double(world)); 764 } 765 } else if ( Unit(us) == Unit("km/s") ) { 766 Vector<Double> world; 767 spc.pixelToVelocity(world, pixel); 768 world.tovector(stlout); 769 } 770 return stlout; 771 } 772 728 773 std::string Scantable::getAbcissaLabel( int whichrow ) const 729 774 { … … 774 819 } 775 820 821 822 776 823 }//namespace asap -
trunk/src/Scantable.h
r860 r865 227 227 int getIF(int whichrow) const; 228 228 int getPol(int whichrow) const; 229 int getCycle(int whichrow) const { return cycleCol_(whichrow); } 230 int getScan(int whichrow) const { return scanCol_(whichrow); } 229 231 230 232 double getInterval(int whichrow) const 231 233 { return integrCol_(whichrow); } 232 234 233 float getTsys(int whichrow) const; 235 float getTsys(int whichrow) const 236 { return casa::Vector<casa::Float>(tsysCol_(whichrow))(0); } 234 237 float getElevation(int whichrow) const 235 238 { return elCol_(whichrow); } 236 239 float getAzimuth(int whichrow) const 237 240 { return azCol_(whichrow); } 238 float getPar angle(int whichrow) const241 float getParAngle(int whichrow) const 239 242 { return paraCol_(whichrow); } 243 244 std::string getSourceName(int whichrow) const 245 { return srcnCol_(whichrow); } 240 246 241 247 std::vector<bool> getMask(int whichrow) const; … … 277 283 void setCoordInfo(std::vector<string> theinfo) 278 284 { return freqTable_.setInfo(theinfo); }; 285 286 287 std::vector<double> getAbcissa(int whichrow) const; 279 288 280 289 std::string getAbcissaLabel(int whichrow) const; … … 329 338 330 339 void attachSubtables(); 340 void copySubtables(const Scantable& other); 341 331 342 /** 332 343 * Convert an "old" asap1 style row index into a new index … … 365 376 casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_; 366 377 casa::ScalarColumn<casa::Int> rbeamCol_; 367 casa::ArrayColumn<casa::Float> specCol_, ts Col_;378 casa::ArrayColumn<casa::Float> specCol_, tsysCol_; 368 379 casa::ArrayColumn<casa::uChar> flagsCol_; 369 380
Note:
See TracChangeset
for help on using the changeset viewer.