Changeset 385


Ignore:
Timestamp:
02/08/05 13:21:28 (20 years ago)
Author:
kil064
Message:

have another go at summary function. this time
rework with list of scan boundaries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r380 r385  
    444444
    445445  SpectralCoordinate spc = getSpectralCoordinate(freqID, whichRow);
    446 //
    447446  Vector<Double> pixel(nChan());
    448447  indgen(pixel);
     
    709708                                                     uInt whichRow) const
    710709{
     710
    711711// Create basic SC
    712712
     
    10851085std::string SDMemTable::summary(bool verbose) const  {
    10861086
     1087// Format header info
     1088
    10871089  ostringstream oss;
    10881090  oss << endl;
     
    11221124  oss << endl;
    11231125//
    1124   String dirtype ="Position ("+
    1125     MDirection::showType(getDirectionReference())+
    1126     ")";
     1126  String dirtype ="Position ("+ MDirection::showType(getDirectionReference()) + ")";
    11271127  oss << setw(5) << "Scan"
    11281128      << setw(15) << "Source"
     
    11331133  oss << "--------------------------------------------------------------------------------" << endl;
    11341134 
    1135 //
    1136   uInt scanNo = 0;
     1135// Generate list of scan start and end integrations
     1136
     1137  Vector<Int> scanIDs = scanCol_.getColumn();
     1138  Vector<uInt> startInt, endInt;
     1139  mathutil::scanBoundaries(startInt, endInt, scanIDs);
     1140//
     1141  const uInt nScans = startInt.nelements();
    11371142  String name;
    1138   Int lastScanID = 0;
    1139   Int scanID;
    1140   uInt firstRow = 0;
    11411143  Vector<uInt> freqIDs, listFQ;
    1142 //
    1143   uInt nRow = scanCol_.nrow();
    1144   for (uInt i=0; i<nRow; i++) {
    1145     scanCol_.getScalar(i,scanID);
    1146     freqidCol_.get(i, freqIDs);
    1147 //
    1148     if (i>0 && (i==nRow-1 || scanID!=lastScanID)) {
    1149       srcnCol_.getScalar(firstRow,name);
    1150       String t = formatSec(Double(getInterval(firstRow)));
    1151       String posit = formatDirection(getDirection(firstRow,True));
    1152       uInt nInt = (i-firstRow);
    1153 
    1154 // Special case adjustments
    1155 
    1156       if (i==nRow-1 &&scanID==lastScanID)  nInt++;   
    1157       if (nInt==1 && i>1) {
    1158          for (uInt j=0; j<freqIDs.nelements(); j++)
    1159            mathutil::addEntry(listFQ, freqIDs(j));
     1144  uInt nInt;
     1145//
     1146  for (uInt i=0; i<nScans; i++) {
     1147
     1148// Get things from first integration of scan
     1149
     1150      String time = getTime(startInt(i),False);
     1151      String tInt = formatSec(Double(getInterval(startInt(i))));
     1152      String posit = formatDirection(getDirection(startInt(i),True));
     1153      srcnCol_.getScalar(startInt(i),name);
     1154
     1155// Find all the FreqIDs in this scan
     1156
     1157      listFQ.resize(0);     
     1158      for (uInt j=startInt(i); j<endInt(i)+1; j++) {
     1159         freqidCol_.get(j, freqIDs);
     1160         for (uInt k=0; k<freqIDs.nelements(); k++) {
     1161            mathutil::addEntry(listFQ, freqIDs(k));
     1162         }
    11601163      }
    1161       oss << setw(3) << std::right << scanNo << std::left << setw(2) << "  "
     1164//
     1165      nInt = endInt(i) - startInt(i) + 1;
     1166      oss << setw(3) << std::right << i << std::left << setw(2) << "  "
    11621167          << setw(15) << name
    11631168          << setw(24) << posit
    1164           << setw(10) << getTime(firstRow,False)
     1169          << setw(10) << time
    11651170          << setw(3) << std::right << nInt  << setw(3) << " x " << std::left
    1166           << setw(6) <<  t 
     1171          << setw(6) <<  tInt
    11671172          << " " << listFQ << endl;
    1168 //
    1169       lastScanID = scanID;
    1170       firstRow = i;
    1171       scanNo++;
    1172       listFQ.resize(0);
    1173     } else {
    1174        for (uInt j=0; j<freqIDs.nelements(); j++) mathutil::addEntry(listFQ, freqIDs(j));
    1175     }
    11761173  }
    11771174  oss << endl;
    1178   oss << "Table contains " << table_.nrow() << " integration(s) in " << scanNo << " scan(s)." << endl;
     1175  oss << "Table contains " << table_.nrow() << " integration(s) in " << nScans << " scan(s)." << endl;
    11791176
    11801177// Frequency Table
     1178
    11811179  if (verbose) {
    11821180    std::vector<string> info = getCoordInfo();
Note: See TracChangeset for help on using the changeset viewer.