Changeset 2900 for trunk/src/STMath.cpp
- Timestamp:
- 03/12/14 12:23:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r2899 r2900 2541 2541 2542 2542 CountedPtr< Scantable > 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; 2543 STMath::merge( const std::vector< CountedPtr < Scantable > >& in, 2544 const std::string &freqTol ) 2545 { 2546 Double freqTolInHz = 1.0; // default is 1.0Hz according to concat task 2550 2547 if (freqTol.size() > 0) { 2551 2548 Quantum<Double> freqTolInQuantity; … … 2558 2555 freqTolInHz = freqTolInQuantity.getValue("Hz"); 2559 2556 } 2560 **/2561 2557 2562 2558 if ( in.size() < 2 ) { … … 2579 2575 uInt newscanno = max(scannos)+1; 2580 2576 ++it; 2577 2578 // new IFNO 2579 uInt ifnoCounter = max(ifnocol.getColumn()) + 1; 2580 2581 2581 while ( it != in.end() ){ 2582 /**2583 2582 // Check FREQUENCIES/BASEFRAME 2584 2583 if ( out->frequencies().getFrame(true) != (*it)->frequencies().getFrame(true) ) { 2585 2584 throw(AipsError("BASEFRAME is not identical")); 2586 2585 } 2587 **/2588 2586 2589 2587 if ( ! (*it)->conformant(*out) ) { … … 2621 2619 (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID")); 2622 2620 uInt id; 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 //} 2621 2622 // default value is new unique IFNO 2623 uInt newifno = ifnoCounter; 2624 uInt nchan = rec.asArrayFloat("SPECTRA").shape()[0]; 2625 //id = out->frequencies().addEntry(rp, rv, inc); 2626 if ( !out->frequencies().match(rp, rv, inc, freqTolInHz, id) ) { 2627 // add new entry to FREQUENCIES table 2628 id = out->frequencies().addEntry(rp, rv, inc); 2629 2630 // increment counter for IFNO 2631 ifnoCounter++; 2632 } 2633 else { 2634 // should renumber IFNO to be same as existing rows that have same FREQ_ID 2635 LogIO os(LogOrigin("STMath", "merge", WHERE)); 2636 Table outFreqIdSelected = tout(tout.col("FREQ_ID") == id); 2637 TableIterator _iter(outFreqIdSelected, "IFNO"); 2638 map<uInt, uInt> nchanMap; 2639 while (!_iter.pastEnd()) { 2640 const Table _table = _iter.table(); 2641 ROTableRow _row(_table); 2642 const TableRecord &_rec = _row.get(0); 2643 uInt nchan = _rec.asArrayFloat("SPECTRA").shape()[0]; 2644 if (nchanMap.find(nchan) != nchanMap.end()) { 2645 throw(AipsError("There are non-unique IFNOs assigned to spectra that have same FREQ_ID and same nchan. Something wrong.")); 2646 } 2647 nchanMap[nchan] = _rec.asuInt("IFNO"); 2648 _iter.next(); 2649 } 2650 2651 os << LogIO::DEBUGGING << "nchanMap for " << id << ":" << LogIO::POST; 2652 for (map<uInt, uInt>::iterator i = nchanMap.begin(); i != nchanMap.end(); ++i) { 2653 os << LogIO::DEBUGGING << "nchanMap[" << i->first << "] = " << i->second << LogIO::POST; 2654 } 2655 2656 if (nchanMap.find(nchan) == nchanMap.end()) { 2657 // increment counter for IFNO 2658 ifnoCounter++; 2659 } 2660 else { 2661 // renumber IFNO to be same as existing value that corresponds to nchan 2662 newifno = nchanMap[nchan]; 2663 } 2664 os << LogIO::DEBUGGING << "newifno = " << newifno << LogIO::POST; 2665 } 2627 2666 thecolvals = id; 2628 2667 freqidcol.putColumnRange(slice, thecolvals); 2668 2669 thecolvals = newifno; 2670 ifnocol.putColumnRange(slice, thecolvals); 2629 2671 2630 2672 // Set the proper MOLECULE_ID
Note: See TracChangeset
for help on using the changeset viewer.