aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/predict-refine.c11
-rw-r--r--tests/gradient_check.c12
2 files changed, 13 insertions, 10 deletions
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c
index d5838e06..4a228dc1 100644
--- a/libcrystfel/src/predict-refine.c
+++ b/libcrystfel/src/predict-refine.c
@@ -283,12 +283,12 @@ int fs_ss_gradient_panel(int param, Reflection *refl, UnitCell *cell,
}
-/* Returns dfs_refl/dP and fss_refl/dP, where P = any parameter
- * fs_refl is the fast scan position of refl in panel 'p',
+/* Returns the gradient of fs_dev and ss_dev w.r.t. any parameter.
+ * cx,cy,cz are the rotation axis coordinates (only 2 in use at any time)
* in metres (not pixels) */
int fs_ss_gradient(int param, Reflection *refl, UnitCell *cell,
struct detgeom_panel *p, gsl_matrix *Minv,
- double cx, double cy, double cz,
+ double cxm, double cym, double czm,
float *fsg, float *ssg)
{
signed int h, k, l;
@@ -351,7 +351,10 @@ int fs_ss_gradient(int param, Reflection *refl, UnitCell *cell,
} else {
return fs_ss_gradient_panel(param, refl, cell, p,
Minv, fs, ss, mu, t,
- cx, cy, cz, fsg, ssg);
+ cxm/p->pixel_pitch,
+ cym/p->pixel_pitch,
+ czm/p->pixel_pitch,
+ fsg, ssg);
}
}
diff --git a/tests/gradient_check.c b/tests/gradient_check.c
index 7396b8ad..2a8175e1 100644
--- a/tests/gradient_check.c
+++ b/tests/gradient_check.c
@@ -53,9 +53,9 @@ int main(int argc, char *argv[])
double step;
gsl_matrix **panel_matrices;
int didsomething = 0;
- const double cx = -200.0;
- const double cy = +100.0;
- const double cz = -50.0;
+ const double cx = 0.03; /* Detector is a 7.5 cm side length square */
+ const double cy = 0.02;
+ const double cz = 0.01;
rps = make_test_image(&n_refls, &image);
panel_matrices = make_panel_minvs(image.detgeom);
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
#ifdef ROTATE_PANEL_X
struct detgeom_panel *p = &image.detgeom->panels[0];
step = deg2rad(0.01);
- rotate2d(&p->cnz, &p->cny, cz, cy, step);
+ rotate2d(&p->cnz, &p->cny, cz/p->pixel_pitch, cy/p->pixel_pitch, step);
rotate2d(&p->fsz, &p->fsy, 0, 0, step);
rotate2d(&p->ssz, &p->ssy, 0, 0, step);
didsomething = 1;
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
#ifdef ROTATE_PANEL_Y
struct detgeom_panel *p = &image.detgeom->panels[0];
step = deg2rad(0.01);
- rotate2d(&p->cnx, &p->cnz, cx, cz, step);
+ rotate2d(&p->cnx, &p->cnz, cx/p->pixel_pitch, cz/p->pixel_pitch, step);
rotate2d(&p->fsx, &p->fsz, 0, 0, step);
rotate2d(&p->ssx, &p->ssz, 0, 0, step);
didsomething = 1;
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
#ifdef ROTATE_PANEL_Z
struct detgeom_panel *p = &image.detgeom->panels[0];
step = deg2rad(0.01);
- rotate2d(&p->cnx, &p->cny, cx, cy, step);
+ rotate2d(&p->cnx, &p->cny, cx/p->pixel_pitch, cy/p->pixel_pitch, step);
rotate2d(&p->fsx, &p->fsy, 0, 0, step);
rotate2d(&p->ssx, &p->ssy, 0, 0, step);
didsomething = 1;