aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2012-02-02 18:53:58 -0800
committerThomas White <taw@physics.org>2012-03-19 18:07:10 +0100
commitd35bef6fae06e96d98699a91946ac7700e3993bc (patch)
treea09ac590c109f415c3728d3093fe0f6a710ca113
parent17b4459439cfeaa1fc7f7b9395a9e3b9b4a581a5 (diff)
Fix arithmetic subtlety in find_panel()
-rw-r--r--libcrystfel/src/detector.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 50874efd..29a24234 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -421,11 +421,14 @@ struct panel *find_panel(struct detector *det, double fs, double ss)
{
int p;
+ /* Fractional pixel coordinates are allowed to be a little further along
+ * than "== max_{f,s}s" for an integer. */
+
for ( p=0; p<det->n_panels; p++ ) {
if ( (fs >= det->panels[p].min_fs)
- && (fs <= det->panels[p].max_fs)
+ && (fs <= det->panels[p].max_fs+1)
&& (ss >= det->panels[p].min_ss)
- && (ss <= det->panels[p].max_ss) ) {
+ && (ss <= det->panels[p].max_ss+1) ) {
return &det->panels[p];
}
}