From fc46c658cf4af89cad9f8637bc2c73b107b548f1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 15 Apr 2014 17:20:08 +0200 Subject: Calculate partialities even without geometry file --- libcrystfel/src/geometry.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'libcrystfel/src/geometry.c') 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; -- cgit v1.2.3