From 97c023d0947b09b2b7c5182c1938133d91f530a4 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Jun 2011 17:46:25 +0200 Subject: Banish find_projected_peaks() --- src/indexamajig.c | 26 +++++------------- src/pattern_sim.c | 21 +++++---------- src/peaks.c | 80 ------------------------------------------------------- src/peaks.h | 3 --- 4 files changed, 13 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/indexamajig.c b/src/indexamajig.c index eef9a381..49c7118e 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -146,10 +146,6 @@ static void show_help(const char *s) "\n\n" "You can control what information is included in the output stream using\n" "' --record=,,' and so on. Possible flags are:\n\n" -" pixels Include a list of sums of pixel values within the\n" -" integration domain, correcting for individual pixel\n" -" solid angles.\n" -"\n" " integrated Include a list of reflection intensities, produced by\n" " integrating around predicted peak locations.\n" "\n" @@ -160,8 +156,7 @@ static void show_help(const char *s) "\n" " peaksifnotindexed As 'peaks', but only if the pattern could NOT be indexed.\n" "\n\n" -"The default is '--record=integrated'. The flags 'pixels' and 'integrated'\n" -"are mutually exclusive, as are the flags 'peaks' and 'peaksifindexed'.\n" +"The default is '--record=integrated'.\n" "\n\n" "For more control over the process, you might need:\n\n" " --cell-reduction= Use as the cell reduction method. Choose from:\n" @@ -324,26 +319,19 @@ static void process_image(void *pp, int cookie) /* Do EITHER: */ - //image.div = beam->divergence; - //image.bw = beam->bandwidth; - //image.profile_radius = 0.0001e9; - //image.reflections = find_intersections(&image, - // image.indexed_cell, 0); if ( image.indexed_cell != NULL ) { - image.reflections = find_projected_peaks(&image, - image.indexed_cell, - 0, 0.1); + + image.div = beam->divergence; + image.bw = beam->bandwidth; + image.profile_radius = 0.0001e9; + image.reflections = find_intersections(&image, + image.indexed_cell, 0); integrate_reflections(&image, config_polar, pargs->static_args.config_closer, pargs->static_args.config_bgsub); - /* OR */ - - //image.reflections = integrate_pixels(&image, 0, 0.1, - // config_polar); - } else { image.reflections = NULL; diff --git a/src/pattern_sim.c b/src/pattern_sim.c index f1fbce7e..89fffbc5 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -33,6 +33,7 @@ #include "symmetry.h" #include "reflist.h" #include "reflist-utils.h" +#include "geometry.h" static void show_help(const char *s) @@ -547,24 +548,14 @@ int main(int argc, char *argv[]) if ( config_nearbragg ) { - /* Do EITHER: */ - - //image.div = beam->divergence; - //image.bw = beam->bandwidth; - //image.profile_radius = 0.0001e9; - //image.reflections = find_intersections(&image, - // image.indexed_cell, 0); - - image.reflections = find_projected_peaks(&image, - image.indexed_cell, 0, 0.1); + image.div = image.beam->divergence; + image.bw = image.beam->bandwidth; + image.profile_radius = 0.0001e9; + image.reflections = find_intersections(&image, + image.indexed_cell, 0); integrate_reflections(&image, 0, 0, 0); - /* OR */ - - //image.reflections = integrate_pixels(&image, 0, 0.1, - // config_polar); - } if ( powder_fn != NULL ) { diff --git a/src/peaks.c b/src/peaks.c index 2e7e7804..e4a7cfb1 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -449,86 +449,6 @@ void search_peaks(struct image *image, float threshold, float min_gradient) } -RefList *find_projected_peaks(struct image *image, UnitCell *cell, - int circular_domain, double domain_r) -{ - int fs, ss; - double ax, ay, az; - double bx, by, bz; - double cx, cy, cz; - RefList *reflections; - double alen, blen, clen; - int n_reflections = 0; - - reflections = reflist_new(); - - /* "Borrow" direction values to get reciprocal lengths */ - cell_get_reciprocal(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); - alen = modulus(ax, ay, az); - blen = modulus(bx, by, bz); - clen = modulus(cx, cy, cz); - - cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); - - fesetround(1); /* Round towards nearest */ - for ( fs=0; fswidth; fs++ ) { - for ( ss=0; ssheight; ss++ ) { - - double hd, kd, ld; /* Indices with decimal places */ - double dh, dk, dl; /* Distances in h,k,l directions */ - signed int h, k, l; - struct rvec q; - double dist; - Reflection *refl; - double cur_dist; - - q = get_q(image, fs, ss, NULL, 1.0/image->lambda); - - hd = q.u * ax + q.v * ay + q.w * az; - kd = q.u * bx + q.v * by + q.w * bz; - ld = q.u * cx + q.v * cy + q.w * cz; - - h = lrint(hd); - k = lrint(kd); - l = lrint(ld); - - dh = hd - h; - dk = kd - k; - dl = ld - l; - - if ( circular_domain ) { - /* Circular integration domain */ - dist = sqrt(pow(dh*alen, 2.0) + pow(dk*blen, 2.0) - + pow(dl*clen, 2.0)); - if ( dist > domain_r ) continue; - } else { - /* "Crystallographic" integration domain */ - dist = sqrt(pow(dh, 2.0) + pow(dk, 2.0) + pow(dl, 2.0)); - if ( dist > domain_r ) continue; - } - - refl = find_refl(reflections, h, k, l); - if ( refl != NULL ) { - cur_dist = get_excitation_error(refl); - if ( dist < cur_dist ) { - set_detector_pos(refl, dist, fs, ss); - } - } else { - Reflection *new; - new = add_refl(reflections, h, k, l); - set_detector_pos(new, dist, fs, ss); - n_reflections++; - } - - } - } - - optimise_reflist(reflections); - - return reflections; -} - - int peak_sanity_check(struct image *image, UnitCell *cell, int circular_domain, double domain_r) { diff --git a/src/peaks.h b/src/peaks.h index ec473fd1..3d21bbde 100644 --- a/src/peaks.h +++ b/src/peaks.h @@ -30,9 +30,6 @@ extern void integrate_reflections(struct image *image, extern int peak_sanity_check(struct image *image, UnitCell *cell, int circular_domain, double domain_r); -extern RefList *find_projected_peaks(struct image *image, UnitCell *cell, - int circular_domain, double domain_r); - /* Exported so it can be poked by integration_check */ extern int integrate_peak(struct image *image, int cfs, int css, double *pfs, double *pss, double *intensity, -- cgit v1.2.3