diff --git a/CEP/DP3/DPPP/include/DPPP/PhaseFitter.h b/CEP/DP3/DPPP/include/DPPP/PhaseFitter.h index 3a70a964e9e5556d98bcb8697d6805be1f1a3281..93caa23c16b3e948654de3aed0f5f952027b16c3 100644 --- a/CEP/DP3/DPPP/include/DPPP/PhaseFitter.h +++ b/CEP/DP3/DPPP/include/DPPP/PhaseFitter.h @@ -193,7 +193,9 @@ class PhaseFitter * * @returns Array of @ref Size() doubles with the weights. */ - double* WeightData() { return _weights.data(); } + double* WeightData() { + return _weights.data(); + } /** * Constant array of weights, as described above. diff --git a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/TECConstraint.h b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/TECConstraint.h index 342ede6312fb738dcb2a456e59e063276a863cf3..af5d813a53116aae04b7f42e47bbc4247ac07203 100644 --- a/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/TECConstraint.h +++ b/CEP/DP3/DPPP_DDECal/include/DPPP_DDECal/TECConstraint.h @@ -66,6 +66,11 @@ public: virtual void PrepareIteration(bool hasReachedPrecision, size_t iteration, bool finalIter) { _finishedApproximateStage = hasReachedPrecision || finalIter || iteration >= _maxApproxIters; + for(size_t thread=0; thread!=_phaseFitters.size(); ++thread) { + std::fill(_phaseFitters[thread].WeightData(), + _phaseFitters[thread].WeightData()+_phaseFitters[thread].Size(), + 1.0); + } } virtual bool Satisfied() const { return _finishedApproximateStage; } diff --git a/CEP/DP3/DPPP_DDECal/src/TECConstraint.cc b/CEP/DP3/DPPP_DDECal/src/TECConstraint.cc index fbaf7d5936c10192b06b811f1ffa05240e39e87a..5586987a553faed9c59125f59cdaaf68954ffbb1 100644 --- a/CEP/DP3/DPPP_DDECal/src/TECConstraint.cc +++ b/CEP/DP3/DPPP_DDECal/src/TECConstraint.cc @@ -146,12 +146,12 @@ std::vector<Constraint::Result> TECConstraint::Apply( LOFAR::OpenMP::threadNum(); #endif + // Flag channels where calibration yielded inf or nan for(size_t ch=0; ch!=_nChannelBlocks; ++ch) { if(std::isfinite(solutions[ch][solutionIndex].real()) && std::isfinite(solutions[ch][solutionIndex].imag())) { _phaseFitters[thread].PhaseData()[ch] = std::arg(solutions[ch][solutionIndex]); - _phaseFitters[thread].WeightData()[ch] = 1.0; } else { _phaseFitters[thread].PhaseData()[ch] = 0.0; @@ -200,12 +200,12 @@ std::vector<Constraint::Result> ApproximateTECConstraint::Apply( std::vector<double>& fittedData = _threadFittedData[thread]; std::vector<double>& weights = _threadWeights[thread]; + // Flag channels where calibration yielded inf or nan for(size_t ch=0; ch!=_nChannelBlocks; ++ch) { if(std::isfinite(solutions[ch][solutionIndex].real()) && std::isfinite(solutions[ch][solutionIndex].imag())) { data[ch] = std::arg(solutions[ch][solutionIndex]); - weights[ch] = 1.0; } else { data[ch] = 0.0;