Changeset 2286
- Timestamp:
- 09/02/11 19:05:11 (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2277 r2286 445 445 446 446 """ 447 info = Scantable._summary(self)447 # info = Scantable._summary(self) 448 448 if filename is not None: 449 449 if filename is "": … … 451 451 from os.path import expandvars, isdir 452 452 filename = expandvars(filename) 453 if not isdir(filename): 454 data = open(filename, 'w') 455 data.write(info) 456 data.close() 457 else: 453 # if not isdir(filename): 454 # data = open(filename, 'w') 455 # data.write(info) 456 # data.close() 457 # else: 458 if isdir(filename): 458 459 msg = "Illegal file name '%s'." % (filename) 459 460 raise IOError(msg) 460 return page(info) 461 else: 462 filename = "" 463 Scantable._summary(self, filename) 464 # return page(info) 461 465 462 466 def get_spectrum(self, rowno): -
trunk/src/Scantable.cpp
r2277 r2286 1040 1040 } 1041 1041 1042 std::string Scantable::summary() 1042 //std::string Scantable::summary( const std::string& filename ) 1043 void Scantable::summary( const std::string& filename ) 1043 1044 { 1044 1045 ostringstream oss; 1046 ofstream ofs; 1047 LogIO ols(LogOrigin("Scantable", "summary", WHERE)); 1048 1049 if (filename != "") 1050 ofs.open( filename.c_str(), ios::out ); 1051 1045 1052 oss << endl; 1046 1053 oss << asap::SEPERATOR << endl; … … 1067 1074 << endl; 1068 1075 oss << asap::SEPERATOR << endl; 1076 1077 // Flush summary and clear up the string 1078 ols << String(oss) << LogIO::POST; 1079 if (ofs) ofs << String(oss) << flush; 1080 oss.str(""); 1081 oss.clear(); 1082 1083 // TableIterator iter(table_, "SCANNO"); 1084 // while (!iter.pastEnd()) { 1085 // Table subt = iter.table(); 1086 // ROTableRow row(subt); 1087 // MEpoch::ROScalarColumn timeCol(subt,"TIME"); 1088 // const TableRecord& rec = row.get(0); 1089 // oss << setw(4) << std::right << rec.asuInt("SCANNO") 1090 // << std::left << setw(1) << "" 1091 // << setw(15) << rec.asString("SRCNAME") 1092 // << setw(10) << formatTime(timeCol(0), false); 1093 // // count the cycles in the scan 1094 // TableIterator cyciter(subt, "CYCLENO"); 1095 // int nint = 0; 1096 // while (!cyciter.pastEnd()) { 1097 // ++nint; 1098 // ++cyciter; 1099 // } 1100 // oss << setw(3) << std::right << nint << setw(3) << " x " << std::left 1101 // << setw(11) << formatSec(rec.asFloat("INTERVAL")) << setw(1) << "" 1102 // << setw(15) << SrcType::getName(rec.asInt("SRCTYPE")) << endl; 1103 1104 // TableIterator biter(subt, "BEAMNO"); 1105 // while (!biter.pastEnd()) { 1106 // Table bsubt = biter.table(); 1107 // ROTableRow brow(bsubt); 1108 // const TableRecord& brec = brow.get(0); 1109 // uInt row0 = bsubt.rowNumbers(table_)[0]; 1110 // oss << setw(5) << "" << setw(4) << std::right << brec.asuInt("BEAMNO")<< std::left; 1111 // oss << setw(4) << "" << formatDirection(getDirection(row0)) << endl; 1112 // TableIterator iiter(bsubt, "IFNO"); 1113 // while (!iiter.pastEnd()) { 1114 // Table isubt = iiter.table(); 1115 // ROTableRow irow(isubt); 1116 // const TableRecord& irec = irow.get(0); 1117 // oss << setw(9) << ""; 1118 // oss << setw(3) << std::right << irec.asuInt("IFNO") << std::left 1119 // << setw(1) << "" << frequencies().print(irec.asuInt("FREQ_ID")) 1120 // << setw(3) << "" << nchan(irec.asuInt("IFNO")) 1121 // << endl; 1122 1123 // ++iiter; 1124 // } 1125 // ++biter; 1126 // } 1127 // ++iter; 1128 // } 1069 1129 TableIterator iter(table_, "SCANNO"); 1070 1130 while (!iter.pastEnd()) { … … 1111 1171 ++biter; 1112 1172 } 1173 // Flush summary every scan and clear up the string 1174 ols << String(oss) << LogIO::POST; 1175 if (ofs) ofs << String(oss) << flush; 1176 oss.str(""); 1177 oss.clear(); 1178 1113 1179 ++iter; 1114 1180 } 1115 return String(oss); 1181 oss << asap::SEPERATOR << endl; 1182 ols << String(oss) << LogIO::POST; 1183 if (ofs) { 1184 //ofs << String(oss) << flush; 1185 ofs.close(); 1186 } 1187 // return String(oss); 1116 1188 } 1117 1189 -
trunk/src/Scantable.h
r2193 r2286 375 375 376 376 std::string headerSummary(); 377 std::string summary(); 377 // std::string summary(); 378 void summary(const std::string& filename=""); 378 379 //std::string getTime(int whichrow=-1, bool showdate=true) const; 379 380 std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const; -
trunk/src/ScantableWrapper.h
r2193 r2286 217 217 Scantable* getPtr() {return &(*table_);} 218 218 219 std::string summary() const { 220 return table_->summary(); 219 // std::string summary() const { 220 // return table_->summary(); 221 // } 222 void summary(const std::string& filename="") { 223 return table_->summary(filename); 221 224 } 222 225 -
trunk/src/python_Scantable.cpp
r2186 r2286 118 118 boost::python::arg("unflag")=false) ) 119 119 .def("_save", &ScantableWrapper::makePersistent) 120 .def("_summary", &ScantableWrapper::summary) 120 //.def("_summary", &ScantableWrapper::summary) 121 .def("_summary", &ScantableWrapper::summary, 122 (boost::python::arg("filename")="")) 121 123 .def("_list_header", &ScantableWrapper::listHeader) 122 124 //.def("_getrestfreqs", &ScantableWrapper::getRestFrequencies)
Note:
See TracChangeset
for help on using the changeset viewer.