aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-27 16:38:19 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commitb2f451cf78d83d6de8a455b191636dc85f7de1cb (patch)
treec473c9895ad9841934082e54f4032d61f29a38d7 /libcrystfel
parentc03c4aa196d68e408abef9f66ad3f3e30b8a16ac (diff)
Convert prediction gradients to detgeom
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/geometry.c30
-rw-r--r--libcrystfel/src/geometry.h7
-rw-r--r--libcrystfel/src/predict-refine.c6
3 files changed, 23 insertions, 20 deletions
diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c
index a1b76a87..b6ede348 100644
--- a/libcrystfel/src/geometry.c
+++ b/libcrystfel/src/geometry.c
@@ -1079,7 +1079,8 @@ void polarisation_correction(RefList *list, UnitCell *cell,
/* Returns dx_h/dP, where P = any parameter */
-double x_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
+double x_gradient(int param, Reflection *refl, UnitCell *cell,
+ struct detgeom_panel *p)
{
signed int h, k, l;
double xl, zl, kpred;
@@ -1096,13 +1097,13 @@ double x_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
switch ( param ) {
case GPARAM_ASX :
- return h * p->clen / (kpred + zl);
+ return h * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_BSX :
- return k * p->clen / (kpred + zl);
+ return k * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_CSX :
- return l * p->clen / (kpred + zl);
+ return l * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_ASY :
return 0.0;
@@ -1114,13 +1115,13 @@ double x_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
return 0.0;
case GPARAM_ASZ :
- return -h * xl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -h * xl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_BSZ :
- return -k * xl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -k * xl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_CSZ :
- return -l * xl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -l * xl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_DETX :
return -1;
@@ -1139,7 +1140,8 @@ double x_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
/* Returns dy_h/dP, where P = any parameter */
-double y_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
+double y_gradient(int param, Reflection *refl, UnitCell *cell,
+ struct detgeom_panel *p)
{
signed int h, k, l;
double yl, zl, kpred;
@@ -1165,22 +1167,22 @@ double y_gradient(int param, Reflection *refl, UnitCell *cell, struct panel *p)
return 0.0;
case GPARAM_ASY :
- return h * p->clen / (kpred + zl);
+ return h * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_BSY :
- return k * p->clen / (kpred + zl);
+ return k * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_CSY :
- return l * p->clen / (kpred + zl);
+ return l * p->cnz * p->pixel_pitch / (kpred + zl);
case GPARAM_ASZ :
- return -h * yl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -h * yl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_BSZ :
- return -k * yl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -k * yl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_CSZ :
- return -l * yl * p->clen / (kpred*kpred + 2.0*kpred*zl + zl*zl);
+ return -l * yl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl);
case GPARAM_DETX :
return 0;
diff --git a/libcrystfel/src/geometry.h b/libcrystfel/src/geometry.h
index afaa9d6c..eb991a27 100644
--- a/libcrystfel/src/geometry.h
+++ b/libcrystfel/src/geometry.h
@@ -8,7 +8,7 @@
* Copyright © 2012 Richard Kirian
*
* Authors:
- * 2010-2016 Thomas White <taw@physics.org>
+ * 2010-2020 Thomas White <taw@physics.org>
* 2012 Richard Kirian
*
* This file is part of CrystFEL.
@@ -39,6 +39,7 @@
#include "reflist.h"
#include "cell.h"
#include "crystal.h"
+#include "detgeom.h"
#ifdef __cplusplus
extern "C" {
@@ -122,9 +123,9 @@ extern double sphere_fraction(double rlow, double rhigh, double pr);
extern double gaussian_fraction(double rlow, double rhigh, double pr);
extern double x_gradient(int param, Reflection *refl, UnitCell *cell,
- struct panel *p);
+ struct detgeom_panel *p);
extern double y_gradient(int param, Reflection *refl, UnitCell *cell,
- struct panel *p);
+ struct detgeom_panel *p);
#ifdef __cplusplus
}
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c
index 0b33c211..bb8c5c35 100644
--- a/libcrystfel/src/predict-refine.c
+++ b/libcrystfel/src/predict-refine.c
@@ -79,15 +79,15 @@ struct reflpeak {
static void twod_mapping(double fs, double ss, double *px, double *py,
- struct panel *p)
+ struct detgeom_panel *p)
{
double xs, ys;
xs = fs*p->fsx + ss*p->ssx;
ys = fs*p->fsy + ss*p->ssy;
- *px = (xs + p->cnx) / p->res;
- *py = (ys + p->cny) / p->res;
+ *px = (xs + p->cnx) * p->pixel_pitch;
+ *py = (ys + p->cny) * p->pixel_pitch;
}