From e8847558c3831e309d0325382589f34b273e96c8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 12 Jul 2022 12:39:51 +0200 Subject: Zero-weight negative intensity peaks in prediction refinement Strongly negative peaks can occur if there are unmasked bad pixels. These cause the refinement to diverge badly. This change stabilises the refinement such that it works even in these cases. But of course, the real solution is to mask out those pixels. Negative intensity peaks are unlikely to show up "for real" in the peak search results (because we look for strong peaks!). However, if the intensity is negative, we aren't even sure that the peak exists at all and have no reason to assume it should be close to the Bragg condition. --- libcrystfel/src/predict-refine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index fbadcc67..19c689cd 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -612,7 +612,11 @@ int refine_prediction(struct image *image, Crystal *cr) return 1; } for ( i=0; iintensity / max_I; + if ( rps[i].peak->intensity > 0.0 ) { + rps[i].Ih = rps[i].peak->intensity / max_I; + } else { + rps[i].Ih = 0.0; + } } //STATUS("Initial residual = %e\n", -- cgit v1.2.3