Changeset 2899
- Timestamp:
- 03/11/14 14:17:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r2879 r2899 25 25 #include <casa/Exceptions/Error.h> 26 26 #include <casa/Logging/LogIO.h> 27 #include <casa/Quanta/Quantum.h> 27 28 28 29 #include <coordinates/Coordinates/CoordinateSystem.h> … … 2540 2541 2541 2542 CountedPtr< Scantable > 2542 STMath::merge( const std::vector< CountedPtr < Scantable > >& in ) 2543 { 2543 STMath::merge( const std::vector< CountedPtr < Scantable > >& in ) 2544 //STMath::merge( const std::vector< CountedPtr < Scantable > >& in, 2545 // const std::string &freqTol ) 2546 { 2547 /** 2548 LogIO os; 2549 Double freqTolInHz = 0.0; 2550 if (freqTol.size() > 0) { 2551 Quantum<Double> freqTolInQuantity; 2552 if (!Quantum<Double>::read(freqTolInQuantity, freqTol)) { 2553 throw(AipsError("Failed to convert freqTol string to quantity")); 2554 } 2555 if (!freqTolInQuantity.isConform("Hz")) { 2556 throw(AipsError("Invalid freqTol string")); 2557 } 2558 freqTolInHz = freqTolInQuantity.getValue("Hz"); 2559 } 2560 **/ 2561 2544 2562 if ( in.size() < 2 ) { 2545 2563 throw(AipsError("Need at least two scantables to perform a merge.")); … … 2553 2571 ScalarColumn<uInt> freqidcol(tout,"FREQ_ID"), molidcol(tout, "MOLECULE_ID"); 2554 2572 ScalarColumn<uInt> scannocol(tout,"SCANNO"), focusidcol(tout,"FOCUS_ID"); 2573 ScalarColumn<uInt> ifnocol(tout, "IFNO"); 2555 2574 // Renumber SCANNO to be 0-based 2556 2575 Vector<uInt> scannos = scannocol.getColumn(); … … 2561 2580 ++it; 2562 2581 while ( it != in.end() ){ 2582 /** 2583 // Check FREQUENCIES/BASEFRAME 2584 if ( out->frequencies().getFrame(true) != (*it)->frequencies().getFrame(true) ) { 2585 throw(AipsError("BASEFRAME is not identical")); 2586 } 2587 **/ 2588 2563 2589 if ( ! (*it)->conformant(*out) ) { 2564 2590 // non conformant. … … 2576 2602 TableIterator scanit(tab, "SCANNO"); 2577 2603 while (!scanit.pastEnd()) { 2578 ScalarColumn<uInt> thescannocol(scanit.table(),"SCANNO");2579 Vector<uInt> thescannos(thescannocol.nrow(),newscanno);2580 thescannocol.putColumn(thescannos);2581 2604 TableIterator subit(scanit.table(), cols); 2582 2605 while ( !subit.pastEnd() ) { … … 2585 2608 ROTableRow row(thetab); 2586 2609 Vector<uInt> thecolvals(thetab.nrow()); 2587 ScalarColumn<uInt> thefreqidcol(thetab,"FREQ_ID");2588 ScalarColumn<uInt> themolidcol(thetab, "MOLECULE_ID");2589 ScalarColumn<uInt> thefocusidcol(thetab,"FOCUS_ID");2590 2610 // The selected subset of table should have 2591 2611 // the equal FREQ_ID, MOLECULE_ID, and FOCUS_ID values. 2592 2612 const TableRecord& rec = row.get(0); 2613 tout.addRow(thetab.nrow()); 2614 TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow()); 2615 2616 Slicer slice(IPosition(1, nrow), IPosition(1, thetab.nrow()), 2617 Slicer::endIsLength); 2618 2593 2619 // Set the proper FREQ_ID 2594 2620 Double rv,rp,inc; … … 2596 2622 uInt id; 2597 2623 id = out->frequencies().addEntry(rp, rv, inc); 2624 //if ( !out->frequencies().match(rp, rv, inc, freqTolInHz, id) ) { 2625 // id = out->frequencies().addEntry(rp, rv, inc); 2626 //} 2598 2627 thecolvals = id; 2599 thefreqidcol.putColumn(thecolvals); 2628 freqidcol.putColumnRange(slice, thecolvals); 2629 2600 2630 // Set the proper MOLECULE_ID 2601 2631 Vector<String> name,fname;Vector<Double> rf; … … 2603 2633 id = out->molecules().addEntry(rf, name, fname); 2604 2634 thecolvals = id; 2605 themolidcol.putColumn(thecolvals); 2635 molidcol.putColumnRange(slice, thecolvals); 2636 2606 2637 // Set the proper FOCUS_ID 2607 2638 Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp; … … 2611 2642 fxy, fxyp); 2612 2643 thecolvals = id; 2613 thefocusidcol.putColumn(thecolvals); 2614 2615 tout.addRow(thetab.nrow()); 2616 TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow()); 2644 focusidcol.putColumnRange(slice, thecolvals); 2645 2646 // Set the proper SCANNO 2647 thecolvals = newscanno; 2648 scannocol.putColumnRange(slice, thecolvals); 2617 2649 2618 2650 ++subit;
Note:
See TracChangeset
for help on using the changeset viewer.