aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-08 21:16:46 +0100
committerThomas White <taw@physics.org>2009-12-08 21:16:46 +0100
commit95dc6b406ac63cc1a4393688f792fb567512105d (patch)
tree950a8a6878213d852a4c0bcb7f2e5f4d67aace2c /src/detector.c
parentfc8ba89ffff7c8620f64c52ef0d27bd434879869 (diff)
Better rounding when Poisson noise is switched off
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/detector.c b/src/detector.c
index 5b12b007..3da5c643 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -202,8 +202,10 @@ void record_image(struct image *image, int do_water, int do_poisson,
if ( do_poisson ) {
counts = poisson_noise(intensity * ph_per_e * sa * DQE);
} else {
+ double rounded;
cf = intensity * ph_per_e * sa * DQE;
- counts = (int)cf;
+ rounded = rint(cf);
+ counts = (int)rounded;
}
image->hdr[x + image->width*y] = counts;