diff options
-rw-r--r-- | libcrystfel/src/geometry.c | 6 | ||||
-rw-r--r-- | libcrystfel/src/geometry.h | 5 | ||||
-rw-r--r-- | libcrystfel/src/integration.c | 31 | ||||
-rw-r--r-- | libcrystfel/src/integration.h | 7 | ||||
-rw-r--r-- | src/partial_sim.c | 2 | ||||
-rw-r--r-- | tests/pr_l_gradient_check.c | 11 | ||||
-rw-r--r-- | tests/pr_p_gradient_check.c | 15 | ||||
-rw-r--r-- | tests/pr_pl_gradient_check.c | 15 | ||||
-rw-r--r-- | 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<NBINS; i++ ) { diff --git a/tests/pr_l_gradient_check.c b/tests/pr_l_gradient_check.c index 72d353f9..b707629f 100644 --- a/tests/pr_l_gradient_check.c +++ b/tests/pr_l_gradient_check.c @@ -89,7 +89,8 @@ static void shift_parameter(struct image *image, int k, double shift) static void calc_either_side(Crystal *cr, double incr_val, - int *valid, long double *vals[3], int refine) + int *valid, long double *vals[3], int refine, + PartialityModel pmodel) { RefList *compare; struct image *image = crystal_get_image(cr); @@ -97,14 +98,14 @@ static void calc_either_side(Crystal *cr, double incr_val, im_moved = *image; shift_parameter(&im_moved, refine, -incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 0); reflist_free(compare); im_moved = *image; shift_parameter(&im_moved, refine, +incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 2); reflist_free(compare); @@ -133,7 +134,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, int n_line; double cc; - reflections = find_intersections(crystal_get_image(cr), cr); + reflections = find_intersections(crystal_get_image(cr), cr, pmodel); crystal_set_reflections(cr, reflections); nref = num_reflections(reflections); @@ -159,7 +160,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, scan_partialities(reflections, reflections, valid, vals, 1); - calc_either_side(cr, incr_val, valid, vals, refine); + calc_either_side(cr, incr_val, valid, vals, refine, pmodel); if ( plot ) { snprintf(tmp, 32, "gradient-test-%s.dat", file); diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c index c3b55cfa..8f7a66e4 100644 --- a/tests/pr_p_gradient_check.c +++ b/tests/pr_p_gradient_check.c @@ -175,7 +175,8 @@ static Crystal *new_shifted_crystal(Crystal *cr, int refine, double incr_val) } static void calc_either_side(Crystal *cr, double incr_val, - int *valid, long double *vals[3], int refine) + int *valid, long double *vals[3], int refine, + PartialityModel pmodel) { RefList *compare; struct image *image = crystal_get_image(cr); @@ -186,7 +187,7 @@ static void calc_either_side(Crystal *cr, double incr_val, /* Crystal properties */ cr_new = new_shifted_crystal(cr, refine, -incr_val); - compare = find_intersections(image, cr_new); + compare = find_intersections(image, cr_new, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 0); cell_free(crystal_get_cell(cr_new)); @@ -194,7 +195,7 @@ static void calc_either_side(Crystal *cr, double incr_val, reflist_free(compare); cr_new = new_shifted_crystal(cr, refine, +incr_val); - compare = find_intersections(image, cr_new); + compare = find_intersections(image, cr_new, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 2); cell_free(crystal_get_cell(cr_new)); @@ -208,14 +209,14 @@ static void calc_either_side(Crystal *cr, double incr_val, /* "Image" properties */ im_moved = *image; shift_parameter(&im_moved, refine, -incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 0); reflist_free(compare); im_moved = *image; shift_parameter(&im_moved, refine, +incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 2); reflist_free(compare); @@ -246,7 +247,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, int n_line; double cc; - reflections = find_intersections(crystal_get_image(cr), cr); + reflections = find_intersections(crystal_get_image(cr), cr, pmodel); crystal_set_reflections(cr, reflections); nref = num_reflections(reflections); @@ -272,7 +273,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, scan_partialities(reflections, reflections, valid, vals, 1); - calc_either_side(cr, incr_val, valid, vals, refine); + calc_either_side(cr, incr_val, valid, vals, refine, pmodel); if ( plot ) { snprintf(tmp, 32, "gradient-test-%s.dat", file); diff --git a/tests/pr_pl_gradient_check.c b/tests/pr_pl_gradient_check.c index ddbc1840..f83af335 100644 --- a/tests/pr_pl_gradient_check.c +++ b/tests/pr_pl_gradient_check.c @@ -175,7 +175,8 @@ static Crystal *new_shifted_crystal(Crystal *cr, int refine, double incr_val) } static void calc_either_side(Crystal *cr, double incr_val, - int *valid, long double *vals[3], int refine) + int *valid, long double *vals[3], int refine, + PartialityModel pmodel) { RefList *compare; struct image *image = crystal_get_image(cr); @@ -186,7 +187,7 @@ static void calc_either_side(Crystal *cr, double incr_val, /* Crystal properties */ cr_new = new_shifted_crystal(cr, refine, -incr_val); - compare = find_intersections(image, cr_new); + compare = find_intersections(image, cr_new, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 0); cell_free(crystal_get_cell(cr_new)); @@ -194,7 +195,7 @@ static void calc_either_side(Crystal *cr, double incr_val, reflist_free(compare); cr_new = new_shifted_crystal(cr, refine, +incr_val); - compare = find_intersections(image, cr_new); + compare = find_intersections(image, cr_new, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 2); cell_free(crystal_get_cell(cr_new)); @@ -208,14 +209,14 @@ static void calc_either_side(Crystal *cr, double incr_val, /* "Image" properties */ im_moved = *image; shift_parameter(&im_moved, refine, -incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 0); reflist_free(compare); im_moved = *image; shift_parameter(&im_moved, refine, +incr_val); - compare = find_intersections(&im_moved, cr); + compare = find_intersections(&im_moved, cr, pmodel); scan_partialities(crystal_get_reflections(cr), compare, valid, vals, 2); reflist_free(compare); @@ -246,7 +247,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, int n_line; double cc; - reflections = find_intersections(crystal_get_image(cr), cr); + reflections = find_intersections(crystal_get_image(cr), cr, pmodel); crystal_set_reflections(cr, reflections); nref = num_reflections(reflections); @@ -272,7 +273,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, scan_partialities(reflections, reflections, valid, vals, 1); - calc_either_side(cr, incr_val, valid, vals, refine); + calc_either_side(cr, incr_val, valid, vals, refine, pmodel); if ( plot ) { snprintf(tmp, 32, "gradient-test-%s.dat", file); diff --git a/tests/prof2d_check.c b/tests/prof2d_check.c index f1665a6c..75b9748e 100644 --- a/tests/prof2d_check.c +++ b/tests/prof2d_check.c @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) image.n_crystals = 1; image.crystals = &cr; - list = find_intersections(&image, cr); + list = find_intersections(&image, cr, PMODEL_SPHERE); for ( fs=0; fs<w; fs++ ) { for ( ss=0; ss<h; ss++ ) { @@ -176,8 +176,8 @@ int main(int argc, char *argv[]) STATUS("%i strong, %i weak\n", n_strong, n_weak); reflist_free(list); /* integrate_prof2d() will predict again */ - integrate_prof2d(INTEGRATION_PROF2D, cr, &image, INTDIAG_NONE, 0, 0, 0, - ir_inn, ir_mid, ir_out); + integrate_prof2d(INTEGRATION_PROF2D, PMODEL_SPHERE, cr, &image, + INTDIAG_NONE, 0, 0, 0, ir_inn, ir_mid, ir_out); list = crystal_get_reflections(cr); printf("Weak reflections:\n"); |