- Timestamp:
- 01/24/05 17:13:36 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMemTable.cc
r275 r281 56 56 #include <coordinates/Coordinates/CoordinateUtil.h> 57 57 #include <casa/Quanta/MVTime.h> 58 #include <casa/Quanta/MVAngle.h> 58 59 59 60 #include "SDDefs.h" … … 181 182 } 182 183 183 std::string SDMemTable::getTime(Int whichRow) const 184 { 185 ROScalarColumn<Double> src(table_, "TIME"); 184 std::string SDMemTable::getTime(Int whichRow, Bool showDate) const 185 { 186 186 Double tm; 187 src.get(whichRow, tm); 187 if (whichRow > -1) { 188 ROScalarColumn<Double> src(table_, "TIME"); 189 src.get(whichRow, tm); 190 } else { 191 table_.keywordSet().get("UTC",tm); 192 } 188 193 MVTime mvt(tm); 189 mvt.setFormat(MVTime::TIME); 194 if (showDate) 195 mvt.setFormat(MVTime::YMD); 196 else 197 mvt.setFormat(MVTime::TIME); 190 198 ostringstream oss; 191 199 oss << mvt; 192 String str(oss);193 return str; 194 } 200 return String(oss); 201 } 202 195 203 double SDMemTable::getInterval(Int whichRow) const 196 204 { … … 620 628 } 621 629 622 MDirection SDMemTable::getDirection(Int whichRow ) const630 MDirection SDMemTable::getDirection(Int whichRow, Bool refBeam) const 623 631 { 624 632 MDirection::Types mdr = getDirectionReference(); … … 917 925 Double xcop = x; 918 926 MVTime mvt(xcop/24./3600.); // make days 927 919 928 if (x < 59.95) 920 return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s"; 921 return mvt.string(MVTime::TIME_CLEAN_NO_H, 7)+" "; 929 return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s"; 930 else if (x < 3599.95) 931 return String(" ") + mvt.string(MVTime::TIME_CLEAN_NO_H,7)+" "; 932 else { 933 ostringstream oss; 934 oss << setw(2) << std::right << setprecision(1) << mvt.hour(); 935 oss << ":" << mvt.string(MVTime::TIME_CLEAN_NO_H,7) << " "; 936 return String(oss); 937 } 922 938 }; 939 940 String SDMemTable::formatDirection(const MDirection& md) const 941 { 942 Vector<Double> t = md.getAngle(Unit(String("rad"))).getValue(); 943 Int prec = 7; 944 945 MVAngle mvLon(t[0]); 946 String sLon = mvLon.string(MVAngle::TIME,prec); 947 MVAngle mvLat(t[1]); 948 String sLat = mvLat.string(MVAngle::ANGLE+MVAngle::DIG2,prec); 949 950 return sLon + String(" ") + sLat; 951 } 952 923 953 924 954 std::string SDMemTable::getFluxUnit() const … … 953 983 ROScalarColumn<Int> scans(table_, "SCANID"); 954 984 ROScalarColumn<String> srcs(table_, "SRCNAME"); 985 986 // get number of integrations per scan 987 int cIdx = 0; 988 int idx = 0; 989 int scount = 0; 990 std::vector<int> cycles; 991 for (uInt i=0; i<scans.nrow();++i) { 992 while (idx == cIdx && i<scans.nrow()) { 993 scans.getScalar(++i,cIdx); 994 ++scount; 995 } 996 idx = cIdx; 997 cycles.push_back(scount); 998 scount=0; 999 --i; 1000 } 1001 1002 955 1003 ostringstream oss; 956 1004 oss << endl; … … 967 1015 table_.keywordSet().get("Observer", tmp); 968 1016 oss << setw(15) << "Observer:" << tmp << endl; 1017 oss << setw(15) << "Obs Date:" << getTime(-1,True) << endl; 969 1018 table_.keywordSet().get("Project", tmp); 970 1019 oss << setw(15) << "Project:" << tmp << endl; … … 992 1041 Int previous = -1;Int current=0; 993 1042 Int integ = 0; 1043 String dirtype ="Position ("+ 1044 MDirection::showType(getDirectionReference())+ 1045 ")"; 994 1046 oss << setw(6) << "Scan" 995 << setw(12) << "Source" 996 << setw(21) << "Time" 997 << setw(11) << "Integration" << endl; 998 oss << "--------------------------------------------------" << endl; 1047 << setw(15) << "Source" 1048 << setw(26) << dirtype 1049 << setw(10) << "Time" 1050 << setw(13) << "Integration" << endl; 1051 oss << "-------------------------------------------------------------------------------" << endl; 1052 1053 std::vector<int>::iterator it = cycles.begin(); 999 1054 for (uInt i=0; i< scans.nrow();i++) { 1000 1055 scans.getScalar(i,current); … … 1003 1058 previous = current; 1004 1059 String t = formatSec(Double(getInterval(i))); 1005 oss << setw(6) << count << setw(12) << name << setw(21) << getTime(i) 1006 << setw(2) << setprecision(1) 1007 << t << endl; 1060 String posit = formatDirection(getDirection(i,True)); 1061 oss << setw(6) << count 1062 << setw(15) << name 1063 << setw(26) << posit 1064 << setw(10) << getTime(i,False) 1065 << setw(3) << std::right << *it << " x " 1066 << setw(10) 1067 << t << std::left << endl; 1008 1068 count++; 1069 it++; 1009 1070 } else { 1010 1071 integ++; … … 1014 1075 oss << "Table contains " << table_.nrow() << " integration(s)." << endl; 1015 1076 oss << "in " << count << " scan(s)." << endl; 1016 oss << "-------------------------------------------------- ";1077 oss << "-------------------------------------------------------------------------------"; 1017 1078 return String(oss); 1018 1079 } … … 1101 1162 } 1102 1163 1103 MDirection::Types SDMemTable::getDirectionReference 1164 MDirection::Types SDMemTable::getDirectionReference() const 1104 1165 { 1105 1166 Float eq; -
trunk/src/SDMemTable.h
r263 r281 93 93 std::vector<double> getRestFreqs() const; 94 94 95 // get info for current row 96 std::string getTime(casa::Int whichRow=0) const ; 95 // get info for current row 96 // if whichRow == -1 the Header time is given 97 std::string getTime(casa::Int whichRow=0, 98 casa::Bool showDate=casa::False) const ; 97 99 std::string getSourceName(casa::Int whichRow=0) const; 98 100 double getInterval(casa::Int whichRow=0) const; … … 173 175 174 176 // Get MDirection for this row 175 casa::MDirection getDirection(casa::Int whichRow=0) const; 177 casa::MDirection getDirection(casa::Int whichRow=0, 178 casa::Bool refBeam=casa::False) const; 176 179 177 180 // Get gloabl Direction reference 178 casa::MDirection::Types getDirectionReference 181 casa::MDirection::Types getDirectionReference() const; 179 182 180 183 // Get global Time reference 181 casa::MEpoch::Types getTimeReference 184 casa::MEpoch::Types getTimeReference() const; 182 185 183 186 // Helper function to check instrument (antenna) name and give enum 184 static Instrument convertInstrument 185 187 static Instrument convertInstrument(const casa::String& instrument, 188 casa::Bool throwIt); 186 189 187 190 private: 188 191 // utility func for nice printout 189 192 casa::String formatSec(casa::Double x) const; 193 casa::String formatDirection(const casa::MDirection& md) const; 190 194 void setup(); 191 195 // the current cursor into the array
Note:
See TracChangeset
for help on using the changeset viewer.