Changeset 365 for trunk


Ignore:
Timestamp:
02/03/05 19:00:03 (20 years ago)
Author:
kil064
Message:

rework summary function to handle scan boundary
more straightforardly and to add freqID listing
to each scan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r348 r365  
    6060#include "SDMemTable.h"
    6161#include "SDContainer.h"
     62#include "MathUtils.h"
    6263
    6364
     
    10181019  Double xcop = x;
    10191020  MVTime mvt(xcop/24./3600.);  // make days
    1020  
     1021
    10211022  if (x < 59.95)
    10221023    return  String("      ") + mvt.string(MVTime::TIME_CLEAN_NO_HM, 7)+"s";
     
    10741075
    10751076std::string SDMemTable::summary() const  {
    1076 
    1077   // get number of integrations per scan
    1078   int cIdx = 0;
    1079   int idx = 0;
    1080   int scount = 0;
    1081   std::vector<int> cycles;
    1082   for (uInt i=0; i<scanCol_.nrow();++i) {
    1083     while (idx == cIdx && i<scanCol_.nrow()) {
    1084       scanCol_.getScalar(++i,cIdx);
    1085       ++scount;
    1086     }
    1087     idx = cIdx;
    1088     cycles.push_back(scount);
    1089     scount=0;
    1090     --i;
    1091   } 
    1092 
    10931077
    10941078  ostringstream oss;
     
    11281112      << "IF[" << getIF() << "] " << "Pol[" << getPol() << "]" << endl;
    11291113  oss << endl;
    1130   uInt count = 0;
    1131   String name;
    1132   Int previous = -1;Int current=0;
    1133   Int integ = 0;
     1114//
    11341115  String dirtype ="Position ("+
    11351116    MDirection::showType(getDirectionReference())+
     
    11391120      << setw(26) << dirtype
    11401121      << setw(10) << "Time"
    1141       << setw(13) << "Integration" << endl;
    1142   oss << "-------------------------------------------------------------------------------" << endl;
     1122      << setw(18) << "Integration"
     1123      << setw(10) << "FreqIDs" << endl;
     1124  oss << "----------------------------------------------------------------------------------" << endl;
    11431125 
    1144   std::vector<int>::iterator it = cycles.begin();
    1145   for (uInt i=0; i< scanCol_.nrow();i++) {
    1146     scanCol_.getScalar(i,current);
    1147     if (previous != current) {
    1148       srcnCol_.getScalar(i,name);
    1149       previous = current;
    1150       String t = formatSec(Double(getInterval(i)));
    1151       String posit = formatDirection(getDirection(i,True));
    1152       oss << setw(6) << count
    1153           << setw(15) << name
     1126//
     1127  uInt scanNo = 0;
     1128  String name;
     1129  Int lastScanID = 0;
     1130  Int scanID;
     1131  uInt firstRow = 0;
     1132  Vector<uInt> freqIDs, listFQ;
     1133//
     1134  uInt nRow = scanCol_.nrow();
     1135  for (uInt i=0; i<nRow; i++) {
     1136    scanCol_.getScalar(i,scanID);
     1137    freqidCol_.get(i, freqIDs);
     1138//
     1139    if (i>0 && (i==nRow-1 || scanID!=lastScanID)) {
     1140      srcnCol_.getScalar(firstRow,name);
     1141      String t = formatSec(Double(getInterval(firstRow)));
     1142      String posit = formatDirection(getDirection(firstRow,True));
     1143      uInt nInt = (i-firstRow);
     1144      if (i==nRow-1 &&scanID==lastScanID) nInt++;   // Last row but same scan
     1145//
     1146      oss << setw(6) << scanNo
     1147          << setw(15) << name
    11541148          << setw(26) << posit
    1155           << setw(10) << getTime(i,False)
    1156           << setw(3) << std::right << *it << " x "
    1157           << setw(10)
    1158           << t << std::left << endl;
    1159       count++;
    1160       it++;
     1149          << setw(10) << getTime(firstRow,False)
     1150          << setw(3) << nInt  << setw(3) << " x " << setw(6) <<  t
     1151          << " " << listFQ << endl;
     1152//
     1153      lastScanID = scanID;
     1154      firstRow = i;
     1155      scanNo++;
     1156      listFQ.resize(0);
    11611157    } else {
    1162       integ++;
     1158      for (uInt j=0; j<freqIDs.nelements(); j++) {
     1159         mathutil::addEntry(listFQ, freqIDs(j));
     1160      }
    11631161    }
    11641162  }
    11651163  oss << endl;
    1166   oss << "Table contains " << table_.nrow() << " integration(s) in " << count << " scan(s)." << endl;
     1164  oss << "Table contains " << table_.nrow() << " integration(s) in " << scanNo << " scan(s)." << endl;
    11671165
    11681166// Frequency Table
     
    11721170  oss << endl << endl;
    11731171  oss << "FreqID  Frame   RefFreq(Hz)     RefPix   Increment(Hz)" << endl;
    1174   oss << "-------------------------------------------------------------------------------" << endl;
     1172  oss << "----------------------------------------------------------------------------------" << endl;
    11751173  for (uInt i=0; i<sdft.length(); i++) {
    11761174     oss << setw(8) << i << setw(8)
     
    11801178                    << sdft.increment(i) << endl;
    11811179  }
    1182   oss << "-------------------------------------------------------------------------------" << endl;
     1180  oss << "----------------------------------------------------------------------------------" << endl;
    11831181  return String(oss);
    11841182}
Note: See TracChangeset for help on using the changeset viewer.