Changeset 987
- Timestamp:
- 04/05/06 14:30:35 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r973 r987 219 219 // the TableMeasDesc gives the column a type 220 220 TableMeasDesc<MDirection> mdirCol(tmvdMDir, mdirRef); 221 // a uder set table type e.g. GALCTIC, B1950 ... 222 td.rwKeywordSet().define("DIRECTIONREF", String("J2000")); 221 223 // writing create the measure column 222 224 mdirCol.write(td); … … 352 354 MVAngle mvLon(t[0]); 353 355 String sLon = mvLon.string(MVAngle::TIME,prec); 356 uInt tp = md.getRef().getType(); 357 if (tp == MDirection::GALACTIC || 358 tp == MDirection::SUPERGAL ) { 359 sLon = mvLon(0.0).string(MVAngle::ANGLE_CLEAN,prec); 360 } 354 361 MVAngle mvLat(t[1]); 355 362 String sLat = mvLat.string(MVAngle::ANGLE+MVAngle::DIG2,prec); … … 550 557 for (uInt i=0; i<nrow(); ++i) { 551 558 MEpoch me = timeCol(i); 552 MDirection md = dirCol_(i); 553 dirCol_.get(i,md); 559 MDirection md = getDirection(i); 554 560 oss << " Time: " << formatTime(me,False) << " Direction: " << formatDirection(md) 555 561 << endl << " => "; … … 717 723 // main table 718 724 String dirtype = "Position (" 719 + MDirection::showType(dirCol_.getMeasRef().getType())725 + getDirectionRefString() 720 726 + ")"; 721 727 oss << setw(5) << "Scan" << setw(15) << "Source" … … 750 756 Table bsubt = biter.table(); 751 757 ROTableRow brow(bsubt); 752 MDirection::ROScalarColumn bdirCol(bsubt,"DIRECTION");753 758 const TableRecord& brec = brow.get(0); 759 uInt row0 = bsubt.rowNumbers()[0]; 754 760 oss << setw(5) << "" << setw(4) << std::right << brec.asuInt("BEAMNO")<< std::left; 755 oss << setw(4) << "" << formatDirection( bdirCol(0)) << endl;761 oss << setw(4) << "" << formatDirection(getDirection(row0)) << endl; 756 762 TableIterator iiter(bsubt, "IFNO"); 757 763 while (!iiter.pastEnd()) { … … 801 807 802 808 const MPosition& mp = getAntennaPosition(); 803 const MDirection& md = dirCol_(whichrow);809 const MDirection& md = getDirection(whichrow); 804 810 const MEpoch& me = timeCol_(whichrow); 805 811 Double rf = moleculeTable_.getRestFrequency(mmolidCol_(whichrow)); … … 822 828 return stlout; 823 829 } 830 void asap::Scantable::setDirectionRefString( const std::string & refstr ) 831 { 832 MDirection::Types mdt; 833 if (refstr != "" && !MDirection::getType(mdt, refstr)) { 834 throw(AipsError("Illegal Direction frame.")); 835 } 836 if ( refstr == "" ) { 837 String defaultstr = MDirection::showType(dirCol_.getMeasRef().getType()); 838 table_.rwKeywordSet().define("DIRECTIONREF", defaultstr); 839 } else { 840 table_.rwKeywordSet().define("DIRECTIONREF", String(refstr)); 841 } 842 } 843 844 std::string asap::Scantable::getDirectionRefString( ) const 845 { 846 return table_.keywordSet().asString("DIRECTIONREF"); 847 } 848 849 MDirection Scantable::getDirection(int whichrow ) const 850 { 851 String usertype = table_.keywordSet().asString("DIRECTIONREF"); 852 String type = MDirection::showType(dirCol_.getMeasRef().getType()); 853 if ( usertype != type ) { 854 MDirection::Types mdt; 855 if (!MDirection::getType(mdt, usertype)) { 856 throw(AipsError("Illegal Direction frame.")); 857 } 858 return dirCol_.convert(uInt(whichrow), mdt); 859 } else { 860 return dirCol_(uInt(whichrow)); 861 } 862 } 824 863 825 864 std::string Scantable::getAbcissaLabel( int whichrow ) const … … 827 866 if ( whichrow > table_.nrow() ) throw(AipsError("Illegal ro number")); 828 867 const MPosition& mp = getAntennaPosition(); 829 const MDirection& md = dirCol_(whichrow);868 const MDirection& md = getDirection(whichrow); 830 869 const MEpoch& me = timeCol_(whichrow); 831 870 const Double& rf = mmolidCol_(whichrow); … … 902 941 } 903 942 904 } //namespace asap 943 944 } 945 //namespace asap -
trunk/src/Scantable.h
r972 r987 143 143 int nscan() const; 144 144 145 //casa::MDirection::Types getDirectionReference() const;146 145 casa::MEpoch::Types getTimeReference() const; 147 146 … … 151 150 */ 152 151 casa::MPosition getAntennaPosition() const; 152 153 casa::MDirection getDirection( int whichrow ) const; 154 155 void setDirectionRefString(const std::string& refstr=""); 156 157 std::string getDirectionRefString() const; 153 158 154 159 /** … … 300 305 void setRestFrequencies(double rf, const std::string& = "Hz"); 301 306 void setRestFrequencies(const std::string& name); 307 308 void convertDirection(const std::string& newframe); 302 309 303 310 STFrequencies& frequencies() { return freqTable_; } -
trunk/src/ScantableWrapper.h
r972 r987 131 131 int nrow() const {return table_->nrow();} 132 132 int ncycle(int scanno) const {return table_->ncycle(scanno);} 133 ///@todo int nstokes() {return table_->nStokes();}134 133 135 134 void makePersistent(const std::string& fname) … … 153 152 return table_->getCoordInfo(); 154 153 } 154 155 void setDirection(const std::string& refstr="") 156 { table_->setDirectionRefString(refstr); } 155 157 156 158 casa::CountedPtr<Scantable> getCP() const {return table_;} -
trunk/src/python_Scantable.cpp
r972 r987 99 99 .def("_setcoordinfo", &ScantableWrapper::setCoordInfo) 100 100 .def("_getcoordinfo", &ScantableWrapper::getCoordInfo) 101 .def("set_dirframe", &ScantableWrapper::setDirection, 102 (boost::python::arg("refstr")="") ) 101 103 .def("_gethistory", &ScantableWrapper::getHistory) 102 104 .def("_addhistory", &ScantableWrapper::addHistory)
Note:
See TracChangeset
for help on using the changeset viewer.