From 8dc3af00b200812f8eec3bc9ada92a74fbdf4a82 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 27 Jan 2017 17:30:24 +0100 Subject: Record khalf for reflections --- libcrystfel/src/geometry.c | 4 +++- libcrystfel/src/reflist.c | 37 +++++++++++++++++++++++++++++++++---- libcrystfel/src/reflist.h | 6 ++++-- 3 files changed, 40 insertions(+), 7 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index beae9a16..ff5cea4d 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -245,7 +245,7 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, { Reflection *refl; double R, top; - double kmin, kmax, k0, knom, k1; + double kmin, kmax, k0, knom, k1, khalf; double dcs, exerr; /* Don't predict 000 */ @@ -256,6 +256,7 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, R = crystal_get_profile_radius(cryst); top = R*R - xl*xl - yl*yl - zl*zl; k0 = top/(2.0*(zl+R)); + khalf = (- xl*xl - yl*yl - zl*zl) / (2.0*zl); k1 = top/(2.0*(zl-R)); /* The reflection is excited if any of the reflection is within 2sigma @@ -306,6 +307,7 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, } set_kpred(refl, knom); + set_khalf(refl, khalf); set_exerr(refl, exerr); set_lorentz(refl, 1.0); set_symmetric_indices(refl, h, k, l); diff --git a/libcrystfel/src/reflist.c b/libcrystfel/src/reflist.c index 69fb29be..a35aa575 100644 --- a/libcrystfel/src/reflist.c +++ b/libcrystfel/src/reflist.c @@ -67,7 +67,8 @@ struct _refldata { signed int ls; /* Partiality and related geometrical stuff */ - double kpred; /* Wavenumber of middle of reflection */ + double khalf; /* Wavenumber of middle of reflection */ + double kpred; /* Wavenumber for prediction */ double exerr; /* Excitation error */ double p; /* Partiality */ double L; /* Lorentz factor */ @@ -422,12 +423,27 @@ double get_intensity(const Reflection *refl) /** - * get_kpred: + * get_khalf * @refl: A %Reflection * * Returns: the wavenumber at the centre of the reflection * **/ +double get_khalf(const Reflection *refl) +{ + return refl->data.khalf; +} + + + + +/** + * get_kpred: + * @refl: A %Reflection + * + * Returns: the wavenumber which should be used for prediction of this reflection + * + **/ double get_kpred(const Reflection *refl) { return refl->data.kpred; @@ -618,14 +634,27 @@ void set_panel(Reflection *refl, struct panel *p) refl->data.panel = p; } +/** + * set_khalf: + * @refl: A %Reflection + * @khalf: The wavenumber at which the reflection should be predicted + * + * Sets the wavenumber at the centre of the reflection. + **/ +void set_khalf(Reflection *refl, double khalf) +{ + refl->data.khalf = khalf; +} + + /** * set_kpred: * @refl: A %Reflection * @kpred: The wavenumber at which the reflection should be predicted * - * Sets the wavenumber at the centre of the reflection. Used by - * predict_to_res() and update_predictions() + * Sets the wavenumber at which the reflection should be predicted. + * Used by predict_to_res() and update_predictions() **/ void set_kpred(Reflection *refl, double kpred) { diff --git a/libcrystfel/src/reflist.h b/libcrystfel/src/reflist.h index 4dd1e56f..9f494474 100644 --- a/libcrystfel/src/reflist.h +++ b/libcrystfel/src/reflist.h @@ -3,11 +3,11 @@ * * Fast reflection/peak list * - * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2011-2016 Thomas White + * 2011-2017 Thomas White * * This file is part of CrystFEL. * @@ -87,6 +87,7 @@ extern Reflection *next_found_refl(Reflection *refl); extern void get_detector_pos(const Reflection *refl, double *fs, double *ss); extern struct panel *get_panel(const Reflection *refl); extern double get_partiality(const Reflection *refl); +extern double get_khalf(const Reflection *refl); extern double get_kpred(const Reflection *refl); extern double get_exerr(const Reflection *refl); extern double get_lorentz(const Reflection *refl); @@ -110,6 +111,7 @@ extern void copy_data(Reflection *to, const Reflection *from); extern void set_detector_pos(Reflection *refl, double fs, double ss); extern void set_panel(Reflection *refl, struct panel *p); extern void set_kpred(Reflection *refl, double kpred); +extern void set_khalf(Reflection *refl, double khalf); extern void set_exerr(Reflection *refl, double exerr); extern void set_partiality(Reflection *refl, double p); extern void set_lorentz(Reflection *refl, double L); -- cgit v1.2.3