diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-02-02 18:53:58 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-03-19 18:05:29 +0100 |
commit | 289c8a77c252e080d4d4086b848ea8fdcb604147 (patch) | |
tree | a09ac590c109f415c3728d3093fe0f6a710ca113 /libcrystfel/src/detector.c | |
parent | 0897d90c30ed61d24d9b2ea88aeb7e6fb3dda4cc (diff) |
Fix arithmetic subtlety in find_panel()
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r-- | libcrystfel/src/detector.c | 7 |
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]; } } |