aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-12-08 10:55:06 +0100
committerThomas White <taw@physics.org>2016-12-09 17:33:22 +0100
commit7d1c7f5f3d6e6acb82c7677b29de150a0633dccf (patch)
tree9fd20890ac3c619ebfd23c8a40e7bec328777e5b /libcrystfel
parent6ef84c7d88c2b4882a0f781413d74b10951b907a (diff)
New polarisation correction
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/geometry.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c
index 5403325f..b968dc06 100644
--- a/libcrystfel/src/geometry.c
+++ b/libcrystfel/src/geometry.c
@@ -636,25 +636,18 @@ void polarisation_correction(RefList *list, UnitCell *cell, struct image *image)
refl != NULL;
refl = next_refl(refl, iter) )
{
- double pol, pa, pb, phi, tt, ool;
+ double pol;
double intensity;
- double xl, yl, zl;
+ double xl, yl;
signed int h, k, l;
+ const double P = 1.0; /* degree of polarisation */
get_indices(refl, &h, &k, &l);
- /* Polarisation correction assuming 100% polarisation
- * along the x direction */
- xl = h*asx + k*bsx + l*csx;
- yl = h*asy + k*bsy + l*csy;
- zl = h*asz + k*bsz + l*csz;
+ xl = (h*asx + k*bsx + l*csx)*image->lambda;
+ yl = (h*asy + k*bsy + l*csy)*image->lambda;
- ool = 1.0 / image->lambda;
- tt = angle_between(0.0, 0.0, 1.0, xl, yl, zl+ool);
- phi = atan2(yl, xl);
- pa = pow(sin(phi)*sin(tt), 2.0);
- pb = pow(cos(tt), 2.0);
- pol = 1.0 - 2.0*(1.0-pa) + (1.0+pb);
+ pol = P*(1.0 - xl*xl) + (1.0-P)*(1.0 - yl*yl);
intensity = get_intensity(refl);
set_intensity(refl, intensity / pol);