Commits
499 499 | } |
500 500 | |
501 501 | // Only accumulate chunks with the same number of channels |
502 502 | if (cti.nchan() != nChan_p) { |
503 503 | throw(AipsError("PlotMSCTAverager: data shape does not conform")); |
504 504 | } |
505 505 | |
506 506 | // Param cubes for this iteration |
507 507 | Cube<Complex> iterCParam; |
508 508 | Cube<Float> iterFParam, iterParamErr, iterSnr, iterWt; |
509 + | Cube<Bool> iterFlag; |
509 510 | Vector<Double> iterFreq; |
510 511 | |
511 512 | if (isComplex_p) { |
512 513 | iterCParam.reference(cti.cparam()); |
513 514 | if (averaging_p.scalarAve()) { |
514 515 | convertToAP(iterCParam); |
515 516 | } |
516 517 | } else { |
517 518 | iterFParam.reference(cti.fparam()); |
518 519 | } |
519 520 | iterParamErr.reference(cti.paramErr()); |
520 521 | iterSnr.reference(cti.snr()); |
522 + | iterFlag.reference(cti.flag()); |
521 523 | iterFreq.reference(cti.freq()); |
522 524 | |
523 525 | try { |
524 526 | iterWt.reference(cti.wt()); |
525 527 | } catch (const AipsError& err) { |
526 528 | casacore::IPosition datashape = |
527 529 | (isComplex_p ? iterCParam.shape() : iterFParam.shape()); |
528 530 | iterWt.resize(datashape); |
529 531 | iterWt.set(1.0); |
530 532 | } |
559 561 | if (outchan == nAvgChan_p) { |
560 562 | break; |
561 563 | } |
562 564 | } |
563 565 | } else { |
564 566 | outchan = ichan; // use same channel when not averaging |
565 567 | } |
566 568 | |
567 569 | // Consider accumulation according to state of flags |
568 570 | IPosition inPos(3, ipol, ichan, ibln); |
569 - | if (!cti.flag()(inPos)) { // input UNflagged |
571 + | if (!iterFlag(inPos)) { // input UNflagged |
570 572 | // we will accumulate both ants |
571 573 | accum_i = accum_j = true; |
572 574 | |
573 575 | // Zero accumulators if output cell currently flagged |
574 576 | for (Int ij = 0; ij < 2; ++ij) { |
575 577 | Int ia = oblnij(ij); |
576 578 | IPosition iaPos(3, ipol, outchan, ia); |
577 579 | if (avgFlag_(iaPos)) { // output flagged |
578 580 | // This cell now NEWLY unflagged in output |
579 581 | avgFlag_(iaPos) = false; |