Changeset 2905 for trunk


Ignore:
Timestamp:
03/13/14 17:24:50 (10 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-5875

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_sdcoadd

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

MOLECULE_ID is renumbered when IFNO is merged so that each IFNO has unique MOLECULE_ID.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2904 r2905  
    25812581  uInt ifnoCounter = max(ifnocol.getColumn()) + 1;
    25822582 
     2583  // Here we assume that each IFNO has unique MOLECULE_ID
     2584  // molIdMap:
     2585  //    KEY: IFNO
     2586  //    VALUE: MOLECULE_ID
     2587  map<uInt, uInt> molIdMap;
     2588  {
     2589    TableIterator ifit(tout, "IFNO");
     2590    while (!ifit.pastEnd()) {
     2591      ROTableRow row(ifit.table());
     2592      const TableRecord& rec = row.get(0);
     2593      molIdMap[rec.asuInt("IFNO")] = rec.asuInt("MOLECULE_ID");
     2594      ifit.next();
     2595    }
     2596  }
     2597 
    25832598  while ( it != in.end() ){
    25842599    // Check FREQUENCIES/BASEFRAME
     
    25992614    cols[1] = String("MOLECULE_ID");
    26002615    cols[2] = String("FOCUS_ID");
    2601 
     2616   
    26022617    TableIterator scanit(tab, "SCANNO");
    26032618    while (!scanit.pastEnd()) {
     
    26242639        // default value is new unique IFNO
    26252640        uInt newifno = ifnoCounter;
     2641        Bool isIfMerged = False;
    26262642        uInt nchan = rec.asArrayFloat("SPECTRA").shape()[0];
    26272643        //id = out->frequencies().addEntry(rp, rv, inc);
     
    26632679            // renumber IFNO to be same as existing value that corresponds to nchan
    26642680            newifno = nchanMap[nchan];
     2681            isIfMerged = True;
    26652682          }
    26662683          os << LogIO::DEBUGGING << "newifno = " << newifno << LogIO::POST;
     
    26762693        (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID"));
    26772694        id = out->molecules().addEntry(rf, name, fname);
     2695        if (molIdMap.find(newifno) == molIdMap.end()) {
     2696          // add new entry to molIdMap
     2697          molIdMap[newifno] = id;
     2698        }
     2699        if (isIfMerged) {
     2700          id = molIdMap[newifno];
     2701        }
    26782702        thecolvals = id;
    26792703        molidcol.putColumnRange(slice, thecolvals);
Note: See TracChangeset for help on using the changeset viewer.