diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2008-01-07 18:06:05 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2008-01-07 18:06:05 +0000 |
commit | a48ab02eddace230f198ae8445c45190a8f1c179 (patch) | |
tree | f728dd65afadfcfa98ef076ef0ed485c107d518a | |
parent | 1ee5beff75915df1c9d30cf816ba41f49c734e99 (diff) |
Record the strongest of duplicated measurements
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@241 bf6ca9ba-c028-0410-8290-897cf20841d1
-rw-r--r-- | src/intensities.c | 37 | ||||
-rw-r--r-- | src/reflections.c | 17 | ||||
-rw-r--r-- | src/reflections.h | 1 |
3 files changed, 48 insertions, 7 deletions
diff --git a/src/intensities.c b/src/intensities.c index af04c8e..2d56b30 100644 --- a/src/intensities.c +++ b/src/intensities.c @@ -64,26 +64,51 @@ void intensities_extract(ControlContext *ctx) { if ( (h!=0) || (k!=0) || (l!=0) ) { double intensity; - Reflection *new; + Reflection *ref; /* Perform relrod calculation of doom here. * TODO: Figure out if this is even possible. */ intensity = feature->partner->intensity; - new = reflection_add(ctx->integrated, + ref = reflectionlist_find(ctx->integrated, h, k, l); + + if ( ref == NULL ) { + + Reflection *new; + + printf("IN: Adding %3i %3i %3i, intensity=%f\n", h, k, l, intensity); + + new = reflection_add(ctx->integrated, feature->reflection->x, feature->reflection->y, feature->reflection->z, intensity, REFLECTION_GENERATED); - - if ( new != NULL ) { + new->h = h; new->k = k; new->l = l; - //printf("IN: Adding %3i %3i %3i, intensity=%f\n", h, k, l, intensity); + if ( intensity > max ) max = intensity; + n_meas++; + } else { - printf("IN: Duplicate measurement for %3i %3i %3i\n", h, k, l); + + printf("IN: Duplicate measurement for %3i %3i %3i - ", h, k, l); + + if ( intensity > ref->intensity ) { + + printf("stronger.\n"); + + ref->x = feature->reflection->x; + ref->y = feature->reflection->y; + ref->z = feature->reflection->z; + ref->intensity = intensity; + + } else { + printf("weaker.\n"); + } + n_dupl++; + } } diff --git a/src/reflections.c b/src/reflections.c index 8d6b2e5..0f25e2a 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -212,7 +212,6 @@ Reflection *reflectionlist_find_nearest_type(ReflectionList *reflectionlist, dou return best; - } /* Generate a list of reflections from a unit cell */ @@ -293,3 +292,19 @@ int reflection_is_easy(Reflection *reflection) { } +Reflection *reflectionlist_find(ReflectionList *reflectionlist, signed int h, signed int k, signed int l) { + + Reflection *reflection; + + reflection = reflectionlist->reflections; + while ( reflection ) { + if ( (reflection->h==h) && (reflection->k==k) && (reflection->l==l) ) { + return reflection; + } + reflection = reflection->next; + }; + + return NULL; + +} + diff --git a/src/reflections.h b/src/reflections.h index 1ca7d5a..8a0afef 100644 --- a/src/reflections.h +++ b/src/reflections.h @@ -68,6 +68,7 @@ extern double reflectionlist_largest_g(ReflectionList *reflectionlist); extern Reflection *reflectionlist_find_nearest(ReflectionList *reflectionlist, double x, double y, double z); extern Reflection *reflectionlist_find_nearest_longer_unknown(ReflectionList *reflectionlist, double x, double y, double z, double min_distance); extern Reflection *reflectionlist_find_nearest_type(ReflectionList *reflectionlist, double x, double y, double z, ReflectionType type); +extern Reflection *reflectionlist_find(ReflectionList *reflectionlist, signed int h, signed int k, signed int l); #include "basis.h" extern ReflectionList *reflection_list_from_cell(Basis *basis); |