aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-09-14 15:10:50 +0200
committerThomas White <taw@physics.org>2023-09-18 13:31:52 +0200
commit268c1a6b9cbddd0417216296f94631957227165f (patch)
treed4b00e3b4e4702eb9cc869e797e2028d26e65b94 /libcrystfel
parent38b4e5fec7fc9d1cf554afa42b4209f14bc3444f (diff)
Prediction refinement: Record initial residual and total shifts
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/predict-refine.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c
index 43b54092..d4d2d9d2 100644
--- a/libcrystfel/src/predict-refine.c
+++ b/libcrystfel/src/predict-refine.c
@@ -582,7 +582,8 @@ int refine_radius(Crystal *cr, struct image *image)
static int iterate(struct reflpeak *rps, int n, UnitCell *cell,
- struct image *image, gsl_matrix **Minvs)
+ struct image *image, gsl_matrix **Minvs,
+ double *total_shifts)
{
int i;
gsl_matrix *M;
@@ -728,6 +729,7 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell,
if ( isnan(gsl_vector_get(shifts, i)) ) {
gsl_vector_set(shifts, i, 0.0);
}
+ total_shifts[i] += gsl_vector_get(shifts, i);
}
/* Apply shifts */
@@ -806,6 +808,7 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
RefList *reflist;
char tmp[256];
gsl_matrix **Minvs;
+ double total_shifts[12];
rps = malloc(image_feature_count(image->features)
* sizeof(struct reflpeak));
@@ -845,10 +848,16 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
//STATUS("Initial residual = %e\n",
// pred_residual(rps, n, image->detgeom));
+ snprintf(tmp, 255, "predict_refine/initial_residual = %e",
+ pred_residual(rps, n, image->detgeom));
+ crystal_add_notes(cr, tmp);
+
+ for ( i=0; i<12; i++ ) total_shifts[i] = 0.0;
+
/* Refine (max 10 cycles) */
for ( i=0; i<10; i++ ) {
update_predictions(cr);
- if ( iterate(rps, n, crystal_get_cell(cr), image, Minvs) )
+ if ( iterate(rps, n, crystal_get_cell(cr), image, Minvs, total_shifts) )
{
crystal_set_reflections(cr, NULL);
return 1;
@@ -863,6 +872,10 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
pred_residual(rps, n, image->detgeom));
crystal_add_notes(cr, tmp);
+ snprintf(tmp, 255, "predict_refine/total_shifts = %e %e %e",
+ total_shifts[0], total_shifts[1], total_shifts[2]);
+ crystal_add_notes(cr, tmp);
+
if ( mille != NULL ) {
profile_start("mille-calc");
write_mille(mille, n, crystal_get_cell(cr), rps, image, Minvs);