From 13fdc7228979beb0a02eafe54f58020c84136ced Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 20 Jun 2023 11:01:57 +0200 Subject: Remove z-component and x/y tracking --- libcrystfel/src/crystfel-mille.c | 4 +--- libcrystfel/src/crystfel-mille.h | 3 +-- libcrystfel/src/predict-refine.c | 32 ++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/crystfel-mille.c b/libcrystfel/src/crystfel-mille.c index 4230dadc..fc819371 100644 --- a/libcrystfel/src/crystfel-mille.c +++ b/libcrystfel/src/crystfel-mille.c @@ -74,8 +74,7 @@ int mille_label(int hierarchy_level, int member_index, enum gparam param) void write_mille(Mille *mille, int n, UnitCell *cell, - struct reflpeak *rps, struct image *image, - double dx, double dy) + struct reflpeak *rps, struct image *image) { float local_gradients[9]; float global_gradients[64]; @@ -91,7 +90,6 @@ void write_mille(Mille *mille, int n, UnitCell *cell, signed int h, k, l; double xl, yl, zl, kpred; - double xpk, ypk; int j; const struct detgeom_panel_group *group; diff --git a/libcrystfel/src/crystfel-mille.h b/libcrystfel/src/crystfel-mille.h index 696ee9e1..00d0415d 100644 --- a/libcrystfel/src/crystfel-mille.h +++ b/libcrystfel/src/crystfel-mille.h @@ -50,8 +50,7 @@ extern void crystfel_mille_free(Mille *m); extern int mille_label(int hierarchy_level, int member_index, enum gparam param); extern void write_mille(Mille *mille, int n, UnitCell *cell, - struct reflpeak *rps, struct image *image, - double dx, double dy); + struct reflpeak *rps, struct image *image); extern void crystfel_mille_delete_last_record(Mille *m); diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index 1ed3bfed..a1baf90c 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -320,7 +320,7 @@ int refine_radius(Crystal *cr, struct image *image) static int iterate(struct reflpeak *rps, int n, UnitCell *cell, struct image *image, int num_params, - double *total_x, double *total_y, double *total_z) + double *total_x, double *total_y) { int i; gsl_matrix *M; @@ -399,7 +399,7 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell, } - v_c = fs_dev(&rps[i], image->detgeom, *total_x, *total_y); + v_c = fs_dev(&rps[i], image->detgeom); v_c *= -gradients[k]; v_curr = gsl_vector_get(v, k); gsl_vector_set(v, k, v_curr + v_c); @@ -431,7 +431,7 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell, } - v_c = ss_dev(&rps[i], image->detgeom, *total_x, *total_y); + v_c = ss_dev(&rps[i], image->detgeom); v_c *= -gradients[k]; v_curr = gsl_vector_get(v, k); gsl_vector_set(v, k, v_curr + v_c); @@ -483,11 +483,17 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell, csx += gsl_vector_get(shifts, 6); csy += gsl_vector_get(shifts, 7); csz += gsl_vector_get(shifts, 8); - *total_x += gsl_vector_get(shifts, 9); - *total_y += gsl_vector_get(shifts, 10); - *total_z += 0.0; cell_set_reciprocal(cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); + detgeom_translate_detector_m(image->detgeom, + gsl_vector_get(shifts, 9), + gsl_vector_get(shifts, 10), + 0.0); + + /* The overall shifts will go into the stream and be used by + * scripts/detector-shift */ + *total_x += gsl_vector_get(shifts, 9); + *total_y += gsl_vector_get(shifts, 10); gsl_vector_free(shifts); gsl_matrix_free(M); @@ -497,8 +503,7 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell, } -static double pred_residual(struct reflpeak *rps, int n, struct detgeom *det, - double dx, double dy) +static double pred_residual(struct reflpeak *rps, int n, struct detgeom *det) { int i; double res = 0.0; @@ -548,7 +553,6 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille) RefList *reflist; double total_x = 0.0; double total_y = 0.0; - double total_z = 0.0; double orig_shift_x, orig_shift_y; char tmp[256]; int num_params; @@ -599,26 +603,26 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille) } //STATUS("Initial residual = %e\n", - // pred_residual(rps, n, image->detgeom, total_x, total_y)); + // pred_residual(rps, n, image->detgeom)); /* Refine */ for ( i=0; idetgeom, total_x, total_y)); + // pred_residual(rps, n, image->detgeom)); } //STATUS("Final residual = %e\n", - // pred_residual(rps, n, image->detgeom, total_x, total_y)); + // pred_residual(rps, n, image->detgeom)); snprintf(tmp, 255, "predict_refine/final_residual = %e", - pred_residual(rps, n, image->detgeom, total_x, total_y)); + pred_residual(rps, n, image->detgeom)); crystal_add_notes(cr, tmp); #ifdef HAVE_MILLEPEDE -- cgit v1.2.3