diff --git a/image_analysis/bragg_integration/BraggIntegrate2D.cpp b/image_analysis/bragg_integration/BraggIntegrate2D.cpp index a511fc12..499f05d9 100644 --- a/image_analysis/bragg_integration/BraggIntegrate2D.cpp +++ b/image_analysis/bragg_integration/BraggIntegrate2D.cpp @@ -91,14 +91,18 @@ std::vector IntegrateInternal(const DiffractionExperiment &experimen IntegrateReflection(r, ptr, image.GetWidth(), image.GetHeight(), special_value, saturation, r_3, r_1_sq, r_2_sq, r_3_sq); if (r.observed) { - if (experiment.GetPolarizationFactor()) { - float pol = geom.CalcAzIntPolarizationCorr(r.predicted_x, r.predicted_y, + float corr = 1.0; + if (experiment.GetPolarizationFactor()) + corr /= geom.CalcAzIntPolarizationCorr(r.predicted_x, r.predicted_y, experiment.GetPolarizationFactor().value()); - r.I /= pol; - r.bkg /= pol; - r.sigma /= pol; - } + if (experiment.GetGoniometer().has_value()) { + float two_theta = geom.TwoTheta_rad(r.predicted_x, r.predicted_y); + corr *= std::sin(two_theta); + } + r.I *= corr; + r.bkg *= corr; + r.sigma *= corr; r.image_number = static_cast(image_number); ret.emplace_back(r); }