aboutsummaryrefslogtreecommitdiff
path: root/src/ipr.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 22:12:26 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 22:12:26 +0000
commit1ed23746f6d27f648e3a5f96bf499823069fd171 (patch)
treea810520b178e9bd0783f978c42d1b63be875cfc2 /src/ipr.c
parenta7d5360db028fc24547ece8e7a4bc49ecfaa8743 (diff)
Fix really stupid obvious bugs
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@134 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/ipr.c')
-rw-r--r--src/ipr.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ipr.c b/src/ipr.c
index 9324426..47b57e2 100644
--- a/src/ipr.c
+++ b/src/ipr.c
@@ -48,7 +48,8 @@ static Basis *ipr_choose_random_basis(ControlContext *ctx) {
double x, y, z;
Reflection *centre;
- /* Locate the 'plane' in the middle of the "wedge" */
+ /* Locate the 'plane' in the middle of the "wedge".
+ * This whole procedure assumes there is just one tilt axis. */
tilt_min = control_min_tilt(ctx);
tilt_max = control_max_tilt(ctx);
tilt_mid = tilt_min + (tilt_max-tilt_min)/2;
@@ -56,12 +57,11 @@ static Basis *ipr_choose_random_basis(ControlContext *ctx) {
/* Apply the last two steps of the mapping transform to get the direction from the origin
* towards the middle of the wedge */
- printf("tilt_mid=%f deg, tilt=%f deg\n", tilt_mid, imagerecord->tilt);
x_temp = 0.0;
- y_temp = cos(imagerecord->tilt);
- z_temp = -sin(imagerecord->tilt);
- x = x_temp*cos(-imagerecord->omega) + y_temp*sin(-imagerecord->omega);
- y = -x_temp*sin(-imagerecord->omega) + y_temp*cos(-imagerecord->omega);
+ y_temp = cos(deg2rad(imagerecord->tilt));
+ z_temp = -sin(deg2rad(imagerecord->tilt));
+ x = x_temp*cos(-deg2rad(imagerecord->omega)) + y_temp*sin(-deg2rad(imagerecord->omega));
+ y = -x_temp*sin(-deg2rad(imagerecord->omega)) + y_temp*cos(-deg2rad(imagerecord->omega));
z = z_temp;
/* Find the point in the middle of the "wedge" */
@@ -69,12 +69,11 @@ static Basis *ipr_choose_random_basis(ControlContext *ctx) {
x *= scale;
y *= scale;
z *= scale;
- reflection_add(ctx->reflectionctx, x, y, z, 1.0, REFLECTION_VECTOR_MARKER_1);
- reflection_add(ctx->reflectionctx, x_temp*scale, y_temp*scale, z_temp*scale, 1.0, REFLECTION_VECTOR_MARKER_3);
+ reflection_add(ctx->reflectionctx, x, y, z, 1.0, REFLECTION_VECTOR_MARKER_2);
centre = reflection_find_nearest(ctx->reflectionctx, x, y, z);
if ( !centre ) return NULL;
- reflection_add(ctx->reflectionctx, centre->x, centre->y, centre->z, 1.0, REFLECTION_VECTOR_MARKER_2);
+ reflection_add(ctx->reflectionctx, centre->x, centre->y, centre->z, 1.0, REFLECTION_MARKER);
basis = malloc(sizeof(Basis));
@@ -120,6 +119,8 @@ static double ipr_efom(ReflectionContext *rctx, Basis *basis) {
if ( h == 1.0 ) h = 0.0;
if ( k == 1.0 ) k = 0.0;
if ( l == 1.0 ) l = 0.0;
+
+ /* Define "approximately" here. Circle in basis space becomes an ellipsoid in reciprocal space */
if ( h*h + k*k + l*l <= 0.1*0.1*0.1 ) n_indexed++;
n_counted++;