- Timestamp:
- 02/23/06 11:21:24 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r805 r841 370 370 int width ) 371 371 { 372 if ( !in-> selection().empty() ) throw(AipsError("Can't bin subset of the data."));372 if ( !in->getSelection().empty() ) throw(AipsError("Can't bin subset of the data.")); 373 373 CountedPtr< Scantable > out = getScantable(in, false); 374 374 Table& tout = out->table(); … … 797 797 return out; 798 798 } 799 800 CountedPtr< Scantable > 801 STMath::merge( const std::vector< CountedPtr < Scantable > >& in ) 802 { 803 if ( in.size() < 2 ) { 804 throw(AipsError("Need at least two scantables to perform merge.")); 805 } 806 std::vector<CountedPtr < Scantable > >::const_iterator it = in.begin(); 807 ++it; 808 bool insitu = insitu_; 809 setInsitu(false); 810 CountedPtr< Scantable > out = getScantable(in[0], false); 811 setInsitu(insitu); 812 Table& tout = out->table(); 813 cout << "nrows " << in[1]->table().nrow() << endl; 814 ScalarColumn<uInt> freqidcol(tout,"FREQ_ID"), molidcol(tout, "MOLECULE_ID"); 815 ScalarColumn<uInt> scannocol(tout,"SCANNO"),focusidcol(tout,"FOCUS_ID"); 816 uInt newscanno = max(scannocol.getColumn())+1; 817 while ( it != in.end() ){ 818 if ( ! (*it)->conformant(*out) ) { 819 // log message: "ignoring scantable i, as it isn't 820 // conformant with the other(s)" 821 cerr << "oh oh" << endl; 822 ++it; 823 continue; 824 } 825 const Table& tab = (*it)->table(); 826 TableIterator scanit(tab, "SCANNO"); 827 while (!scanit.pastEnd()) { 828 TableIterator freqit(scanit.table(), "FREQ_ID"); 829 while ( !freqit.pastEnd() ) { 830 Table thetab = freqit.table(); 831 uInt nrow = tout.nrow(); 832 //tout.addRow(thetab.nrow()); 833 TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow()); 834 ROTableRow row(thetab); 835 for ( uInt i=0; i<thetab.nrow(); ++i) { 836 uInt k = nrow+i; 837 scannocol.put(k, newscanno); 838 const TableRecord& rec = row.get(i); 839 Double rv,rp,inc; 840 (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID")); 841 uInt id; 842 id = out->frequencies().addEntry(rp, rv, inc); 843 freqidcol.put(k,id); 844 String name,fname;Double rf; 845 (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID")); 846 id = out->molecules().addEntry(rf, name, fname); 847 molidcol.put(k, id); 848 Float frot,fang,ftan; 849 (*it)->focus().getEntry(frot, fang, ftan, rec.asuInt("FOCUS_ID")); 850 id = out->focus().addEntry(frot, fang, ftan); 851 focusidcol.put(k, id); 852 } 853 ++freqit; 854 } 855 ++newscanno; 856 ++scanit; 857 } 858 ++it; 859 } 860 return out; 861 } -
trunk/src/STMath.h
r834 r841 96 96 float tau); 97 97 98 casa::CountedPtr<Scantable> 99 merge(const std::vector<casa::CountedPtr<Scantable> >& in); 100 98 101 /// @todo frequency alignment 99 102
Note:
See TracChangeset
for help on using the changeset viewer.