aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-06-01 09:51:34 -0700
committerThomas White <taw@bitwiz.org.uk>2013-06-01 09:51:34 -0700
commit9d1d9790c6f1d7648776dab3222317a74d6b8dff (patch)
treec6dbdc6030eb56432a46a46aefb4829c9d5b3e12 /libcrystfel
parentaa9c09192cdd9d0d48857969a37400cfd85403e2 (diff)
Fix rounding of pixel coordinates
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/integration.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 9e22a542..99721ea2 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -1127,8 +1127,15 @@ static void measure_all_intensities(IntegrationMethod meth, RefList *list,
set_redundancy(refl, 0);
get_detector_pos(refl, &pfs, &pss);
- fid_fs = lrint(pfs);
- fid_ss = lrint(pss);
+
+ /* Explicit truncation of digits after the decimal point.
+ * This is actually the correct thing to do here, not
+ * e.g. lrint(). pfs/pss is the position of the spot, measured
+ * in numbers of pixels, from the panel corner (not the center
+ * of the first pixel). So any coordinate from 2.0 to 2.9999
+ * belongs to pixel index 2. */
+ fid_fs = pfs;
+ fid_ss = pss;
pn = find_panel_number(image->det, fid_fs, fid_ss);
p = &image->det->panels[pn];
@@ -1569,8 +1576,15 @@ static void integrate_rings(IntegrationMethod meth, Crystal *cr,
set_redundancy(refl, 0);
get_detector_pos(refl, &pfs, &pss);
- fid_fs = lrint(pfs);
- fid_ss = lrint(pss);
+
+ /* Explicit truncation of digits after the decimal point.
+ * This is actually the correct thing to do here, not
+ * e.g. lrint(). pfs/pss is the position of the spot, measured
+ * in numbers of pixels, from the panel corner (not the center
+ * of the first pixel). So any coordinate from 2.0 to 2.9999
+ * belongs to pixel index 2. */
+ fid_fs = pfs;
+ fid_ss = pss;
pn = find_panel_number(image->det, fid_fs, fid_ss);
p = &image->det->panels[pn];