aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/geometry.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-04-15 17:20:08 +0200
committerThomas White <taw@physics.org>2014-04-15 17:20:08 +0200
commitfc46c658cf4af89cad9f8637bc2c73b107b548f1 (patch)
tree53ffcc05840562ee7e66abd30b7c30f9aebc2ba8 /libcrystfel/src/geometry.c
parentb439e7bbb957a7b373ad65ccdd59207b9face088 (diff)
Calculate partialities even without geometry file
Diffstat (limited to 'libcrystfel/src/geometry.c')
-rw-r--r--libcrystfel/src/geometry.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c
index 4e43d3c7..0c0a09b8 100644
--- a/libcrystfel/src/geometry.c
+++ b/libcrystfel/src/geometry.c
@@ -126,8 +126,6 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst,
const int output = 0;
double tl;
double rlow, rhigh; /* "Excitation error" */
- signed int p; /* Panel number */
- double xda, yda; /* Position on detector */
double part; /* Partiality */
int clamp_low, clamp_high;
double klow, khigh; /* Wavenumber */
@@ -208,21 +206,30 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst,
/* Calculate partiality */
part = partiality(rlow, rhigh, pr);
- /* Locate peak on detector. */
- p = locate_peak(xl, yl, zl, 1.0/image->lambda, image->det, &xda, &yda);
- if ( p == -1 ) return NULL;
-
/* Add peak to list */
refl = reflection_new(h, k, l);
- set_detector_pos(refl, 0.0, xda, yda);
+
+ /* If we have detector information, check the spot is measured.
+ * Otherwise, we make do with calculating the partialiaty etc. */
+ if ( image->det != NULL ) {
+ double xda, yda; /* Position on detector */
+ signed int p; /* Panel number */
+ p = locate_peak(xl, yl, zl, 1.0/image->lambda, image->det,
+ &xda, &yda);
+ if ( p == -1 ) {
+ reflection_free(refl);
+ return NULL;
+ }
+ set_detector_pos(refl, 0.0, xda, yda);
+ }
+
set_partial(refl, rlow, rhigh, part, clamp_low, clamp_high);
set_lorentz(refl, L);
set_symmetric_indices(refl, h, k, l);
set_redundancy(refl, 1);
if ( output ) {
- printf("%3i %3i %3i %6f (at %5.2f,%5.2f) %5.2f\n",
- h, k, l, 0.0, xda, yda, part);
+ printf("%3i %3i %3i %6f %5.2f\n", h, k, l, 0.0, part);
}
return refl;