Ignore:
Timestamp:
07/06/11 16:52:38 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1913

Ready for Test: No

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

Update of asdm2ASAP and related classes.

  • replaced LogIO with StreamLogSink?
  • all log messages are written to logger via StreamLogSink?
  • no output to stdout/stderr
  • commented out junk log
  • added time_sampling selection
  • supported wvr_corrected_data='both'
  • added logfile specification
  • added corr_mode selection


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/asdm2ASAP/ASDMFiller.cc

    r2197 r2208  
    1212#include <casa/Arrays/Matrix.h>
    1313#include <casa/Quanta/MVTime.h>
     14#include <casa/Logging/LogMessage.h>
    1415
    1516#include "ASDMFiller.h"
     
    2223  : FillerBase( stable ),
    2324    antennaId_( -1 ),
    24     antennaName_( "" )
    25 {
    26   cout << "This is constructor of ASDMFiller" << endl ;
    27 
     25    antennaName_( "" ),
     26    className_("ASDMFiller")
     27{
    2828  reader_ = new ASDMReader() ;
    29 
    30   cout << "input filename is " << stable->table().tableName() << endl ;
    3129}
    3230
    3331ASDMFiller::~ASDMFiller()
    3432{
    35   cout << "This is destructor of ASDMFiller" << endl ;
     33  // nothing to do?
     34  logsink_ = 0 ;
     35}
     36
     37void ASDMFiller::setLogger( CountedPtr<LogSinkInterface> &logsink )
     38{
     39  logsink_ = logsink ;
     40  if ( !(reader_.null()) ) {
     41    reader_->setLogger( logsink ) ;
     42  }
    3643}
    3744
    3845bool ASDMFiller::open( const string &filename, const Record &rec )
    3946{
     47  String funcName = "open" ;
    4048  bool status = reader_->open( filename, rec ) ;
    4149
     
    4351  antennaName_ = reader_->getAntennaName() ;
    4452
    45   cout << "antennaId_ = " << antennaId_ << endl ;
    46   cout << "antennaName_ = " << antennaName_ << endl ;
     53  //logsink->postLocally( LogMessage("antennaId_ = "+String::toString(antennaId_),LogOrigin(className_,funcName,WHERE)) ) ;
     54  //logsink->postLocally( LogMessage("antennaName_ = "+antennaName_,LogOrigin(className_,funcName,WHERE)) ) ;
    4755
    4856  return status ;
     
    5159void ASDMFiller::fill()
    5260{
     61  String funcName = "fill" ;
     62
    5363  // header
    5464  fillHeader() ;
     
    6575  uInt numConfigDescId = configDescIdList.size() ;
    6676
    67   cout << "configDescIdList = " << configDescIdList << endl ;
     77  //logsink->postLocally( LogMessage("configDescIdList = "+String::toString(configDescIdList),LogOrigin(className_,funcName,WHERE)) ) ;
    6878
    6979  // get field list
     
    7181  uInt numFieldId = fieldIdList.size() ;
    7282
    73   cout << "fieldIdList = " << fieldIdList << endl ;
     83  //logsink->postLocally( LogMessage("fieldIdList = "+String::toString(fieldIdList),LogOrigin(className_,funcName,WHERE)) ) ;
    7484
    7585  // BEAMNO is always 0 since ALMA antenna is single beam
     
    8393
    8494  for ( uInt icon = 0 ; icon < numConfigDescId ; icon++ ) {
    85     //Vector<uInt> dataDescIdList = reader_->getDataDescIdList( configDescIdList[icon] ) ;
    86     //uInt numDataDescId = dataDescIdList.size() ;
    87     //Vector<uInt> switchCycleIdList = reader_->getSwitchCycleIdList( configDescIdList[icon] ) ;
    88     //Vector<uInt> feedIdList = reader_->getFeedIdList( configDescIdList[icon] ) ;
    89     //uInt numFeedId = feedIdList.size() ;
    9095    for ( unsigned int ifield = 0 ; ifield < numFieldId ; ifield++ ) {
    91       cout << "start configDescId " << configDescIdList[icon]
    92            << " fieldId " << fieldIdList[ifield] << endl ;
     96      //logsink_->postLocally( LogMessage("start configDescId "+String::toString(configDescIdList[icon])+" fieldId "+String::toString(fieldIdList[ifield]),LogOrigin(className_,funcName,WHERE)) ) ;
    9397
    9498      //Bool status = reader_->setMainRow( configDescIdList[icon], fieldIdList[ifield] ) ;
    9599      if ( !(reader_->setMainRow( configDescIdList[icon], fieldIdList[ifield] )) ) {
    96         cout << "skip configDescId " << configDescIdList[icon]
    97              << ", fieldId " << fieldIdList[ifield] << endl ;
     100        //logsink_->postLocally( LogMessage("skip configDescId "+String::toString(configDescIdList[icon])+" fieldId "+String::toString(fieldIdList[ifield]),LogOrigin(className_,funcName,WHERE)) ) ;
    98101        continue ;
    99102      }
     
    102105      uInt nrow = reader_->getNumMainRow() ;
    103106
    104       cout << "There are " << nrow << " rows in Main table." << endl ;
     107      //logsink_->postLocally( LogMessage("There are "+String::toString(nrow)+" rows in Main table corresponding to configDescId "+String::toString(configDescIdList[icon]+" fieldId "+String::toString(fieldIdList[ifield]),LogOrigin(className_,funcName,WHERE)) ) ;
    105108     
    106109      // CYCLENO
     
    112115        if ( !(reader_->setMainRow( irow )) ) {
    113116          // skip row since the row doesn't have valid configDescId
    114           cout << "skip " << irow << endl ;
     117          //logsink_->postLocally( LogMessage("skip "+String::toString(irow),LogOrigin(className_,funcName,WHERE)) ) ;
    115118          continue ;
    116119        }
     
    122125        // set data
    123126        if ( !(reader_->setData()) ) {
    124           // skip row since failed to retrieve data
    125           cout << "skip " << irow << endl ;
     127          // skip row since reader failed to retrieve data
     128          //logsink_->postLocally( LogMessage("skip "+String::toString(irow),LogOrigin(className_,funcName,WHRER)) ) ;
     129          continue ;
    126130        }
    127131
     
    235239            toJ2000( direction, az, el, mjd, antpos ) ;
    236240          }
    237           cout << "direction = " << direction << endl ;
     241          //logsink_->postLocally( LogMessage("direction = "+String::toString(direction),LogOrigin(className_,funcName,WHERE)) ) ;
    238242          setDirection( direction, (casa::Float)az, (casa::Float)el ) ;
    239243
    240244          // loop on polarization
    241245          vector<unsigned int> dataShape = reader_->getDataShape( idata ) ;
    242           for ( unsigned int i = 0 ; i < dataShape.size() ; i++ ) {
    243             if ( i == 0 )
    244               cout << "dataShape=[" << dataShape[i] << ", " ;
    245             else if ( i == dataShape.size()-1 )
    246               cout << dataShape[i] << "]" << endl ;
    247             else
    248               cout << dataShape[i] << ", " ;
    249           }
     246//           ostringstream oss ;
     247//           for ( unsigned int i = 0 ; i < dataShape.size() ; i++ ) {
     248//             if ( i == 0 )
     249//               oss << "dataShape=[" << dataShape[i] << ", " ;
     250//             else if ( i == dataShape.size()-1 )
     251//               oss << dataShape[i] << "]"  ;
     252//             else
     253//               oss << dataShape[i] << ", " ;
     254//           }
     255//           logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
     256                                     
    250257          //int numPol = reader_->getNumPol( idata ) ;
    251258          unsigned int numPol = dataShape[0] ;
    252259          unsigned int numChan = dataShape[1] ;
    253260
    254           cout << "numPol = " << numPol << endl ;
     261          //logsink_->postLocally( LogMessage("numPol = "+String::toString(numPol),LogOrigin(className_,funcName,WHERE)) ) ;
    255262
    256263          // OPACITY
     
    295302    }
    296303  }
    297 
    298   cout << "filled" << endl ;
    299304
    300305  return ;
     
    481486                               Vector<casa::Double> antpos )
    482487{
     488  String funcName = "toJ2000" ;
     489
    483490  Vector<casa::Double> azel( 2 ) ;
    484491  azel[0] = az ;
     
    491498  MPosition mp( MVPosition( qantpos ),
    492499                MPosition::ITRF ) ;
    493   mp.print( cout ) ;
     500//   mp.print( os_.output() ) ;
    494501  MeasFrame mf( me, mp ) ;
    495502  MDirection::Convert toj2000( MDirection::AZELGEO,
    496   //MDirection::Convert toj2000( MDirection::AZEL,
    497   //MDirection::Convert toj2000( MDirection::AZELSW,
    498   //MDirection::Convert toj2000( MDirection::AZELSWGEO,
    499   //MDirection::Convert toj2000( MDirection::AZELNE,
    500   //MDirection::Convert toj2000( MDirection::AZELNEGEO,
    501503                               MDirection::Ref( MDirection::J2000, mf ) ) ;
    502504  dir = toj2000( azel ).getAngle( "rad" ).getValue() ;
    503   cout << "dir = " << dir << endl ;
    504 }
    505 
     505  //logsink->postLocally( LogMessage("dir = "+String::toString(dir),LogOrigin(className_,funcName,WHERE)) ) ;
     506}
     507
Note: See TracChangeset for help on using the changeset viewer.