Changeset 1947 for trunk/src


Ignore:
Timestamp:
11/10/10 14:48:15 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:
+ An optional parameter 'prec (unsigned int)' is added to

scantable.get_time, python_Scantable::_gettime, ScantableWrapper::getTime and Scantable::getTime.

+ Also Scantable::fromatTime accepts 'prec' as a parameter.
+ scantable._get_column accepts args which will be passed to callback function.

Test Programs:

Put in Release Notes: No

Module(s): scantable

Description:

Add a parameter prec to scantable.get_time which specifies the precision of time returned.
The default value is prec=0.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r1931 r1947  
    684684std::string Scantable::formatTime(const MEpoch& me, bool showdate) const
    685685{
     686  return formatTime(me, showdate, 0);
     687}
     688
     689std::string Scantable::formatTime(const MEpoch& me, bool showdate, uInt prec) const
     690{
    686691  MVTime mvt(me.getValue());
    687692  if (showdate)
    688     mvt.setFormat(MVTime::YMD);
     693    //mvt.setFormat(MVTime::YMD);
     694    mvt.setFormat(MVTime::YMD, prec);
    689695  else
    690     mvt.setFormat(MVTime::TIME);
     696    //mvt.setFormat(MVTime::TIME);
     697    mvt.setFormat(MVTime::TIME, prec);
    691698  ostringstream oss;
    692699  oss << mvt;
     
    10351042}
    10361043
    1037 std::string Scantable::getTime(int whichrow, bool showdate) const
    1038 {
    1039   MEpoch::ROScalarColumn timeCol(table_, "TIME");
     1044// std::string Scantable::getTime(int whichrow, bool showdate) const
     1045// {
     1046//   MEpoch::ROScalarColumn timeCol(table_, "TIME");
     1047//   MEpoch me;
     1048//   if (whichrow > -1) {
     1049//     me = timeCol(uInt(whichrow));
     1050//   } else {
     1051//     Double tm;
     1052//     table_.keywordSet().get("UTC",tm);
     1053//     me = MEpoch(MVEpoch(tm));
     1054//   }
     1055//   return formatTime(me, showdate);
     1056// }
     1057
     1058std::string Scantable::getTime(int whichrow, bool showdate, uInt prec) const
     1059{
    10401060  MEpoch me;
    1041   if (whichrow > -1) {
    1042     me = timeCol(uInt(whichrow));
    1043   } else {
    1044     Double tm;
    1045     table_.keywordSet().get("UTC",tm);
    1046     me = MEpoch(MVEpoch(tm));
    1047   }
    1048   return formatTime(me, showdate);
     1061  me = getEpoch(whichrow);
     1062  return formatTime(me, showdate, prec);
    10491063}
    10501064
  • trunk/src/Scantable.h

    r1931 r1947  
    368368
    369369  std::string summary(bool verbose=false);
    370   std::string getTime(int whichrow=-1, bool showdate=true) const;
     370  //std::string getTime(int whichrow=-1, bool showdate=true) const;
     371  std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const;
    371372  double getIntTime(int whichrow) const { return integrCol_(whichrow); }
    372373
     
    505506
    506507  std::string formatTime(const casa::MEpoch& me, bool showdate)const;
     508  std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
    507509
    508510  /**
  • trunk/src/ScantableWrapper.h

    r1931 r1947  
    8484    { return table_->getTsys(whichrow); }
    8585
    86   std::string getTime(int whichrow=0) const
    87     { return table_->getTime(whichrow); }
     86  //std::string getTime(int whichrow=0) const
     87  //  { return table_->getTime(whichrow); }
     88  std::string getTime(int whichrow=0, int prec = 0) const
     89    { return table_->getTime(whichrow, true, casa::uInt(prec)); }
    8890
    8991  double getIntTime(int whichrow=0) const
  • trunk/src/python_Scantable.cpp

    r1908 r1947  
    9999    .def("_getparangle", &ScantableWrapper::getParAngle,
    100100         (boost::python::arg("whichrow")=0) )
     101    //.def("_gettime", &ScantableWrapper::getTime,
     102    //     (boost::python::arg("whichrow")=0) )
    101103    .def("_gettime", &ScantableWrapper::getTime,
    102          (boost::python::arg("whichrow")=0) )
     104         (boost::python::arg("whichrow")=0,
     105          boost::python::arg("prec")=0) )
    103106    .def("_getinttime", &ScantableWrapper::getIntTime,
    104107         (boost::python::arg("whichrow")=0) )
Note: See TracChangeset for help on using the changeset viewer.