aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/detector.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index e29b6d39..513d08f1 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -396,6 +396,9 @@ void record_image(struct image *image, int do_poisson, double background,
/* Convert to ADU */
dval *= p->adu_per_eV * ph_lambda_to_eV(image->lambda);
+ /* Saturation */
+ if ( dval > p->max_adu ) dval = p->max_adu;
+
image->data[x + image->width*y] = dval;
/* Sanity checks */