- Timestamp:
- 12/15/14 20:22:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STApplyCal.cpp
r3020 r3021 230 230 } 231 231 }; 232 233 inline void flagSpectrum(uInt &flagrow, Vector<uChar> &flagchan) { 234 flagrow = 1; 235 flagchan = (uChar)(1 << 7); 236 } 237 238 inline void flagSpectra(Table &tab, const Vector<uInt> &rows) { 239 //os_ << LogIO::WARN << "No valid sky data in sky caltable. Completely flag Beam " << beamno << " Spw " << ifno << " Pol " << polno << LogIO::POST; 240 // Given sky tables are all empty 241 // So, flag all data 242 //Table tab = work_->table(); 243 ArrayColumn<uChar> flCol(tab, "FLAGTRA"); 244 ScalarColumn<uInt> frCol(tab, "FLAGROW"); 245 Vector<uChar> flag; 246 uInt flagrow; 247 for (uInt i = 0; i < rows.nelements(); i++) { 248 uInt irow = rows[i]; 249 flCol.get(irow, flag); 250 frCol.get(irow, flagrow); 251 flagSpectrum(flagrow, flag); 252 //flag = (uChar)(1 << 7); 253 flCol.put(irow, flag); 254 frCol.put(irow, flagrow); 255 } 256 } 257 232 258 } 233 259 … … 454 480 455 481 // Skip IFNO without sky data 456 if (nrowSkyTotal == 0) 482 if (nrowSkyTotal == 0) { 483 if (skytable_.size() > 0) { 484 os_ << LogIO::WARN << "No data in sky caltable. Completely flag Beam " << beamno << " Spw " << ifno << " Pol " << polno << LogIO::POST; 485 // Given sky tables are all empty 486 // So, flag all data 487 flagSpectra(work_->table(), rows); 488 } 457 489 return; 490 } 458 491 459 492 uInt nchanTsys = 0; 460 493 Vector<Double> ftsys; 461 494 uInt tsysifno = getIFForTsys(ifno); 495 Bool onlyInvalidTsys = False; 462 496 os_ << "tsysifno=" << (Int)tsysifno << LogIO::POST; 463 497 if (tsystable_.size() == 0) { … … 483 517 } 484 518 } 519 if (nrowTsysTotal == 0) { 520 os_ << "No valid Tsys measurement. for Beam " << beamno << " Spw " << ifno << " Pol " << polno << ". Skip Tsys calibration." << LogIO::POST; 521 doTsys = False; 522 onlyInvalidTsys = True; 523 } 485 524 } 486 525 … … 493 532 nrowSkyTotal, nchanSp, 494 533 timeSky, spoff, flagoff); 534 if (allNE(flagoff, (uChar)0)) { 535 os_ << LogIO::WARN << "No valid sky data in sky caltable. Completely flag Beam " << beamno << " Spw " << ifno << " Pol " << polno << LogIO::POST; 536 // Given sky tables are all invalid 537 // So, flag all data 538 flagSpectra(work_->table(), rows); 539 } 495 540 nrowSky = timeSky.nelements(); 496 541 … … 509 554 510 555 if (allNE(flagtsys, (uChar)0)) { 511 os_ << LogIO::WARN << "No valid Tsys measurement . Skip Tsys calibration." << LogIO::POST;556 os_ << LogIO::WARN << "No valid Tsys measurement for Beam " << beamno << " Spw " << ifno << " Pol " << polno << ". Skip Tsys calibration." << LogIO::POST; 512 557 doTsys = False; 558 onlyInvalidTsys = True; 513 559 } 514 560 } … … 519 565 ArrayColumn<Float> tsysCol(tab, "TSYS"); 520 566 ScalarColumn<Double> timeCol(tab, "TIME"); 567 ScalarColumn<uInt> frCol(tab, "FLAGROW"); 521 568 522 569 // Array for scaling factor (aka Tsys) … … 547 594 spCol.get(irow, on); 548 595 flCol.get(irow, flag); 596 uInt flagrow = frCol(irow); 549 597 //os_ << "on=" << on[0] << LogIO::POST; 550 598 calibrator_->setSource(on); … … 605 653 calibrator_->calibrate(); 606 654 655 // flag spectrum if no valid Tsys measurement available 656 if (onlyInvalidTsys) { 657 flagSpectrum(flagrow, flag); 658 } 659 607 660 // update table 608 661 //os_ << "calibrated=" << calibrator_->getCalibrated()[0] << LogIO::POST; 609 662 spCol.put(irow, calibrator_->getCalibrated()); 610 663 flCol.put(irow, flag); 611 if (filltsys) 664 frCol.put(irow, flagrow); 665 if (filltsys && !onlyInvalidTsys) 612 666 tsysCol.put(irow, iTsys); 613 667 }
Note:
See TracChangeset
for help on using the changeset viewer.