Changeset 2744
- Timestamp:
- 01/23/13 18:26:47 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r2710 r2744 80 80 } 81 81 82 virtual void enterObservationId(const uInt recordNo, Int columnValue) { }83 virtual void leaveObservationId(const uInt recordNo, Int columnValue) { }84 virtual void enterFeedId(const uInt recordNo, Int columnValue) { }85 virtual void leaveFeedId(const uInt recordNo, Int columnValue) { }86 virtual void enterFieldId(const uInt recordNo, Int columnValue) { }87 virtual void leaveFieldId(const uInt recordNo, Int columnValue) { }88 virtual void enterDataDescId(const uInt recordNo, Int columnValue) { }89 virtual void leaveDataDescId(const uInt recordNo, Int columnValue) { }90 virtual void enterScanNo(const uInt recordNo, Int columnValue) { }91 virtual void leaveScanNo(const uInt recordNo, Int columnValue) { }92 virtual void enterStateId(const uInt recordNo, Int columnValue) { }93 virtual void leaveStateId(const uInt recordNo, Int columnValue) { }94 virtual void enterTime(const uInt recordNo, Double columnValue) { }95 virtual void leaveTime(const uInt recordNo, Double columnValue) { }96 97 virtual Bool visitRecord(const uInt recordNo,98 const Int ObservationId,99 const Int feedId,100 const Int fieldId,101 const Int dataDescId,102 const Int scanNo,103 const Int stateId,104 const Double time) { return True ; }82 virtual void enterObservationId(const uInt /*recordNo*/, Int /*columnValue*/) { } 83 virtual void leaveObservationId(const uInt /*recordNo*/, Int /*columnValue*/) { } 84 virtual void enterFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 85 virtual void leaveFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 86 virtual void enterFieldId(const uInt /*recordNo*/, Int /*columnValue*/) { } 87 virtual void leaveFieldId(const uInt /*recordNo*/, Int /*columnValue*/) { } 88 virtual void enterDataDescId(const uInt /*recordNo*/, Int /*columnValue*/) { } 89 virtual void leaveDataDescId(const uInt /*recordNo*/, Int /*columnValue*/) { } 90 virtual void enterScanNo(const uInt /*recordNo*/, Int /*columnValue*/) { } 91 virtual void leaveScanNo(const uInt /*recordNo*/, Int /*columnValue*/) { } 92 virtual void enterStateId(const uInt /*recordNo*/, Int /*columnValue*/) { } 93 virtual void leaveStateId(const uInt /*recordNo*/, Int /*columnValue*/) { } 94 virtual void enterTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 95 virtual void leaveTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 96 97 virtual Bool visitRecord(const uInt /*recordNo*/, 98 const Int /*ObservationId*/, 99 const Int /*feedId*/, 100 const Int /*fieldId*/, 101 const Int /*dataDescId*/, 102 const Int /*scanNo*/, 103 const Int /*stateId*/, 104 const Double /*time*/) { return True ; } 105 105 106 106 virtual Bool visit(Bool isFirst, const uInt recordNo, … … 351 351 } 352 352 353 virtual void enterObservationId(const uInt recordNo, Int columnValue) {353 virtual void enterObservationId(const uInt /*recordNo*/, Int columnValue) { 354 354 //printf("%u: ObservationId: %d\n", recordNo, columnValue); 355 355 // update header … … 367 367 getScalar( "TELESCOPE_NAME", (uInt)columnValue, obstab, header.antennaname ) ; 368 368 } 369 virtual void leaveObservationId(const uInt recordNo, Int columnValue) {369 virtual void leaveObservationId(const uInt /*recordNo*/, Int /*columnValue*/) { 370 370 // update header 371 371 header.nbeam = max( header.nbeam, (Int)nbeam ) ; … … 374 374 feedEntry = -1 ; 375 375 } 376 virtual void enterFeedId(const uInt recordNo, Int columnValue) {376 virtual void enterFeedId(const uInt /*recordNo*/, Int columnValue) { 377 377 //printf("%u: FeedId: %d\n", recordNo, columnValue); 378 378 … … 387 387 *focusIdRF = (uInt)0 ; 388 388 } 389 virtual void leaveFeedId(const uInt recordNo, Int columnValue) {390 Int nelem = (Int)feedEntry.nelements() ;389 virtual void leaveFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { 390 uInt nelem = feedEntry.nelements() ; 391 391 if ( nbeam > nelem ) { 392 392 feedEntry.resize( nelem+64, True ) ; … … 395 395 } 396 396 } 397 virtual void enterFieldId(const uInt recordNo, Int columnValue) {397 virtual void enterFieldId(const uInt /*recordNo*/, Int columnValue) { 398 398 //printf("%u: FieldId: %d\n", recordNo, columnValue); 399 399 // update sourceId and fieldName … … 406 406 *fieldNameRF = fieldName ; 407 407 } 408 virtual void leaveFieldId(const uInt recordNo, Int columnValue) {408 virtual void leaveFieldId(const uInt /*recordNo*/, Int /*columnValue*/) { 409 409 sourceId = -1 ; 410 410 } 411 virtual void enterDataDescId(const uInt recordNo, Int columnValue) {411 virtual void enterDataDescId(const uInt /*recordNo*/, Int columnValue) { 412 412 //printf("%u: DataDescId: %d\n", recordNo, columnValue); 413 413 // update polarization and spectral window ids … … 486 486 } 487 487 } 488 virtual void leaveDataDescId(const uInt recordNo, Int columnValue) {488 virtual void leaveDataDescId(const uInt /*recordNo*/, Int /*columnValue*/) { 489 489 npol = 0 ; 490 490 nchan = 0 ; 491 491 numSysCalRow = 0 ; 492 492 } 493 virtual void enterScanNo(const uInt recordNo, Int columnValue) {493 virtual void enterScanNo(const uInt /*recordNo*/, Int columnValue) { 494 494 //printf("%u: ScanNo: %d\n", recordNo, columnValue); 495 495 // put value … … 497 497 *scanNoRF = (uInt)columnValue - 1 ; 498 498 } 499 virtual void leaveScanNo(const uInt recordNo, Int columnValue) {499 virtual void leaveScanNo(const uInt /*recordNo*/, Int /*columnValue*/) { 500 500 cycleNo = 0 ; 501 501 } 502 virtual void enterStateId(const uInt recordNo, Int columnValue) {502 virtual void enterStateId(const uInt /*recordNo*/, Int columnValue) { 503 503 //printf("%u: StateId: %d\n", recordNo, columnValue); 504 504 // SRCTYPE … … 512 512 *sourceTypeRF = srcType ; 513 513 } 514 virtual void leaveStateId(const uInt recordNo, Int columnValue) { }514 virtual void leaveStateId(const uInt /*recordNo*/, Int /*columnValue*/) { } 515 515 virtual void enterTime(const uInt recordNo, Double columnValue) { 516 516 //printf("%u: Time: %f\n", recordNo, columnValue); … … 543 543 *weatherIdRF = wid ; 544 544 } 545 virtual void leaveTime(const uInt recordNo, Double columnValue) { }545 virtual void leaveTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 546 546 virtual Bool visitRecord(const uInt recordNo, 547 const Int observationId,548 const Int feedId,549 const Int fieldId,550 const Int dataDescId,551 const Int scanNo,552 const Int stateId,553 const Double time)547 const Int /*observationId*/, 548 const Int /*feedId*/, 549 const Int /*fieldId*/, 550 const Int /*dataDescId*/, 551 const Int /*scanNo*/, 552 const Int /*stateId*/, 553 const Double /*time*/) 554 554 { 555 555 //printf("%u: %d, %d, %d, %d, %d, %d, %f\n", recordNo, … … 580 580 tcalids = getTcalId( syscalTime[scIdx] ) ; 581 581 } 582 // else { 583 // tcalids = getDummyTcalId( spwId ) ; 584 // } 582 585 583 586 // put value … … 610 613 // remove redundant rows 611 614 //cout << "filled " << rowidx << " rows out of " << scantable.nrow() << " rows" << endl ; 612 if ( scantable.nrow() > rowidx ) {615 if ( scantable.nrow() > (Int)rowidx ) { 613 616 uInt numRemove = scantable.nrow() - rowidx ; 614 617 //cout << "numRemove = " << numRemove << endl ; … … 982 985 srate = d.column( 1 ) ; 983 986 } 984 void getSourceDirection( Vector<Double> &dir, Vector<Double> &azel, Vector<Double> & srate)987 void getSourceDirection( Vector<Double> &dir, Vector<Double> &azel, Vector<Double> &/*srate*/ ) 985 988 { 986 989 dir = sourceDir.getAngle( "rad" ).getValue() ; … … 1243 1246 } 1244 1247 return tcalids ; 1248 } 1249 Block<uInt> getDummyTcalId( Int spwId ) 1250 { 1251 Block<uInt> idList(4, 0); 1252 uInt nfields = syscalRecord.nfields(); 1253 Int idx = -1; 1254 for (uInt i = 0; i< nfields ; i++ ) { 1255 String spw = "SPW" + String::toString(spwId); 1256 if (syscalRecord.name(i).find(spw) != String::npos) { 1257 idx = i; 1258 break; 1259 } 1260 } 1261 if ( idx > -1) { 1262 Vector<uInt> tmp = syscalRecord.asArrayuInt(idx); 1263 for (uInt j = 0 ; j < 4 ; j++) { 1264 idList[j] = tmp[0]; 1265 } 1266 cout << "tmp=" << tmp << endl; 1267 } 1268 return idList; 1245 1269 } 1246 1270 uInt maxNumPol() … … 1343 1367 } 1344 1368 1345 virtual void enterAntennaId(const uInt recordNo, Int columnValue) { }1346 virtual void leaveAntennaId(const uInt recordNo, Int columnValue) { }1347 virtual void enterFeedId(const uInt recordNo, Int columnValue) { }1348 virtual void leaveFeedId(const uInt recordNo, Int columnValue) { }1349 virtual void enterSpwId(const uInt recordNo, Int columnValue) { }1350 virtual void leaveSpwId(const uInt recordNo, Int columnValue) { }1351 virtual void enterTime(const uInt recordNo, Double columnValue) { }1352 virtual void leaveTime(const uInt recordNo, Double columnValue) { }1353 1354 virtual Bool visitRecord(const uInt recordNo,1355 const Int antennaId,1356 const Int feedId,1357 const Int spwId,1358 const Double time) { return True ; }1369 virtual void enterAntennaId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1370 virtual void leaveAntennaId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1371 virtual void enterFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1372 virtual void leaveFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1373 virtual void enterSpwId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1374 virtual void leaveSpwId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1375 virtual void enterTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 1376 virtual void leaveTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 1377 1378 virtual Bool visitRecord(const uInt /*recordNo*/, 1379 const Int /*antennaId*/, 1380 const Int /*feedId*/, 1381 const Int /*spwId*/, 1382 const Double /*time*/) { return True ; } 1359 1383 1360 1384 virtual Bool visit(Bool isFirst, const uInt recordNo, … … 1470 1494 } 1471 1495 1472 virtual void enterAntennaId(const uInt recordNo, Int columnValue) {1496 virtual void enterAntennaId(const uInt /*recordNo*/, Int columnValue) { 1473 1497 if ( columnValue == antenna ) 1474 1498 process = True ; 1475 1499 } 1476 virtual void leaveAntennaId(const uInt recordNo, Int columnValue) {1500 virtual void leaveAntennaId(const uInt /*recordNo*/, Int /*columnValue*/) { 1477 1501 process = False ; 1478 1502 } 1479 virtual void enterFeedId(const uInt recordNo, Int columnValue) { }1480 virtual void leaveFeedId(const uInt recordNo, Int columnValue) { }1481 virtual void enterSpwId(const uInt recordNo, Int columnValue) { }1482 virtual void leaveSpwId(const uInt recordNo, Int columnValue) { }1483 virtual void enterTime(const uInt recordNo, Double columnValue) {1503 virtual void enterFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1504 virtual void leaveFeedId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1505 virtual void enterSpwId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1506 virtual void leaveSpwId(const uInt /*recordNo*/, Int /*columnValue*/) { } 1507 virtual void enterTime(const uInt recordNo, Double /*columnValue*/) { 1484 1508 qtime = timeCol( recordNo ) ; 1485 1509 } 1486 virtual void leaveTime(const uInt recordNo, Double columnValue) { }1510 virtual void leaveTime(const uInt /*recordNo*/, Double /*columnValue*/) { } 1487 1511 virtual Bool visitRecord(const uInt recordNo, 1488 const Int antennaId,1512 const Int /*antennaId*/, 1489 1513 const Int feedId, 1490 1514 const Int spwId, 1491 const Double time)1515 const Double /*time*/) 1492 1516 { 1493 1517 //cout << "(" << recordNo << "," << antennaId << "," << feedId << "," << spwId << ")" << endl ; … … 2049 2073 traverseTable(sctab, cols, tms, &visitor); 2050 2074 2075 infillTcal(); 2076 2051 2077 //tcalrec_.print( std::cout ) ; 2052 2078 //double endSec = mathutil::gettimeofday_sec() ; 2053 2079 //os_ << "end MSFiller::fillTcal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 2080 } 2081 2082 void MSFiller::infillTcal() 2083 { 2084 uInt nfields = tcalrec_.nfields() ; 2085 set<Int> spwAvailable; 2086 for (uInt i = 0; i < nfields; i++) { 2087 String name = tcalrec_.name(i); 2088 size_t pos1 = name.find(':') + 4; 2089 size_t pos2 = name.find(':',pos1); 2090 Int spwid = String::toInt(name.substr(pos1,pos2-pos1)); 2091 //cout << "spwid=" << spwid << endl; 2092 spwAvailable.insert(spwid); 2093 } 2094 Table spwtab = mstable_.spectralWindow(); 2095 Table tcaltab = table_->tcal().table(); 2096 ScalarColumn<uInt> idCol(tcaltab, "ID"); 2097 ScalarColumn<String> timeCol(tcaltab, "TIME"); 2098 ArrayColumn<Float> tcalCol(tcaltab, "TCAL"); 2099 ROScalarColumn<Int> numChanCol(spwtab, "NUM_CHAN"); 2100 Int numSpw = spwtab.nrow(); 2101 Int dummyFeed = 0; 2102 Double dummyTime = 0.0; 2103 Vector<uInt> idminmax(2); 2104 for (Int i = 0; i < numSpw; i++) { 2105 if (spwAvailable.find(i) == spwAvailable.end()) { 2106 String key = keyTcal(dummyFeed, i, dummyTime); 2107 Vector<Float> tcal(numChanCol(i), 1.0); 2108 uInt nrow = tcaltab.nrow(); 2109 tcaltab.addRow(1); 2110 idCol.put(nrow, nrow); 2111 timeCol.put(nrow, ""); 2112 tcalCol.put(nrow, tcal); 2113 idminmax = nrow; 2114 tcalrec_.define(key, idminmax); 2115 } 2116 } 2117 //tcalrec_.print(cout); 2054 2118 } 2055 2119 -
trunk/src/MSFiller.h
r2293 r2744 121 121 }; 122 122 123 class MSFiller 123 class MSFiller : public MSFillerUtils 124 124 { 125 125 public: … … 148 148 //void fillFit() ; 149 149 void fillTcal() ; 150 151 // create key for TCAL table 152 String keyTcal( Int feedid, Int spwid, String stime ) ; 150 void infillTcal() ; 153 151 154 152 // get frequency frame
Note:
See TracChangeset
for help on using the changeset viewer.