From cf34597c5f8583f68eaad22d85c849e1050c922b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 Jun 2014 16:01:51 +0200 Subject: Pass the partiality model down from the API level --- libcrystfel/src/geometry.c | 6 ++++-- libcrystfel/src/geometry.h | 5 ++++- libcrystfel/src/integration.c | 31 +++++++++++++++++++++---------- libcrystfel/src/integration.h | 7 +++++++ src/partial_sim.c | 2 +- tests/pr_l_gradient_check.c | 11 ++++++----- tests/pr_p_gradient_check.c | 15 ++++++++------- tests/pr_pl_gradient_check.c | 15 ++++++++------- tests/prof2d_check.c | 6 +++--- 9 files changed, 62 insertions(+), 36 deletions(-) diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index c1d433c8..5cc46b2e 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -257,7 +257,8 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, } -RefList *find_intersections(struct image *image, Crystal *cryst) +RefList *find_intersections(struct image *image, Crystal *cryst, + PartialityModel pmodel) { double ax, ay, az; double bx, by, bz; @@ -319,7 +320,7 @@ RefList *find_intersections(struct image *image, Crystal *cryst) yl = h*asy + k*bsy + l*csy; zl = h*asz + k*bsz + l*csz; - refl = check_reflection(image, cryst, PMODEL_SPHERE, + refl = check_reflection(image, cryst, pmodel, h, k, l, xl, yl, zl); if ( refl != NULL ) { @@ -334,6 +335,7 @@ RefList *find_intersections(struct image *image, Crystal *cryst) } +/* Deprecated: select reflections using Kirian-style pixel proximity */ RefList *select_intersections(struct image *image, Crystal *cryst) { double ax, ay, az; diff --git a/libcrystfel/src/geometry.h b/libcrystfel/src/geometry.h index 7188f6ed..1f465167 100644 --- a/libcrystfel/src/geometry.h +++ b/libcrystfel/src/geometry.h @@ -62,7 +62,10 @@ typedef enum { } PartialityModel; -extern RefList *find_intersections(struct image *image, Crystal *cryst); +extern RefList *find_intersections(struct image *image, Crystal *cryst, + PartialityModel pmodel); + +/* Deprecated: select reflections using Kirian-style pixel proximity */ extern RefList *select_intersections(struct image *image, Crystal *cryst); extern void update_partialities(Crystal *cryst, PartialityModel pmodel); diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 46e1451d..a0d23d2d 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -1464,8 +1464,8 @@ static void setup_profile_boxes(struct intcontext *ic, RefList *list) } -static void integrate_prof2d(IntegrationMethod meth, Crystal *cr, - struct image *image, IntDiag int_diag, +static void integrate_prof2d(IntegrationMethod meth, PartialityModel pmodel, + Crystal *cr, struct image *image, IntDiag int_diag, signed int idh, signed int idk, signed int idl, double ir_inn, double ir_mid, double ir_out) { @@ -1478,7 +1478,7 @@ static void integrate_prof2d(IntegrationMethod meth, Crystal *cr, cell = crystal_get_cell(cr); /* Create initial list of reflections with nominal parameters */ - list = find_intersections(image, cr); + list = find_intersections(image, cr, pmodel); ic.halfw = ir_out; ic.image = image; @@ -1719,8 +1719,8 @@ static double estimate_resolution(UnitCell *cell, ImageFeatureList *flist) } -static void integrate_rings(IntegrationMethod meth, Crystal *cr, - struct image *image, IntDiag int_diag, +static void integrate_rings(IntegrationMethod meth, PartialityModel pmodel, + Crystal *cr, struct image *image, IntDiag int_diag, signed int idh, signed int idk, signed int idl, double ir_inn, double ir_mid, double ir_out) { @@ -1730,7 +1730,7 @@ static void integrate_rings(IntegrationMethod meth, Crystal *cr, UnitCell *cell; struct intcontext ic; - list = find_intersections(image, cr); + list = find_intersections(image, cr, pmodel); if ( list == NULL ) return; if ( num_reflections(list) == 0 ) return; @@ -1799,8 +1799,8 @@ static void apply_resolution_cutoff(Crystal *cr, double res) } -void integrate_all_2(struct image *image, IntegrationMethod meth, - double push_res, +void integrate_all_3(struct image *image, IntegrationMethod meth, + PartialityModel pmodel, double push_res, double ir_inn, double ir_mid, double ir_out, IntDiag int_diag, signed int idh, signed int idk, signed int idl) @@ -1818,7 +1818,7 @@ void integrate_all_2(struct image *image, IntegrationMethod meth, break; case INTEGRATION_RINGS : - integrate_rings(meth, cr, image, + integrate_rings(meth, pmodel, cr, image, int_diag, idh, idk, idl, ir_inn, ir_mid, ir_out); res = estimate_resolution(crystal_get_cell(cr), @@ -1826,7 +1826,7 @@ void integrate_all_2(struct image *image, IntegrationMethod meth, break; case INTEGRATION_PROF2D : - integrate_prof2d(meth, cr, image, + integrate_prof2d(meth, pmodel, cr, image, int_diag, idh, idk, idl, ir_inn, ir_mid, ir_out); res = estimate_resolution(crystal_get_cell(cr), @@ -1848,6 +1848,17 @@ void integrate_all_2(struct image *image, IntegrationMethod meth, } +void integrate_all_2(struct image *image, IntegrationMethod meth, + double push_res, + double ir_inn, double ir_mid, double ir_out, + IntDiag int_diag, + signed int idh, signed int idk, signed int idl) +{ + integrate_all_3(image, meth, PMODEL_SPHERE, 0.0, ir_inn, ir_mid, ir_out, + int_diag, idh, idk, idl); +} + + void integrate_all(struct image *image, IntegrationMethod meth, double ir_inn, double ir_mid, double ir_out, IntDiag int_diag, diff --git a/libcrystfel/src/integration.h b/libcrystfel/src/integration.h index 84c1b900..f077be32 100644 --- a/libcrystfel/src/integration.h +++ b/libcrystfel/src/integration.h @@ -34,6 +34,8 @@ #endif +#include "geometry.h" + typedef enum { INTDIAG_NONE, @@ -97,6 +99,11 @@ extern void integrate_all_2(struct image *image, IntegrationMethod meth, IntDiag int_diag, signed int idh, signed int idk, signed int idl); +extern void integrate_all_3(struct image *image, IntegrationMethod meth, + PartialityModel pmodel, double push_res, + double ir_inn, double ir_mid, double ir_out, + IntDiag int_diag, + signed int idh, signed int idk, signed int idl); #ifdef __cplusplus } diff --git a/src/partial_sim.c b/src/partial_sim.c index fa68638f..862eadef 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -352,7 +352,7 @@ static void run_job(void *vwargs, int cookie) snprintf(wargs->image.filename, 255, "dummy.h5"); } - reflections = find_intersections(&wargs->image, cr); + reflections = find_intersections(&wargs->image, cr, PMODEL_SPHERE); crystal_set_reflections(cr, reflections); for ( i=0; i