Changeset 865 for trunk/src/Scantable.cpp
- Timestamp:
- 03/06/06 10:39:18 (18 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.