aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-03-06 17:34:58 +0100
committerThomas White <taw@physics.org>2012-03-06 17:34:58 +0100
commited0bcf1cc4be9af77eb993f1406dc991c10345d3 (patch)
treeea9a378b7f6d51a3e609eb07b0cb5da92658f590
parenta4ab18ed5fb5be7e9331215fcf6381a8edb6abf7 (diff)
Add "err" to get_tt()
-rw-r--r--libcrystfel/src/detector.c8
-rw-r--r--libcrystfel/src/detector.h2
-rw-r--r--libcrystfel/src/peaks.c4
3 files changed, 11 insertions, 3 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index bbb65c9a..ee09eb73 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -277,13 +277,19 @@ int in_bad_region(struct detector *det, double fs, double ss)
}
-double get_tt(struct image *image, double fs, double ss)
+double get_tt(struct image *image, double fs, double ss, int *err)
{
double r, rx, ry;
struct panel *p;
double xs, ys;
+ *err = 0;
+
p = find_panel(image->det, fs, ss);
+ if ( p == NULL ) {
+ *err = 1;
+ return 0.0;
+ }
/* Convert xs and ys, which are in fast scan/slow scan coordinates,
* to x and y */
diff --git a/libcrystfel/src/detector.h b/libcrystfel/src/detector.h
index a285be8d..53aca93d 100644
--- a/libcrystfel/src/detector.h
+++ b/libcrystfel/src/detector.h
@@ -110,7 +110,7 @@ extern struct rvec get_q(struct image *image, double fs, double ss,
extern struct rvec get_q_for_panel(struct panel *p, double fs, double ss,
double *ttp, double k);
-extern double get_tt(struct image *image, double xs, double ys);
+extern double get_tt(struct image *image, double xs, double ys, int *err);
extern int in_bad_region(struct detector *det, double fs, double ss);
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 3c383855..d0183371 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -229,7 +229,9 @@ int integrate_peak(struct image *image, int cfs, int css,
if ( do_polar ) {
- tt = get_tt(image, fs+cfs, ss+css);
+ int err;
+
+ tt = get_tt(image, fs+cfs, ss+css, &err);
phi = atan2(ss+css, fs+cfs);
pa = pow(sin(phi)*sin(tt), 2.0);