Changeset 2239


Ignore:
Timestamp:
07/21/11 16:23:49 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

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...

Use ComplexToReal? instead of real and imag functions for 4 polarization
(e.g. XX, YY, XY, YX) data.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2238 r2239  
    273273
    274274  //double time1 = gettimeofday_sec() ;
    275   //os_ << "end fill init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     275  //os_ << "end init fill: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    276276
    277277  // row based
     
    293293  RecordFieldPtr<uInt> widRF( trec, "WEATHER_ID" ) ;
    294294  RecordFieldPtr<uInt> polnoRF( trec, "POLNO" ) ;
    295 
     295  RecordFieldPtr<Int> refbRF( trec, "REFBEAMNO" ) ;
     296  RecordFieldPtr<Int> fitidRF( trec, "FIT_ID" ) ;
     297  RecordFieldPtr<Float> tauRF( trec, "OPACITY" ) ;
     298  RecordFieldPtr<uInt> beamRF( trec, "BEAMNO" ) ;
     299  RecordFieldPtr<uInt> focusidRF( trec, "FOCUS_ID" ) ;
     300  RecordFieldPtr<uInt> ifnoRF( trec, "IFNO" ) ;
     301  RecordFieldPtr<uInt> molidRF( trec, "MOLECULE_ID" ) ;
     302  RecordFieldPtr<uInt> freqidRF( trec, "FREQ_ID" ) ;
     303  RecordFieldPtr<uInt> scanRF( trec, "SCANNO" ) ;
     304  RecordFieldPtr<Int> srctypeRF( trec, "SRCTYPE" ) ;
     305  RecordFieldPtr<String> srcnameRF( trec, "SRCNAME" ) ;
     306  RecordFieldPtr<String> fieldnameRF( trec, "FIELDNAME" ) ;
     307  RecordFieldPtr< Array<Double> > srcpmRF( trec, "SRCPROPERMOTION" ) ;
     308  RecordFieldPtr< Array<Double> > srcdirRF( trec, "SRCDIRECTION" ) ;
     309  RecordFieldPtr<Double> sysvelRF( trec, "SRCVELOCITY" ) ;
    296310
    297311  // REFBEAMNO
    298   RecordFieldPtr<Int> intRF( trec, "REFBEAMNO" ) ;
    299   *intRF = -1 ;
     312  *refbRF = -1 ;
    300313
    301314  // FIT_ID
    302   intRF.attachToRecord( trec, "FIT_ID" ) ;
    303   *intRF = -1 ;
     315  *fitidRF = -1 ;
    304316
    305317  // OPACITY
    306   RecordFieldPtr<Float> floatRF( trec, "OPACITY" ) ;
    307   *floatRF = 0.0 ;
     318  *tauRF = 0.0 ;
    308319
    309320  //
     
    347358
    348359      // BEAMNO
    349       RecordFieldPtr<uInt> uintRF( trec, "BEAMNO" ) ;
    350       *uintRF = feedId ;
     360      *beamRF = feedId ;
    351361
    352362      // FOCUS_ID
    353       uintRF.attachToRecord( trec, "FOCUS_ID" ) ;
    354       *uintRF = 0 ;
     363      *focusidRF = 0 ;
    355364
    356365      //time1 = gettimeofday_sec() ;
     
    373382
    374383        // FIELDNAME
    375         RecordFieldPtr<String> strRF( trec, "FIELDNAME" ) ;
    376         *strRF = fieldName ;
     384        *fieldnameRF = fieldName ;
    377385
    378386
     
    392400
    393401          // IFNO
    394           uintRF.attachToRecord( trec, "IFNO" ) ;
    395           *uintRF = (uInt)spwId ;
     402          *ifnoRF = (uInt)spwId ;
    396403
    397404          // polarization information
     
    415422
    416423          // SRCNAME
    417           strRF.attachToRecord( trec, "SRCNAME" ) ;
    418           *strRF = srcName ;
     424          *srcnameRF = srcName ;
    419425
    420426//           os_ << "srcName = " << srcName << LogIO::POST ;
    421427
    422428          // SRCPROPERMOTION
    423           RecordFieldPtr< Array<Double> > darrRF( trec, "SRCPROPERMOTION" ) ;
    424           *darrRF = srcPM ;
     429          *srcpmRF = srcPM ;
    425430
    426431          //os_ << "srcPM = " << srcPM << LogIO::POST ;
    427432
    428433          // SRCDIRECTION
    429           darrRF.attachToRecord( trec, "SRCDIRECTION" ) ;
    430 //           *darrRF = srcDir ;
    431           *darrRF = md.getAngle().getValue( "rad" ) ;
     434          *srcdirRF = md.getAngle().getValue( "rad" ) ;
    432435
    433436          //os_ << "srcDir = " << srcDir << LogIO::POST ;
     
    437440          if ( !sysVels.empty() )
    438441            sysVel = sysVels[0] ;
    439           RecordFieldPtr<Double> doubleRF( trec, "SRCVELOCITY" ) ;
    440           *doubleRF = sysVel ;
     442          *sysvelRF = sysVel ;
    441443
    442444//           os_ << "sysVel = " << sysVel << LogIO::POST ;
     
    445447
    446448          // MOLECULE_ID
    447           uintRF.attachToRecord( trec, "MOLECULE_ID" ) ;
    448           *uintRF = molId ;
     449          *molidRF = molId ;
    449450
    450451          // spectral setup
     
    483484
    484485          // FREQ_ID
    485           uintRF.attachToRecord( trec, "FREQ_ID" ) ;
    486           *uintRF = freqId ;
     486          *freqidRF = freqId ;
    487487
    488488          // for TSYS and TCAL
     
    520520
    521521            // SCANNO
    522             uintRF.attachToRecord( trec, "SCANNO" ) ;
    523             *uintRF = scanNum - 1 ;
     522            *scanRF = scanNum - 1 ;
    524523
    525524            //time1 = gettimeofday_sec() ;
     
    600599             
    601600              // SRCTYPE
    602               intRF.attachToRecord( trec, "SRCTYPE" ) ;
    603               *intRF = srcType ;
     601              *srctypeRF = srcType ;
    604602
    605603              for ( Int irow = 0 ; irow < nrow ; irow++ ) {
     
    679677                cycle++ ;
    680678              }
    681 
     679             
    682680              //time1 = gettimeofday_sec() ;
    683681              //os_ << "end 5th iteration: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     
    16231621{
    16241622  //double startSec = gettimeofday_sec() ;
    1625   //os_ << "start MFiller::reshapeSpectraAndFlagtra() startSec=" << startSec << LogIO::POST ; 
     1623  //os_ << "start MSFiller::reshapeSpectraAndFlagtra() startSec=" << startSec << LogIO::POST ; 
    16261624  if ( isFloatData_ ) {
    16271625    ROArrayColumn<Bool> mFlagCol( tab, "FLAG" ) ;
     
    16461644      IPosition inc( 3, 2, 1, 1 ) ;
    16471645      sp = tmp( start, end, inc ) ;
    1648 //       sp = tmp( Slice( 0, npol, 2 ),
    1649 //                 Slice( 0, nchan, 1 ),
    1650 //                 Slice( 0, nrow, 1 ) ) ;
    1651       //sp = real( mDataCol.getColumn() ) ;
    16521646      fl = mFlagCol.getColumn() ;
    16531647    }
     
    16631657               || corrtype[ipol] == Stokes::RL || corrtype[ipol] == Stokes::LR ) {
    16641658            if ( !crossOK ) {
    1665               spxy.row( ipol ) = real( mSp.row( ipol ) ) ;
     1659              Vector<Float> tmp = ComplexToReal( mSp.row( ipol ) ) ;
     1660              IPosition start( 1, 0 ) ;
     1661              IPosition end( 1, 2*nchan-1 ) ;
     1662              IPosition inc( 1, 2 ) ;
     1663              spxy.row( ipol ) = tmp( start, end, inc ) ;
    16661664              flxy.row( ipol ) = mFl.row( ipol ) ;
    1667               if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::RL ) {
    1668                 spxy.row( ipol+1 ) = imag( mSp.row( ipol ) ) ;
    1669                 flxy.row( ipol+1 ) = mFl.row( ipol ) ;
    1670               }                       
    1671               else {
    1672                 spxy.row( ipol+1 ) = imag( conj( mSp.row( ipol ) ) ) ;
    1673                 flxy.row( ipol+1 ) = mFl.row( ipol ) ;
     1665              start = IPosition( 1, 1 ) ;
     1666              spxy.row( ipol+1 ) = tmp( start, end, inc ) ;
     1667              flxy.row( ipol+1 ) = mFl.row( ipol ) ;
     1668              if ( corrtype[ipol] == Stokes::YX || corrtype[ipol] == Stokes::LR ) {
     1669                spxy.row( ipol+1 ) = spxy.row( ipol+1 ) * (Float)-1.0 ;
    16741670              }
    16751671              crossOK = True ;
     
    16771673          }
    16781674          else {
    1679             spxy.row( ipol ) = real( mSp.row( ipol ) ) ;
     1675            Vector<Float> tmp = ComplexToReal( mSp.row( ipol ) ) ;
     1676            IPosition start( 1, 0 ) ;
     1677            IPosition end( 1, 2*nchan-1 ) ;
     1678            IPosition inc( 1, 2 ) ;
     1679            spxy.row( ipol ) = tmp( start, end, inc ) ;
    16801680            flxy.row( ipol ) = mFl.row( ipol ) ;
    16811681          }
     
    16981698{
    16991699  //double startSec = gettimeofday_sec() ;
    1700   //os_ << "start MFiller::getDirection2() startSec=" << startSec << LogIO::POST ; 
     1700  //os_ << "start MSFiller::getDirection2() startSec=" << startSec << LogIO::POST ; 
    17011701  String refString ;
    17021702  MDirection::Types dirType ;
    1703   //uInt diridx = getDirection( idx, dir, srate, refString, ptab, t.get("s").getValue() ) ;
    17041703  uInt diridx = getDirection( idx, dir, srate, refString, ptcol, pdcol, t.get("s").getValue() ) ;
    17051704  MDirection::getType( dirType, refString ) ;
     
    17201719    dir = toj2000( dir ).getAngle("rad").getValue() ;
    17211720  }
    1722   if ( srate.size() == 0 )
    1723     srate = Vector<Double>( 2, 0.0 ) ;
     1721  if ( srate.size() == 0 ) {
     1722    srate.resize( 2 ) ;
     1723    srate = 0.0 ;
     1724  }
    17241725  //double endSec = gettimeofday_sec() ;
    17251726  //os_ << "end MSFiller::getDirection2() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     
    17351736{
    17361737  //double startSec = gettimeofday_sec() ;
    1737   //os_ << "start MFiller::getSourceDirection() startSec=" << startSec << LogIO::POST ;
     1738  //os_ << "start MSFiller::getSourceDirection() startSec=" << startSec << LogIO::POST ;
    17381739  Vector<Double> defaultScanrate( 2, 0.0 ) ;
    17391740  Vector<Double> defaultDir = srcdir[0].getAngle( "rad" ).getValue() ;
     
    18591860{
    18601861  //double startSec = gettimeofday_sec() ;
    1861   //os_ << "start MFiller::sourceInfo() startSec=" << startSec << LogIO::POST ;
     1862  //os_ << "start MSFiller::sourceInfo() startSec=" << startSec << LogIO::POST ;
    18621863
    18631864  MSSource srctab = mstable_.source() ;
     
    19301931{
    19311932  //double startSec = gettimeofday_sec() ;
    1932   //os_ << "start MFiller::spectralSetup() startSec=" << startSec << LogIO::POST ;
     1933  //os_ << "start MSFiller::spectralSetup() startSec=" << startSec << LogIO::POST ;
    19331934
    19341935  MSSpectralWindow spwtab = mstable_.spectralWindow() ;
Note: See TracChangeset for help on using the changeset viewer.