double Reflection::meanIntensity(bool withCutoff, int start, int end) { if (end == 0) end = withCutoff ? acceptedCount() : millerCount(); double total_intensity = 0; double total_weights = 0; for (int i = start; i < end; i++) { MillerPtr miller = withCutoff ? this->acceptedMiller(i) : this->miller(i); double weight = miller->getWeight(withCutoff); double intensity = miller->intensity(withCutoff); if (weight <= 0) continue; total_intensity += intensity * weight; total_weights += weight; } total_intensity /= total_weights; return total_intensity; }
double Reflection::meanWeight(bool withCutoff) { int num = (int)millerCount(); int count = 0; double total_weight = 0; for (int i = 0; i < num; i++) { MillerPtr miller = millers[i]; if ((miller->accepted() && withCutoff) || !withCutoff) { total_weight += miller->getWeight(withCutoff); count++; } } total_weight /= count; return total_weight; }