From 60572e7d69ffda00c7738168c0cd8ed83c3fb363 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Jun 2011 18:09:52 +0200 Subject: Add half a pixel to coordinates when integrating peak Choose whichever one of these reasons makes most sense to you: 1. The centroid operation gives the position as a "pixel index", but we really want it as a distance in pixels from the corner. 2. If all the intensity is in one pixel, the best estimate of where the photons hit is in the middle of the pixel, not its corner. --- src/peaks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/peaks.c') diff --git a/src/peaks.c b/src/peaks.c index c542e44c..61f5fa5a 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -246,11 +246,11 @@ int integrate_peak(struct image *image, int cfs, int css, /* The centroid is excitingly undefined if there is no intensity */ if ( centroid && (total != 0) ) { - *pfs = (double)fsct / total; - *pss = (double)ssct / total; + *pfs = ((double)fsct / total) + 0.5; + *pss = ((double)ssct / total) + 0.5; } else { - *pfs = (double)cfs; - *pss = (double)css; + *pfs = (double)cfs + 0.5; + *pss = (double)css + 0.5; } if ( bgsub ) { *intensity = total - pixel_counts*noise_mean; -- cgit v1.2.3