diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2008-08-13 14:27:07 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2008-08-13 14:27:07 +0000 |
commit | a695694114f4b52d8dd015e2376f4aee5d4074b4 (patch) | |
tree | 901ba65856d733356bc38cd4aaf0157c99b69492 /src/reproject.c | |
parent | 04667dc68a17a5a5bc12237cfc3462d9b628c350 (diff) |
Restore working refinement...
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@288 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r-- | src/reproject.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/reproject.c b/src/reproject.c index 439c2f7..e1ce13e 100644 --- a/src/reproject.c +++ b/src/reproject.c @@ -85,7 +85,7 @@ ImageFeatureList *reproject_get_reflections(ImageRecord *image, ReflectionList * double xl, yl, zl; double a, b, c; - double A1, A2, s1, s2, s, temp; + double A1, A2, s1, s2, s; /* Get the coordinates of the reciprocal lattice point */ xl = reflection->x; @@ -95,11 +95,9 @@ ImageFeatureList *reproject_get_reflections(ImageRecord *image, ReflectionList * /* Next, solve the relrod equation to calculate the excitation error */ a = 1.0; b = -2.0*(xl*nx + yl*ny + zl*nz); - c = xl*xl + yl*yl + zl*zl - 1.0/(image->lambda*image->lambda); /* FIXME: Don't think this is stable */ - /* Solve the quadratic equation */ - temp = -0.5 * (b + sign(b)*sqrt(b*b - 4*a*c)); - A1 = temp / a; - A2 = c / temp; + c = xl*xl + yl*yl + zl*zl - 1.0/(image->lambda*image->lambda); + A1 = (-b + sqrt(b*b-4.0*a*c))/(2.0*a); + A2 = (-b - sqrt(b*b-4.0*a*c))/(2.0*a); s1 = 1.0/image->lambda - A1; s2 = 1.0/image->lambda - A2; if ( fabs(s1) < fabs(s2) ) s = s1; else s = s2; |