aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/integration.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-12-07 16:11:45 +0100
committerThomas White <taw@physics.org>2020-12-07 16:11:45 +0100
commite7cf3911104fb525159b937660a3c3b9f6d31ba7 (patch)
tree95a7c1387d4f62750c54f98765169e73bbc788c8 /libcrystfel/src/integration.c
parent72f857fbd0c29ba4954f5602ecc43574e581776a (diff)
Get rid of ImageFeature->rx,ry,rz
These needed to be kept up to date with a call to map_all_peaks every time anything changed - wavelength, detector position etc. Not doing so has already led to bugs in another branch, and probably already causes problems on this branch. This patch eliminates the rx,ry,rz completely. Anyone who needs reciprocal space coordinates for a peak is now responsible for calling detgeom_transform_coords themselves.
Diffstat (limited to 'libcrystfel/src/integration.c')
-rw-r--r--libcrystfel/src/integration.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 4a66363b..c15d66ba 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -1533,7 +1533,7 @@ int integrate_rings_once(Reflection *refl,
}
-static double estimate_resolution(UnitCell *cell, ImageFeatureList *flist)
+static double estimate_resolution(UnitCell *cell, struct image *image)
{
int i;
const double min_dist = 0.25;
@@ -1549,27 +1549,33 @@ static double estimate_resolution(UnitCell *cell, ImageFeatureList *flist)
return INFINITY;
}
- for ( i=0; i<image_feature_count(flist); i++ ) {
+ for ( i=0; i<image_feature_count(image->features); i++ ) {
struct imagefeature *f;
double h, k, l, hd, kd, ld;
-
- /* Assume all image "features" are genuine peaks */
- f = image_get_feature(flist, i);
- if ( f == NULL ) continue;
-
double ax, ay, az;
double bx, by, bz;
double cx, cy, cz;
+ double r[3];
+
+ /* Assume all image "features" are genuine peaks */
+ f = image_get_feature(image->features, i);
+ if ( f == NULL ) continue;
cell_get_cartesian(cell,
- &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz);
+ &ax, &ay, &az,
+ &bx, &by, &bz,
+ &cx, &cy, &cz);
+
+ detgeom_transform_coords(&image->detgeom->panels[f->pn],
+ f->fs, f->ss, image->lambda,
+ r);
/* Decimal and fractional Miller indices of nearest
* reciprocal lattice point */
- hd = f->rx * ax + f->ry * ay + f->rz * az;
- kd = f->rx * bx + f->ry * by + f->rz * bz;
- ld = f->rx * cx + f->ry * cy + f->rz * cz;
+ hd = r[0] * ax + r[1] * ay + r[2] * az;
+ kd = r[0] * bx + r[1] * by + r[2] * bz;
+ ld = r[0] * cx + r[1] * cy + r[2] * cz;
h = lrint(hd);
k = lrint(kd);
l = lrint(ld);
@@ -1680,7 +1686,7 @@ void integrate_all_5(struct image *image, IntegrationMethod meth,
}
res = estimate_resolution(crystal_get_cell(image->crystals[i]),
- image->features);
+ image);
crystal_set_resolution_limit(image->crystals[i], res);
list = predict_to_res(image->crystals[i], res+push_res);