Changeset 2754 for trunk/src


Ignore:
Timestamp:
01/31/13 13:14:27 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CSV-2532 (may be related to CSV-1908 and CSV-2161)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: In tool level, added parameter 'freq_tolsr' to

scantable constructor and function sd.splitant.

Test Programs: test_sdsave, test_importasdm_sd

Put in Release Notes: Yes

Module(s): Module Names change impacts.

Description: Describe your changes here...

In importing MS to Scantable, frequency frame information is
imported as is by default, i.e., base frame in Scantable is
TOPO for ALMA data, which is forcibly converted to LSRK with
wrong time and direction reference.

Some functions have a boolean parameter 'freq_tolsr' that controls
the above behavior. If freq_tolsr is False (default), frequency
is imported as is, while frequency is converted to LSRK (wrongly)
when it is True.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2746 r2754  
    257257  MSFillerVisitor(const Table &from, Scantable &to)
    258258    : BaseMSFillerVisitor(from),
    259       scantable( to )
     259      scantable(to),
     260      freqToLsr_(False)
    260261  {
    261262    antennaId = 0 ;
     
    712713    sysCalTsysCol.attach( sctab, tsysCol ) ;
    713714  }
     715  void setFreqToLsr(Bool b) { freqToLsr_ = b; }
    714716  STHeader getHeader() { return header ; }
    715717  uInt getNumBeam() { return nbeam ; }
     
    816818    MFrequency::Types freqRef = MFrequency::castType( measFreqRef ) ;
    817819    //freqref = MFrequency::showType( freqRef ) ;
    818     freqref = "LSRK" ;
     820    //freqref = "LSRK" ;
     821    freqref = "TOPO";
    819822    Quantum<Double> q ;
    820823    getScalarQuant( "TOTAL_BANDWIDTH", spwId, spwtab, q ) ;
     
    842845    if ( even )
    843846      refval = 0.5 * ( refval + qa[refchan+1].getValue( "Hz" ) ) ;
    844     if ( freqRef != MFrequency::LSRK ) {
     847    if ( freqToLsr_ && freqRef != MFrequency::LSRK ) {
     848      //cout << "do conversion to LSRK" << endl;
    845849      MeasFrame mframe( me, mp, md ) ;
    846850      MFrequency::Convert tolsr( freqRef, MFrequency::Ref( MFrequency::LSRK, mframe ) ) ;
     
    13141318  //String tsysCol;
    13151319  //String tcalCol;
     1320  Bool freqToLsr_;
    13161321
    13171322  // MS subtables
     
    15851590    antennaStr_(""),
    15861591    getPt_( True ),
     1592    freqToLsr_( False ),
    15871593    isFloatData_( False ),
    15881594    isData_( False ),
     
    16311637      antenna_ = 0 ;
    16321638    }
     1639    if ( msrec.isDefined( "freq_tolsr" ) ) {
     1640      freqToLsr_ = msrec.asBool( "freq_tolsr" ) ;
     1641    }
    16331642  }
    16341643
     
    16491658
    16501659  os_ << "Parsing MS options" << endl ;
    1651   os_ << "   getPt = " << getPt_ << endl ;
     1660  os_ << "   getPt = " << (getPt_ ? "True" : "False") << endl ;
    16521661  os_ << "   antenna = " << antenna_ << endl ;
    1653   os_ << "   antennaStr = " << antennaStr_ << LogIO::POST ;
     1662  os_ << "   antennaStr = " << antennaStr_ << endl ;
     1663  os_ << "   freqToLsr = " << (freqToLsr_  ? "True" : "False") << LogIO::POST;
    16541664
    16551665  mstable_ = MeasurementSet( (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_
     
    17451755  string freqFrame = "LSRK" ;
    17461756  table_->frequencies().setFrame( freqFrame ) ;
    1747   table_->frequencies().setFrame( freqFrame, True ) ;
     1757  if ( freqToLsr_ ) {
     1758    table_->frequencies().setFrame( freqFrame, True ) ;
     1759  }
     1760  else {
     1761    string baseFrame = frameFromSpwTable() ;
     1762    table_->frequencies().setFrame( baseFrame, True ) ;
     1763  }
    17481764
    17491765  // SUBTABLES: WEATHER
     
    17911807    if ( isSysCal_ )
    17921808      myVisitor.setSysCalRecord( tcalrec_ ) ;
     1809    myVisitor.setFreqToLsr( freqToLsr_ ) ;
    17931810   
    17941811    //double t2 = mathutil::gettimeofday_sec() ;
     
    21592176}
    21602177
     2178string MSFiller::frameFromSpwTable()
     2179{
     2180  string frameString;
     2181  Table tab = mstable_.spectralWindow();
     2182  ROScalarColumn<Int> mfrCol(tab, "MEAS_FREQ_REF");
     2183  Vector<Int> mfr = mfrCol.getColumn();
     2184  if (allEQ(mfr,mfr[0])) {
     2185    frameString = MFrequency::showType(mfr[0]);
     2186    //cout << "all rows have same frame: " << frameString << endl;
     2187  }
     2188  else {
     2189    mfrCol.attach(tab, "NUM_CHAN");
     2190    for (uInt i = 0; i < tab.nrow(); i++) {
     2191      if (mfrCol(i) != 4) {
     2192        frameString = MFrequency::showType(mfr[i]);
     2193        break;
     2194      }
     2195    }
     2196    if (frameString.size() == 0) {
     2197      frameString = "TOPO";
     2198    }
     2199  }
     2200
     2201  //cout << "frameString = " << frameString << endl;
     2202
     2203  return frameString;
     2204}
     2205
    21612206};
  • trunk/src/MSFiller.h

    r2744 r2754  
    156156  void initHeader( STHeader &header ) ;
    157157
     158  // get base frame from SPECTRAL_WINDOW table
     159  std::string frameFromSpwTable();
     160
    158161  CountedPtr<Scantable> table_ ;
    159162  MeasurementSet mstable_ ;
     
    162165  String antennaStr_ ;
    163166  Bool getPt_ ;
     167  Bool freqToLsr_ ;
    164168
    165169  Bool isFloatData_ ;
Note: See TracChangeset for help on using the changeset viewer.