diff options
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r-- | libcrystfel/src/detector.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index ddb05f3a..505e2d48 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -561,9 +561,7 @@ struct panel *find_panel(struct detector *det, double fs, double ss) } -/* Like find_panel(), but uses the original panel bounds, i.e. referring to - * what's in the HDF5 file */ -struct panel *find_orig_panel(struct detector *det, double fs, double ss) +signed int find_orig_panel_number(struct detector *det, double fs, double ss) { int p; @@ -571,13 +569,20 @@ struct panel *find_orig_panel(struct detector *det, double fs, double ss) if ( (fs >= det->panels[p].orig_min_fs) && (fs < det->panels[p].orig_max_fs+1) && (ss >= det->panels[p].orig_min_ss) - && (ss < det->panels[p].orig_max_ss+1) ) - { - return &det->panels[p]; - } + && (ss < det->panels[p].orig_max_ss+1) ) return p; } - return NULL; + return -1; +} + + +/* Like find_panel(), but uses the original panel bounds, i.e. referring to + * what's in the HDF5 file */ +struct panel *find_orig_panel(struct detector *det, double fs, double ss) +{ + signed int pn = find_orig_panel_number(det, fs, ss); + if ( pn == -1 ) return NULL; + return &det->panels[pn]; } |