Ignore:
Timestamp:
09/16/11 14:02:21 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1913

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: test_importasdm_sd

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Refactoring the code.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/oldasdm2ASAP/OldASDMFiller.cc

    r2273 r2301  
    103103
    104104  // CYCLENO
    105   unsigned int cycleno = 0 ;
     105  //unsigned int cycleno = 0 ;
     106  map< unsigned int, unsigned int > cycleno ;
     107  map< unsigned int, unsigned int >::iterator citer ;
    106108
    107109  for ( unsigned int ifield = 0 ; ifield < numFieldId ; ifield++ ) {
     
    125127        if ( !(reader_->setMainRow( irow )) ) {
    126128          // skip row since the row doesn't have valid configDescId
    127           //logsink_->postLocally( LogMessage("skip "+String::toString(irow),LogOrigin(className_,funcName,WHERE)) ) ;
     129          //logsink_->postLocally( LogMessage("skip "+String::toString(irow)+" since OldASDMReader::setMainrow() returns False",LogOrigin(className_,funcName,WHERE)) ) ;
    128130          continue ;
    129131        }
    130132
    131133        // scan and subscan
    132         unsigned int scanno = reader_->getScanNo() ;
     134        //unsigned int scanno = reader_->getScanNo() ;
     135        unsigned int scanno = reader_->getScanNoOfCurrentRow() ;
    133136        //uInt subscanno = reader_->getSubscanNo() ;
     137        citer = cycleno.find( scanno ) ;
     138        if ( citer == cycleno.end() )
     139          cycleno[scanno] = 0 ;
    134140
    135141        // set data
    136142        if ( !(reader_->setData()) ) {
    137143          // skip row since reader failed to retrieve data
    138           //logsink_->postLocally( LogMessage("skip "+String::toString(irow),LogOrigin(className_,funcName,WHERE)) ) ;
     144          //logsink_->postLocally( LogMessage("skip "+String::toString(irow)+" since OldASDMReader::setData() returns False",LogOrigin(className_,funcName,WHERE)) ) ;
    139145          continue ;
    140146        }
     
    147153
    148154        for ( unsigned int idata = 0 ; idata < numData ; idata++ ) {
     155          // prepare to extract binary data
     156          reader_->prepareData( idata ) ;
    149157
    150158          // subscan number
    151           unsigned int subscanno = reader_->getSubscanNo( idata ) ;
     159          //unsigned int subscanno = reader_->getSubscanNo( idata ) ;
     160          unsigned int subscanno = reader_->getSubscanNo() ;
    152161
    153162          // IFNO
    154           uInt ifno = reader_->getIFNo( idata ) ;
    155 
    156           // rest frequency
    157           vector<double> rf = reader_->getRestFrequency( idata ) ;
     163          //uInt ifno = reader_->getIFNo( idata ) ;
     164          uInt ifno = reader_->getIFNo() ;
     165
     166          // source spec
     167          int srctype = reader_->getSrcType( scanno, subscanno ) ;
     168          string srcname ;
     169          string fieldname ;
     170          vector<double> srcDirection ;
     171          vector<double> srcProperMotion ;
     172          double sysVel ;
     173          vector<double> rf ;
     174          //reader_->getSourceProperty( idata,
     175          //                            srcname,
     176          //                            fieldname,
     177          //                            srcDirection,
     178          //                            srcProperMotion,
     179          //                            sysVel,
     180          //                            rf ) ;
     181          reader_->getSourceProperty( srcname,
     182                                      fieldname,
     183                                      srcDirection,
     184                                      srcProperMotion,
     185                                      sysVel,
     186                                      rf ) ;
    158187         
    159188          // fill MOLECULE_ID and add MOLECULES row if necessary
     
    164193         
    165194          // time and interval
    166           casa::Double mjd = (casa::Double)(reader_->getTime( idata )) ;
    167           casa::Double interval = (casa::Double)(reader_->getInterval( idata )) ;
     195          //casa::Double mjd = (casa::Double)(reader_->getTime( idata )) ;
     196          //casa::Double interval = (casa::Double)(reader_->getInterval( idata )) ;
     197          casa::Double mjd = (casa::Double)(reader_->getTime()) ;
     198          casa::Double interval = (casa::Double)(reader_->getInterval()) ;
    168199
    169200          // fill TIME and INTERVAL
    170201          setTime( mjd, interval ) ;
    171 
    172 
    173           // source spec
    174           string srcname = reader_->getSourceName( idata ) ;
    175           string fieldname = reader_->getFieldName( idata ) ;
    176           int srctype = reader_->getSrcType( scanno, subscanno ) ;
    177           vector<double> srcDirection = reader_->getSourceDirection( idata ) ;
    178           //vector<double> srcDirection ;
    179           //string srcDirRef ;
    180           //reader_->getSourceDirection( idata, srcDirection, srcDirRef ) ;
    181           vector<double> srcProperMotion = reader_->getSourceProperMotion( idata ) ;
    182           double sysVel = reader_->getSysVel( idata ) ;
    183202         
    184203          // fill SRCNAME, SRCTYPE, FIELDNAME, SRCDIRECTION, SRCPROPERMOTION, and SRCVELOCITY
     
    192211
    193212          // fill FLAGROW
    194           unsigned int flagrow = reader_->getFlagRow( idata ) ;
     213          //unsigned int flagrow = reader_->getFlagRow( idata ) ;
     214          unsigned int flagrow = reader_->getFlagRow() ;
    195215          setFlagrow( (uInt)flagrow ) ;
    196216
     
    201221          float windspeed ;
    202222          float windaz ;
    203           reader_->getWeatherInfo( idata,
    204                                    temperature,
     223          //reader_->getWeatherInfo( idata,
     224          //                         temperature,
     225          //                         pressure,
     226          //                         humidity,
     227          //                         windspeed,
     228          //                         windaz ) ;
     229          reader_->getWeatherInfo( temperature,
    205230                                   pressure,
    206231                                   humidity,
     
    218243          double el ;
    219244          vector<double> srate ;
    220           reader_->getPointingInfo( idata,
    221                                     dir,
     245          //reader_->getPointingInfo( idata,
     246          //                          dir,
     247          //                          az,
     248          //                          el,
     249          //                          srate ) ;
     250          reader_->getPointingInfo( dir,
    222251                                    az,
    223252                                    el,
     
    246275          }
    247276          else {
    248             reader_->getFrequency( idata, refpix, refval, incr, freqref ) ;
     277            //reader_->getFrequency( idata, refpix, refval, incr, freqref ) ;
     278            reader_->getFrequency( refpix, refval, incr, freqref ) ;
    249279            refval = (double)toLSRK( casa::Double(refval),
    250280                                     String(freqref),
     
    261291
    262292          // loop on polarization
    263           vector<unsigned int> dataShape = reader_->getDataShape( idata ) ;
     293          //vector<unsigned int> dataShape = reader_->getDataShape( idata ) ;
     294          vector<unsigned int> dataShape = reader_->getDataShape() ;
    264295//           ostringstream oss ;
    265296//           for ( unsigned int i = 0 ; i < dataShape.size() ; i++ ) {
     
    271302//               oss << dataShape[i] << ", " ;
    272303//           }
    273 //           logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
     304          //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
    274305                                     
    275306          //int numPol = reader_->getNumPol( idata ) ;
     
    280311
    281312          // OPACITY
    282           vector<float> tau = reader_->getOpacity( idata ) ;
     313          //vector<float> tau = reader_->getOpacity( idata ) ;
     314          vector<float> tau = reader_->getOpacity() ;
    283315          Vector<casa::Float> opacity = toVector( tau, numPol ) ;
    284316
    285317          // SPECTRA, FLAGTRA, TSYS, TCAL
    286           float *sp = reader_->getSpectrum( idata ) ;
    287           //vector< vector<float> > ts = reader_->getTsys( idata ) ;
    288           //vector< vector<float> > tc = reader_->getTcal( idata ) ;
     318          //float *sp = reader_->getSpectrum( idata ) ;
     319          float *sp = reader_->getSpectrum() ;
    289320          vector< vector<float> > ts ;
    290321          vector< vector<float> > tc ;
    291           reader_->getTcalAndTsys( idata, tc, ts ) ;
     322          //reader_->getTcalAndTsys( idata, tc, ts ) ;
     323          reader_->getTcalAndTsys( tc, ts ) ;
    292324          Matrix<casa::Float> spectra = toMatrix( sp, numPol, numChan ) ;
    293325          Vector<uChar> flagtra( numChan, 0 ) ;
     
    302334
    303335            // fill SCANNO, CYCLENO, IFNO, POLNO, and BEAMNO
    304             setIndex( (uInt)scanno-1, (uInt)cycleno, ifno, ipol, beamno ) ;
     336            setIndex( (uInt)scanno-1, (uInt)cycleno[scanno], ifno, ipol, beamno ) ;
    305337
    306338            // fill SPECTRA, FLAGTRA, TSYS
     
    318350
    319351          // increment CYCLENO
    320           cycleno++ ;
     352          cycleno[scanno]++ ;
    321353        }
    322354      }
Note: See TracChangeset for help on using the changeset viewer.