Skip to content
Snippets Groups Projects
Commit 17f13cf6 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Task #11550: handle weights in TEC fitter properly

parent 351b5538
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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; }
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment