Commits
87 87 | // reset data to imaginary parts |
88 88 | statAlg->setData(iiter, eiter, miter, npts); |
89 89 | auto imagStats = statAlg->getStatistics(); |
90 90 | auto imagVar = imagStats.nvariance/imagStats.npts; |
91 91 | auto varSum = realVar + imagVar; |
92 92 | // _samples.second can be updated in two different places, so use |
93 93 | // a local (per thread) variable and update the object's private field in one |
94 94 | // place |
95 95 | uInt updateSecond = False; |
96 96 | if (varSum > 0) { |
97 - | log << LogIO::WARN << "using " << omp_get_num_threads() << " threads" << LogIO::POST; |
98 97 | |
99 98 | |
100 99 | |
101 100 | ++((*_samples)[spw].first); |
102 101 | if (imagVar == 0 || realVar == 0) { |
103 102 | updateSecond = True; |
104 103 | } |
105 104 | else { |
106 105 | auto ratio = imagVar/realVar; |
107 106 | auto inverse = 1/ratio; |
108 107 | updateSecond = ratio > 1.5 || inverse > 1.5; |
109 108 | } |
110 109 | if (updateSecond) { |
111 - | log << LogIO::WARN << "using " << omp_get_num_threads() << " threads" << LogIO::POST; |
112 110 | |
113 111 | |
114 112 | |
115 113 | ++((*_samples)[spw].second); |
116 114 | } |
117 115 | } |
116 + | log << LogIO::WARN << "varSum " << varSum << LogIO::POST; |
118 117 | return varSum/2; |
119 118 | } |
120 119 | |
121 120 | Double StatWtVarianceAndWeightCalculator::computeWeight( |
122 121 | const Cube<Complex>& data, const Cube<Bool>& flags, |
123 122 | const Vector<Double>& exposures, uInt spw, Double targetExposure |
124 123 | ) const { |
125 124 | auto varEq = computeVariance(data, flags, exposures, spw); |
126 125 | return varEq == 0 ? 0 : targetExposure/varEq; |
127 126 | } |