Ignore:
Timestamp:
07/29/10 19:13:46 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: No (test merging alma branch)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s):

Description:


Location:
branches/mergetest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mergetest

  • branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc

    r1720 r1779  
    3434//#---------------------------------------------------------------------------
    3535
    36 #include <atnf/PKSIO/PKSmsg.h>
    3736#include <atnf/PKSIO/MBFITSreader.h>
    3837#include <atnf/PKSIO/SDFITSreader.h>
     
    4443#include <casa/BasicMath/Math.h>
    4544#include <casa/Quanta/MVTime.h>
     45#include <casa/Logging/LogIO.h>
    4646
    4747//----------------------------------------------- PKSFITSreader::PKSFITSreader
     
    6161    cReader = new MBFITSreader(retry, interpolate ? 1 : 0);
    6262  }
    63 
    64   // By default, messages are written to stderr.
    65   initMsg();
    6663}
    6764
     
    7673}
    7774
    78 //------------------------------------------------------ PKSFITSreader::setMsg
    79 
    80 // Set message disposition.  If fd is non-zero messages will be written
    81 // to that file descriptor, else stored for retrieval by getMsg().
    82 
    83 Int PKSFITSreader::setMsg(FILE *fd)
    84 {
    85   PKSmsg::setMsg(fd);
    86   cReader->setMsg(fd);
    87 
    88   return 0;
    89 }
    90 
    9175//-------------------------------------------------------- PKSFITSreader::open
    9276
     
    9579Int PKSFITSreader::open(
    9680        const String fitsName,
     81        const String antenna,
    9782        Vector<Bool> &beams,
    9883        Vector<Bool> &IFs,
     
    10388        Bool   &haveSpectra)
    10489{
    105   clearMsg();
    106 
    10790  int    extraSysCal, haveBase_, *haveXPol_, haveSpectra_, nBeam, *nChan_,
    10891         nIF, *nPol_, status;
     
    11093                         nChan_, nPol_, haveXPol_, haveBase_, haveSpectra_,
    11194                         extraSysCal);
    112   logMsg(cReader->getMsg());
    113   cReader->clearMsg();
     95  //logMsg(cReader->getMsg());
     96  //cReader->clearMsg();
    11497  if (status) {
    11598    return status;
     
    178161                              obsType_, bunit_, equinox_, radecsys,
    179162                              dopplerFrame_, datobs, utc, refFreq, bandwidth);
    180   logMsg(cReader->getMsg());
    181   cReader->clearMsg();
     163  //logMsg(cReader->getMsg());
     164  //cReader->clearMsg();
    182165  if (status) {
    183166    return 1;
     
    218201  Int status = cReader->getFreqInfo(nIF, startfreq, endfreq);
    219202
    220   logMsg(cReader->getMsg());
    221   cReader->clearMsg();
     203  //logMsg(cReader->getMsg());
     204  //cReader->clearMsg();
    222205  if (!status) {
    223206    startFreq.takeStorage(IPosition(1,nIF), startfreq, TAKE_OVER);
     
    240223        const Bool getSpectra,
    241224        const Bool getXPol,
     225        const Bool getFeedPos,
     226        const Bool getPointing,
    242227        const Int  coordSys)
    243228{
     
    307292  cGetSpectra = getSpectra;
    308293  cGetXPol    = getXPol;
     294  cGetFeedPos = getFeedPos;
     295  cGetPointing = getPointing;
    309296  cCoordSys   = coordSys;
    310297
    311298  uInt maxNChan = cReader->select(start, end, ref, cGetSpectra, cGetXPol,
    312                                   cCoordSys);
    313   logMsg(cReader->getMsg());
    314   cReader->clearMsg();
     299                                  cGetFeedPos, cGetPointing, cCoordSys);
     300  //logMsg(cReader->getMsg());
     301  //cReader->clearMsg();
    315302
    316303  delete [] end;
     
    336323
    337324  Int status = cReader->findRange(nRow, nSel, dateSpan, utcSpan, posns);
    338   logMsg(cReader->getMsg());
    339   cReader->clearMsg();
     325  //logMsg(cReader->getMsg());
     326  //cReader->clearMsg();
    340327
    341328  if (!status) {
     
    361348{
    362349  Int status = cReader->read(cMBrec);
    363   logMsg(cReader->getMsg());
    364   cReader->clearMsg();
     350  //logMsg(cReader->getMsg());
     351  //cReader->clearMsg();
    365352
    366353  if (status) {
     
    378365  pksrec.scanNo  = cMBrec.scanNo;
    379366  pksrec.cycleNo = cMBrec.cycleNo;
     367  pksrec.polNo = cMBrec.polNo ;
    380368
    381369  // Extract MJD.
    382370  Int day, month, year;
    383   sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day);
    384   pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0;
     371  if ( strstr( cMBrec.datobs, "T" ) == NULL ) {
     372    sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day);
     373    pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0;
     374  }
     375  else {
     376    Double dd, hour, min, sec ;
     377    sscanf( cMBrec.datobs, "%4d-%2d-%2lfT%lf:%lf:%lf", &year, &month, &dd, &hour, &min, &sec ) ;
     378    dd = dd + ( hour * 3600.0 + min * 60.0 + sec ) / 86400.0 ;
     379    pksrec.mjd = MVTime(year, month, dd).day() ;
     380  }
    385381
    386382  pksrec.interval  = cMBrec.exposure;
     
    388384  pksrec.fieldName = trim(cMBrec.srcName);
    389385  pksrec.srcName   = pksrec.fieldName;
     386
     387  int namelen = pksrec.srcName.length() ;
     388  if ( namelen > 4 ) {
     389    String srcsub = pksrec.srcName.substr( namelen-4, 4 ) ;
     390    if ( srcsub.find( "_psc" ) != string::npos ) {
     391      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     392      pksrec.srcName = pksrec.fieldName + "_ps_calon" ;
     393    }
     394    else if ( srcsub.find( "_pso" ) != string::npos ) {
     395      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     396      pksrec.srcName = pksrec.fieldName + "_ps" ;
     397    }
     398    else if ( srcsub.find( "_prc" ) != string::npos ) {
     399      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     400      pksrec.srcName = pksrec.fieldName + "_psr_calon" ;
     401    }
     402    else if ( srcsub.find( "_pro" ) != string::npos ) {
     403      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     404      pksrec.srcName = pksrec.fieldName + "_psr" ;
     405    }
     406    else if ( srcsub.find( "_fsc" ) != string::npos ) {
     407      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     408      pksrec.srcName = pksrec.fieldName + "_fs_calon" ;
     409    }
     410    else if ( srcsub.find( "_fso" ) != string::npos ) {
     411      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     412      pksrec.srcName = pksrec.fieldName + "_fs" ;
     413    }
     414    else if ( srcsub.find( "_frc" ) != string::npos ) {
     415      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     416      pksrec.srcName = pksrec.fieldName + "_fsr_calon" ;
     417    }
     418    else if ( srcsub.find( "_fro" ) != string::npos ) {
     419      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     420      pksrec.srcName = pksrec.fieldName + "_fsr" ;
     421    }
     422    else if ( srcsub.find( "_nsc" ) != string::npos || srcsub.find( "_nrc" ) != string::npos ) {
     423      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     424      pksrec.srcName = pksrec.fieldName + "_nod_calon" ;
     425    }
     426    else if ( srcsub.find( "_nso" ) != string::npos || srcsub.find( "_nro" ) != string::npos ) {
     427      pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ;
     428      pksrec.srcName = pksrec.fieldName + "_nod" ;
     429    }
     430  }
    390431
    391432  pksrec.srcDir.resize(2);
     
    396437  pksrec.srcPM(0)  = 0.0;
    397438  pksrec.srcPM(1)  = 0.0;
    398   pksrec.srcVel    = 0.0;
     439  pksrec.srcVel    = cMBrec.srcVelocity;
    399440  pksrec.obsType   = trim(cMBrec.obsType);
    400441
     
    404445  pksrec.bandwidth = chanWidth * nChan;
    405446  pksrec.freqInc   = cMBrec.fqDelt[0];
    406   pksrec.restFreq  = cMBrec.restFreq;
     447  pksrec.restFreq.resize(1) ;
     448  pksrec.restFreq(0)  = cMBrec.restFreq;
    407449
    408450  pksrec.tcal.resize(nPol);
     
    498540{
    499541  cReader->close();
    500   logMsg(cReader->getMsg());
    501   cReader->clearMsg();
     542  //logMsg(cReader->getMsg());
     543  //cReader->clearMsg();
    502544}
    503545
Note: See TracChangeset for help on using the changeset viewer.