aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-19 17:08:34 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:06 +0100
commited5e49e996cd4ee9d1118e19a27ee1ac7cc67c41 (patch)
tree7e226250a503fba0d419f2778be9589cccc0cb68
parentf74158ae3c381d98a44a66de1e7e0994b4520b22 (diff)
facetron: Refine divergence
-rw-r--r--src/facetron.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/facetron.c b/src/facetron.c
index a0c2b6e4..cf4f099e 100644
--- a/src/facetron.c
+++ b/src/facetron.c
@@ -43,6 +43,7 @@
/* Refineable parameters */
enum {
REF_SCALE,
+ REF_DIV,
NUM_PARAMS
};
@@ -86,11 +87,21 @@ struct refine_args
static double gradient(struct image *image, int k,
struct cpeak spot, double I_partial)
{
+ double ds;
+ double nom, den;
+
+ ds = 2.0 * resolution(image->indexed_cell, spot.h, spot.k, spot.l);
+
switch ( k ) {
case REF_SCALE :
return I_partial;
+ case REF_DIV :
+ nom = sqrt(2.0) * ds * sin(image->div);
+ den = sqrt(1.0 - cos(image->div));
+ return nom/den;
+
}
ERROR("No gradient defined for parameter %i\n", k);
@@ -107,6 +118,11 @@ static void apply_shift(struct image *image, int k, double shift)
image->osf += shift;
break;
+ case REF_DIV :
+ STATUS("Shifting div by %e\n", shift);
+ image->div += shift;
+ break;
+
default :
ERROR("No shift defined for parameter %i\n", k);
abort();