Changeset 2289 for trunk/src/STMath.cpp


Ignore:
Timestamp:
09/08/11 19:35:40 (13 years ago)
Author:
ShinnosukeKawakami
Message:

merged parallel branch to trunk

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src

  • trunk/src/STMath.cpp

    r2278 r2289  
    979979                                              const CountedPtr< Scantable >& caloff, Float tcal )
    980980{
    981 if ( ! calon->conformant(*caloff) ) {
     981  if ( ! calon->conformant(*caloff) ) {
    982982    throw(AipsError("'CAL on' and 'CAL off' scantables are not conformant."));
    983983  }
     
    987987  const Table& tcon = calon->table();
    988988  Vector<Float> tcalout;
    989   Vector<Float> tcalout2;  //debug
     989
     990  std::map<uInt,uInt> tcalIdToRecNoMap;
     991  const Table& calOffTcalTable = caloff->tcal().table();
     992  {
     993    ROScalarColumn<uInt> calOffTcalTable_IDcol(calOffTcalTable, "ID");
     994    const Vector<uInt> tcalIds(calOffTcalTable_IDcol.getColumn());
     995    size_t tcalIdsEnd = tcalIds.nelements();
     996    for (uInt i = 0; i < tcalIdsEnd; i++) {
     997      tcalIdToRecNoMap[tcalIds[i]] = i;
     998    }
     999  }
     1000  ROArrayColumn<Float> calOffTcalTable_TCALcol(calOffTcalTable, "TCAL");
    9901001
    9911002  if ( tout.nrow() != tcon.nrow() ) {
     
    10581069**/
    10591070      // get tcal if input tcal <= 0
    1060       String tcalt;
    10611071      Float tcalUsed;
    10621072      tcalUsed = tcal;
    10631073      if ( tcal <= 0.0 ) {
    1064         caloff->tcal().getEntry(tcalt, tcalout, tcalId);
     1074        uInt tcalRecNo = tcalIdToRecNoMap[tcalId];
     1075        calOffTcalTable_TCALcol.get(tcalRecNo, tcalout);
    10651076//         if (polno<=3) {
    10661077//           tcalUsed = tcalout[polno];
     
    24182429    out->appendToHistoryTable((*it)->history());
    24192430    const Table& tab = (*it)->table();
     2431
     2432    Block<String> cols(3);
     2433    cols[0] = String("FREQ_ID");
     2434    cols[1] = String("MOLECULE_ID");
     2435    cols[2] = String("FOCUS_ID");
     2436
    24202437    TableIterator scanit(tab, "SCANNO");
    24212438    while (!scanit.pastEnd()) {
    2422       TableIterator freqit(scanit.table(), "FREQ_ID");
    2423       while ( !freqit.pastEnd() ) {
    2424         Table thetab = freqit.table();
     2439      ScalarColumn<uInt> thescannocol(scanit.table(),"SCANNO");
     2440      Vector<uInt> thescannos(thescannocol.nrow(),newscanno);
     2441      thescannocol.putColumn(thescannos);
     2442      TableIterator subit(scanit.table(), cols);
     2443      while ( !subit.pastEnd() ) {
    24252444        uInt nrow = tout.nrow();
     2445        Table thetab = subit.table();
     2446        ROTableRow row(thetab);
     2447        Vector<uInt> thecolvals(thetab.nrow());
     2448        ScalarColumn<uInt> thefreqidcol(thetab,"FREQ_ID");
     2449        ScalarColumn<uInt> themolidcol(thetab, "MOLECULE_ID");
     2450        ScalarColumn<uInt> thefocusidcol(thetab,"FOCUS_ID");
     2451        // The selected subset of table should have
     2452        // the equal FREQ_ID, MOLECULE_ID, and FOCUS_ID values.
     2453        const TableRecord& rec = row.get(0);
     2454        // Set the proper FREQ_ID
     2455        Double rv,rp,inc;
     2456        (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID"));
     2457        uInt id;
     2458        id = out->frequencies().addEntry(rp, rv, inc);
     2459        thecolvals = id;
     2460        thefreqidcol.putColumn(thecolvals);
     2461        // Set the proper MOLECULE_ID
     2462        Vector<String> name,fname;Vector<Double> rf;
     2463        (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID"));
     2464        id = out->molecules().addEntry(rf, name, fname);
     2465        thecolvals = id;
     2466        themolidcol.putColumn(thecolvals);
     2467        // Set the proper FOCUS_ID
     2468        Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp;
     2469        (*it)->focus().getEntry(fpa, fax, ftan, frot, fhand, fmount,fuser,
     2470                                fxy, fxyp, rec.asuInt("FOCUS_ID"));
     2471        id = out->focus().addEntry(fpa, fax, ftan, frot, fhand, fmount,fuser,
     2472                                   fxy, fxyp);
     2473        thecolvals = id;
     2474        thefocusidcol.putColumn(thecolvals);
     2475
    24262476        tout.addRow(thetab.nrow());
    24272477        TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow());
    2428         ROTableRow row(thetab);
    2429         for ( uInt i=0; i<thetab.nrow(); ++i) {
    2430           uInt k = nrow+i;
    2431           scannocol.put(k, newscanno);
    2432           const TableRecord& rec = row.get(i);
    2433           Double rv,rp,inc;
    2434           (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID"));
    2435           uInt id;
    2436           id = out->frequencies().addEntry(rp, rv, inc);
    2437           freqidcol.put(k,id);
    2438           //String name,fname;Double rf;
    2439           Vector<String> name,fname;Vector<Double> rf;
    2440           (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID"));
    2441           id = out->molecules().addEntry(rf, name, fname);
    2442           molidcol.put(k, id);
    2443           Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp;
    2444           (*it)->focus().getEntry(fpa, fax, ftan, frot, fhand,
    2445                                   fmount,fuser, fxy, fxyp,
    2446                                   rec.asuInt("FOCUS_ID"));
    2447           id = out->focus().addEntry(fpa, fax, ftan, frot, fhand,
    2448                                      fmount,fuser, fxy, fxyp);
    2449           focusidcol.put(k, id);
    2450         }
    2451         ++freqit;
     2478
     2479        ++subit;
    24522480      }
    24532481      ++newscanno;
Note: See TracChangeset for help on using the changeset viewer.