From e84f8c67fbeca8d82633287032f8cb2a828f1b1a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 12 Sep 2023 16:11:42 +0200 Subject: Fix sense of panel rotations Should always be a right-hand grip rotation around positive axis direction. --- libcrystfel/src/datatemplate.c | 12 ++++++------ libcrystfel/src/predict-refine.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index cbec604f..36c0a422 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -2222,16 +2222,16 @@ static int rotate_all_panels(DataTemplate *dtempl, switch ( axis ) { case 'x': - rotate2d(&cnz_px, &p->cny, cz, cy, ang); - rotate2d(&p->fsz, &p->fsy, 0, 0, ang); - rotate2d(&p->ssz, &p->ssy, 0, 0, ang); + rotate2d(&p->cny, &cnz_px, cy, cz, ang); + rotate2d(&p->fsy, &p->fsz, 0, 0, ang); + rotate2d(&p->ssy, &p->ssz, 0, 0, ang); p->cnz_offset = cnz_px * p->pixel_pitch; break; case 'y': - rotate2d(&p->cnx, &cnz_px, cx, cz, ang); - rotate2d(&p->fsx, &p->fsz, 0, 0, ang); - rotate2d(&p->ssx, &p->ssz, 0, 0, ang); + rotate2d(&cnz_px, &p->cnx, cz, cx, ang); + rotate2d(&p->fsz, &p->fsx, 0, 0, ang); + rotate2d(&p->ssz, &p->ssx, 0, 0, ang); p->cnz_offset = cnz_px * p->pixel_pitch; break; diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index 4fdccef4..43b54092 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -232,21 +232,21 @@ int fs_ss_gradient_panel(int param, Reflection *refl, UnitCell *cell, break; case GPARAM_DET_RX : - gsl_matrix_set(dMdp, 1, 0, p->pixel_pitch*p->cnz-cz); - gsl_matrix_set(dMdp, 2, 0, cy-p->pixel_pitch*p->cny); - gsl_matrix_set(dMdp, 1, 1, p->pixel_pitch*p->fsz); - gsl_matrix_set(dMdp, 2, 1, -p->pixel_pitch*p->fsy); - gsl_matrix_set(dMdp, 1, 2, p->pixel_pitch*p->ssz); - gsl_matrix_set(dMdp, 2, 2, -p->pixel_pitch*p->ssy); + gsl_matrix_set(dMdp, 1, 0, cz-p->pixel_pitch*p->cnz); + gsl_matrix_set(dMdp, 2, 0, p->pixel_pitch*p->cny-cy); + gsl_matrix_set(dMdp, 1, 1, -p->pixel_pitch*p->fsz); + gsl_matrix_set(dMdp, 2, 1, p->pixel_pitch*p->fsy); + gsl_matrix_set(dMdp, 1, 2, -p->pixel_pitch*p->ssz); + gsl_matrix_set(dMdp, 2, 2, p->pixel_pitch*p->ssy); break; case GPARAM_DET_RY : - gsl_matrix_set(dMdp, 0, 0, cz-p->pixel_pitch*p->cnz); - gsl_matrix_set(dMdp, 2, 0, p->pixel_pitch*p->cnx-cx); - gsl_matrix_set(dMdp, 0, 1, -p->pixel_pitch*p->fsz); - gsl_matrix_set(dMdp, 2, 1, p->pixel_pitch*p->fsx); - gsl_matrix_set(dMdp, 0, 2, -p->pixel_pitch*p->ssz); - gsl_matrix_set(dMdp, 2, 2, p->pixel_pitch*p->ssx); + gsl_matrix_set(dMdp, 0, 0, p->pixel_pitch*p->cnz-cz); + gsl_matrix_set(dMdp, 2, 0, cx-p->pixel_pitch*p->cnx); + gsl_matrix_set(dMdp, 0, 1, p->pixel_pitch*p->fsz); + gsl_matrix_set(dMdp, 2, 1, -p->pixel_pitch*p->fsx); + gsl_matrix_set(dMdp, 0, 2, p->pixel_pitch*p->ssz); + gsl_matrix_set(dMdp, 2, 2, -p->pixel_pitch*p->ssx); break; case GPARAM_DET_RZ : -- cgit v1.2.3