Merge branch 'dq-sm-absorb' into dq-sm-scale

This commit is contained in:
leonarski_f committed 2026-10-04 15:25:28 +02:00
commit 21e5ce38db
1 file changed
+17
@@ -535,6 +535,9 @@ void RotationScaleMerge::Ingest() {
logger.Info("RotationScaleMerge: ingested {} partial observations from {} frames ({} distinct hkl)",
n_partials_obs, n_frames, rawrun_start.size());
// The partiality the predictor gave each partial, which its corr was formed with (image_scale_corr
// divides by it); the recompute below replaces it.
const std::vector<float> partiality_predicted(ingest_partiality.get(), ingest_partiality.get() + n_partials_obs);
SmoothMosaicityAndPartiality();
if (!resident_ingest) {
ParallelChunks(static_cast<int>(partials.size()), ThreadsForWork(partials.size(), nthreads),
@@ -557,6 +560,20 @@ void RotationScaleMerge::Ingest() {
for (int i = lo; i < hi; ++i) corr_ingested[i] = partials[i].corr;
});
}
// corr carries 1 / partiality, and it has to be the partiality everything downstream uses - the
// recomputed one. Where the partials are scaled, every fitted frame's corr is rebuilt from it
// anyway; where they are not (too few rocking events per frame, small molecules), corr is what
// the combine divides each partial by, and with the predictor's per-frame partiality left in it
// the parts of one rocking curve no longer add up to the reflection: measured on a 0.2 deg
// small-molecule sweep, the combined fulls scattered 13% rms about the plain sum of the same
// partials, and ISa was 10 where it is 31 with the recomputed partiality.
ParallelChunks(n_partials_obs, ThreadsForWork(n_partials_obs, nthreads), [&](int lo, int hi) {
for (int i = lo; i < hi; ++i) {
const float p_old = partiality_predicted[i], p_new = ingest_partiality[i];
if (p_old > 0.0f && p_new > 0.0f)
corr_ingested[i] *= p_old / p_new;
}
});
#ifdef JFJOCH_USE_CUDA
// Feed the device (probed at the top of Ingest). On the resident path the layout and every