Changeset 1978


Ignore:
Timestamp:
01/24/11 19:20:57 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2718

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Improved Filler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r1975 r1978  
    191191  // MAIN
    192192  // Iterate over several ids
    193   //
    194   // ITERATION: OBSERVATION_ID
    195   //
    196   TableIterator iter0( tablesel_, "OBSERVATION_ID" ) ;
    197   Int totalrow = 0 ;
    198193  Int oldnr = table_->nrow() ;
    199194  map<Int, uInt> ifmap ; // (IFNO, FREQ_ID) pair
     
    205200  ROMSPointingColumns pointCols( potabsel ) ;
    206201  String telescopeName ;
     202  //
     203  // ITERATION: OBSERVATION_ID
     204  //
     205  Int added0 = 0 ;
     206  Int current0 = table_->nrow() ;
     207  TableIterator iter0( tablesel_, "OBSERVATION_ID" ) ;
    207208  while( !iter0.pastEnd() ) {
    208209    MeasurementSet t0( iter0.table() ) ;
     
    218219    }
    219220    telescopeName = obsCols.telescopeName()(obsId) ;
     221    Int nbeam = 0 ;
    220222    //
    221223    // ITERATION: FEED1
    222224    //
    223     Int nbeam = 0 ;
     225    Int added1 = 0 ;
     226    Int current1 = table_->nrow() ;
    224227    TableIterator iter1( t0, "FEED1" ) ;
    225228    while( !iter1.pastEnd() ) {
     
    231234      // ITERATION: FIELD_ID
    232235      //
     236      Int added2 = 0 ;
     237      Int current2 = table_->nrow() ;
    233238      TableIterator iter2( t1, "FIELD_ID" ) ;
    234239      while( !iter2.pastEnd() ) {
     
    243248        // ITERATION: DATA_DESC_ID
    244249        //
     250        Int added3 = 0 ;
     251        Int current3 = table_->nrow() ;
    245252        TableIterator iter3( t2, "DATA_DESC_ID" ) ;
    246253        while( !iter3.pastEnd() ) {
     
    362369          // ITERATION: SCAN_NUMBER
    363370          //
     371          Int added4 = 0 ;
     372          Int current4 = table_->nrow() ;
    364373          TableIterator iter4( t3, "SCAN_NUMBER" ) ;
    365374          while( !iter4.pastEnd() ) {
     
    371380            // ITERATION: STATE_ID
    372381            //
     382            Int added5 = 0 ;
     383            Int current5 = table_->nrow() ;
    373384            TableIterator iter5( t4, "STATE_ID" ) ;
    374385            while( !iter5.pastEnd() ) {
     
    484495              RefRows rows( prevnr, prevnr+addednr-1 ) ;
    485496
    486               // SCANNO
    487               ScalarColumn<uInt> scannoCol( table_->table(), "SCANNO" ) ;
    488               Vector<uInt> scanno( addednr, scanNum ) ;
    489               scannoCol.putColumnCells( rows, scanno ) ;
    490               //fillId( (uInt)scanNum, "SCANNO", rows ) ;
    491 
    492497              // CYCLENO
    493498              ScalarColumn<uInt> cyclenoCol( table_->table(), "CYCLENO" ) ;
     
    501506              }
    502507              cycle += nrow ;
    503 
    504               // BEAMNO
    505               ScalarColumn<uInt> beamnoCol( table_->table(), "BEAMNO" ) ;
    506               Vector<uInt> beamno( addednr, feedId ) ;
    507               beamnoCol.putColumnCells( rows, beamno ) ;
    508               //fillId( (uInt)feedId, "BEAMNO", rows ) ;
    509 
    510               // IFNO
    511               ScalarColumn<uInt> ifnoCol( table_->table(), "IFNO" ) ;
    512               Vector<uInt> ifno( addednr, spwId ) ;
    513               ifnoCol.putColumnCells( rows, ifno ) ;
    514               //fillId( (uInt)spwId, "IFNO", rows ) ;
    515508
    516509              // POLNO
     
    535528              }
    536529
    537               // FREQ_ID
    538               ScalarColumn<uInt> freqIdCol( table_->table(), "FREQ_ID" ) ;
    539               Vector<uInt> freqIds( addednr, ifmap[spwId] ) ;
    540               freqIdCol.putColumnCells( rows, freqIds ) ;
    541               //fillId( ifmap[spwId], "FREQ_ID", rows ) ;
    542 
    543               // MOLECULE_ID
    544               ScalarColumn<uInt> moleculeIdCol( table_->table(), "MOLECULE_ID" ) ;
    545               Vector<uInt> moleculeId( addednr, molId ) ;
    546               moleculeIdCol.putColumnCells( rows, moleculeId ) ;
    547              
    548               // REFBEAMNO
    549               // set 0 at the moment
    550               ScalarColumn<Int> refBeamCol( table_->table(), "REFBEAMNO" ) ;
    551               Vector<Int> refBeam( addednr, 0 ) ;
    552               refBeamCol.putColumnCells( rows, refBeam ) ;
    553               //fillId( 0, "REFBEAMNO", rows ) ;
    554              
    555 
    556530              // FLAGROW
    557531              ScalarColumn<uInt> flagRowCol( table_->table(), "FLAGROW" ) ;
     
    587561              }
    588562
    589 
    590               // SRCNAME
    591               ScalarColumn<String> srcNameCol( table_->table(), "SRCNAME" ) ;
    592               Vector<String> vSrcName( addednr, srcName ) ;
    593               srcNameCol.putColumnCells( rows, vSrcName ) ;
    594 
    595563              // SRCTYPE
    596564              ScalarColumn<Int> srcTypeCol( table_->table(), "SRCTYPE" ) ;
     
    598566              srcTypeCol.putColumnCells( rows, srcType ) ;
    599567
    600               // FIELDNAME
    601               ScalarColumn<String> fieldNameCol( table_->table(), "FIELDNAME" ) ;
    602               Vector<String> vFieldName( addednr, fieldName ) ;
    603               fieldNameCol.putColumnCells( rows, vFieldName ) ;
    604              
    605568              // TSYS
    606569              ArrayColumn<Float> tsysCol( table_->table(), "TSYS" ) ;
     
    640603                tsysCol.putColumnCells( rows, tsys ) ;
    641604              }
    642 
    643605
    644606              // DIRECTION, AZIMUTH, ELEVATION, SCANRATE
     
    746708              }
    747709
    748               // OPACITY
    749               // not used?
    750               ScalarColumn<Float> opacityCol( table_->table(), "OPACITY" ) ;
    751               Vector<Float> opacity( addednr, 0.0 ) ;
    752               opacityCol.putColumnCells( rows, opacity ) ;
    753 
    754 
    755710              // TCAL_ID
    756711              ScalarColumn<uInt> tcalIdCol( table_->table(), "TCAL_ID" ) ;
     
    772727              }
    773728
    774               // FIT_ID
    775               // nothing to do
    776               ScalarColumn<Int> fitIdCol( table_->table(), "FIT_ID" ) ;
    777               Vector<Int> fitId( addednr, -1 ) ;
    778               fitIdCol.putColumnCells( rows, fitId ) ;
    779 
    780 
    781               // FOCUS_ID
    782               // tentative
    783               ScalarColumn<uInt> focusIdCol( table_->table(), "FOCUS_ID" ) ;
    784               Vector<uInt> focusId( addednr, 0 ) ;
    785               focusIdCol.putColumnCells( rows, focusId ) ;
    786 
    787 
    788729              // WEATHER_ID
    789730              uInt widprev = 0 ;
     
    807748              }
    808749             
    809               // SRCVELOCITY, SRCPROPERMOTION and SRCDIRECTION
    810               // no reference conversion for direction at the moment (assume J2000)
    811               // no reference conversion for velocity at the moment (assume LSRK)
    812               ArrayColumn<Double> srcPMCol( table_->table(), "SRCPROPERMOTION" ) ;
    813               ArrayColumn<Double> srcDirCol( table_->table(), "SRCDIRECTION" ) ;
    814               ScalarColumn<Double> srcVelCol( table_->table(), "SRCVELOCITY" ) ;
    815               for ( int i = 0 ; i < addednr ; i++ ) {
    816                 int idx = i + prevnr ;
    817                 srcPMCol.put( idx, srcPM ) ;   // [rad/s]
    818                 srcDirCol.put( idx, srcDir ) ; // [rad]
    819                 srcVelCol.put( idx, sysVel ) ; // [m/s]
    820               }
    821 
    822 
    823750              //os_ << "field: " << fieldId << " scan: " << scanNum << " obs: " << obsId << " state: " << stateId << " ddid: " << ddId << endl ;
    824751              //os_ << "t.nrow() = " << t5.nrow() << endl ;
    825               totalrow += t5.nrow() ;
    826               //os_ << "totalrow = " << totalrow << LogIO::POST ;
     752              added5 += addednr ;
    827753              iter5.next() ;
    828754            }
     755
     756            // SCANNO
     757            RefRows rows5( current5, current5+added5-1 ) ;
     758            Vector<uInt> scanno( added5, scanNum ) ;
     759            ScalarColumn<uInt> scannoCol( table_->table(), "SCANNO" ) ;
     760            scannoCol.putColumnCells( rows5, scanno ) ;
     761
     762            added4 += added5 ;
    829763            iter4.next() ;
    830764          }
     765
     766          // IFNO
     767          RefRows rows4( current4, current4+added4-1 ) ;
     768          Vector<uInt> shareduIArr( added4, spwId ) ;
     769          ScalarColumn<uInt> shareduIArrCol( table_->table(), "IFNO" ) ;
     770          shareduIArrCol.putColumnCells( rows4, shareduIArr ) ;
     771
     772          // FREQ_ID
     773          shareduIArr = ifmap[spwId] ;
     774          shareduIArrCol.attach( table_->table(), "FREQ_ID" ) ;
     775          shareduIArrCol.putColumnCells( rows4, shareduIArr ) ;
     776
     777          // MOLECULE_ID
     778          shareduIArr = molId ;
     779          shareduIArrCol.attach( table_->table(), "MOLECULE_ID" ) ;
     780          shareduIArrCol.putColumnCells( rows4, shareduIArr ) ;
     781
     782          // SRCNAME
     783          ScalarColumn<String> srcNameCol( table_->table(), "SRCNAME" ) ;
     784          Vector<String> vSrcName( added4, srcName ) ;
     785          srcNameCol.putColumnCells( rows4, vSrcName ) ;
     786
     787          // SRCVELOCITY, SRCPROPERMOTION and SRCDIRECTION
     788          // no reference conversion for direction at the moment (assume J2000)
     789          // no reference conversion for velocity at the moment (assume LSRK)
     790          Matrix<Double> sharedDArr( 2, added4 ) ;
     791          for ( uInt icol = 0 ; icol < added4 ; icol++ ) {
     792            sharedDArr.column(icol) = srcPM ;
     793          }
     794          ArrayColumn<Double> sharedDArrCol( table_->table(), "SRCPROPERMOTION" ) ;
     795          sharedDArrCol.putColumnCells( rows4, sharedDArr ) ;
     796          for ( uInt icol = 0 ; icol < added4 ; icol++ ) {
     797            sharedDArr.column(icol) = srcDir ;
     798          }         
     799          sharedDArrCol.attach( table_->table(), "SRCDIRECTION" ) ;
     800          sharedDArrCol.putColumnCells( rows4, sharedDArr ) ;
     801          ScalarColumn<Double> sysVelCol( table_->table(), "SRCVELOCITY" ) ;
     802          Vector<Double> sysVelArr( added4, sysVel ) ;
     803          sysVelCol.putColumnCells( rows4, sysVelArr ) ;
     804
     805          added3 += added4 ;
    831806          iter3.next() ;
    832807        }
     808
     809        // FIELDNAME
     810        RefRows rows3( current3, current3+added3-1 ) ;
     811        Vector<String> vFieldName( added3, fieldName ) ;
     812        ScalarColumn<String> fieldNameCol( table_->table(), "FIELDNAME" ) ;
     813        fieldNameCol.putColumnCells( rows3, vFieldName ) ;
     814
     815        added2 += added3 ;
    833816        iter2.next() ;
    834817      }
     818
     819      // BEAMNO
     820      RefRows rows2( current2, current2+added2-1 ) ;
     821      Vector<uInt> beamno( added2, feedId ) ;
     822      ScalarColumn<uInt> beamnoCol( table_->table(), "BEAMNO" ) ;
     823      beamnoCol.putColumnCells( rows2, beamno ) ;
     824
     825      // FOCUS_ID
     826      // tentative
     827      beamnoCol.attach( table_->table(), "FOCUS_ID" ) ;
     828      beamno = 0 ;
     829      beamnoCol.putColumnCells( rows2, beamno ) ;
     830
     831      added1 += added2 ;
    835832      iter1.next() ;
    836833    }
    837834    if ( sdh.nbeam < nbeam ) sdh.nbeam = nbeam ;
     835
     836    added0 += added1 ;
    838837    iter0.next() ;
    839838  }
    840839
    841   // Keywords
     840  // REFBEAMNO
     841  // set 0 at the moment
     842  ScalarColumn<Int> sharedICol( table_->table(), "REFBEAMNO" ) ;
     843  Vector<Int> sharedI( added0, 0 ) ;
     844  sharedICol.putColumn( sharedI ) ;
     845
     846  // OPACITY
     847  // not used?
     848  ScalarColumn<Float> opacityCol( table_->table(), "OPACITY" ) ;
     849  Vector<Float> opacity( added0, 0.0 ) ;
     850  opacityCol.putColumn( opacity ) ;
     851 
     852  // FIT_ID
     853  // nothing to do
     854  sharedICol.attach( table_->table(), "FIT_ID" ) ;
     855  sharedI = -1 ;
     856  sharedICol.putColumn( sharedI ) ;
     857
     858
     859  // Table Keywords
    842860  sdh.nif = ifmap.size() ;
    843861  String antennaName = antCols.name()(antenna_) ;
Note: See TracChangeset for help on using the changeset viewer.