diff options
author | Thomas White <taw@physics.org> | 2011-06-07 17:46:25 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:27 +0100 |
commit | 97c023d0947b09b2b7c5182c1938133d91f530a4 (patch) | |
tree | d5bfc77a67d54202c2edf94aeda4f5d64605d24e | |
parent | 150c54e977c2e4c638bfe6d1b155229b3b3f1491 (diff) |
Banish find_projected_peaks()
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.in | 7 | ||||
-rw-r--r-- | src/indexamajig.c | 26 | ||||
-rw-r--r-- | src/pattern_sim.c | 21 | ||||
-rw-r--r-- | src/peaks.c | 80 | ||||
-rw-r--r-- | src/peaks.h | 3 |
6 files changed, 19 insertions, 121 deletions
diff --git a/Makefile.am b/Makefile.am index db70f378..63d0e291 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,8 @@ src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c src/utils.c \ src/image.c src/cell.c src/hdf5-file.c \ src/detector.c src/peaks.c \ src/reflist-utils.c src/beam-parameters.c \ - src/symmetry.c src/thread-pool.c src/reflist.c + src/symmetry.c src/thread-pool.c src/reflist.c \ + src/geometry.c if HAVE_OPENCL src_pattern_sim_SOURCES += src/diffraction-gpu.c src/cl-utils.c diff --git a/Makefile.in b/Makefile.in index 584d4ace..82ea4793 100644 --- a/Makefile.in +++ b/Makefile.in @@ -193,14 +193,15 @@ am__src_pattern_sim_SOURCES_DIST = src/pattern_sim.c src/diffraction.c \ src/utils.c src/image.c src/cell.c src/hdf5-file.c \ src/detector.c src/peaks.c src/reflist-utils.c \ src/beam-parameters.c src/symmetry.c src/thread-pool.c \ - src/reflist.c src/diffraction-gpu.c src/cl-utils.c + src/reflist.c src/geometry.c src/diffraction-gpu.c \ + src/cl-utils.c am_src_pattern_sim_OBJECTS = src/pattern_sim.$(OBJEXT) \ src/diffraction.$(OBJEXT) src/utils.$(OBJEXT) \ src/image.$(OBJEXT) src/cell.$(OBJEXT) src/hdf5-file.$(OBJEXT) \ src/detector.$(OBJEXT) src/peaks.$(OBJEXT) \ src/reflist-utils.$(OBJEXT) src/beam-parameters.$(OBJEXT) \ src/symmetry.$(OBJEXT) src/thread-pool.$(OBJEXT) \ - src/reflist.$(OBJEXT) $(am__objects_1) + src/reflist.$(OBJEXT) src/geometry.$(OBJEXT) $(am__objects_1) src_pattern_sim_OBJECTS = $(am_src_pattern_sim_OBJECTS) src_pattern_sim_LDADD = $(LDADD) src_pattern_sim_DEPENDENCIES = $(top_builddir)/lib/libgnu.a @@ -634,7 +635,7 @@ src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \ src/utils.c src/image.c src/cell.c src/hdf5-file.c \ src/detector.c src/peaks.c src/reflist-utils.c \ src/beam-parameters.c src/symmetry.c src/thread-pool.c \ - src/reflist.c $(am__append_3) + src/reflist.c src/geometry.c $(am__append_3) @HAVE_OPENCL_TRUE@tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c src/utils.c \ @HAVE_OPENCL_TRUE@ src/diffraction.c src/diffraction-gpu.c \ @HAVE_OPENCL_TRUE@ src/thread-pool.c src/cell.c src/cl-utils.c \ 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=<flag1>,<flag2>,<flag3>' 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=<m> Use <m> 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; fs<image->width; fs++ ) { - for ( ss=0; ss<image->height; 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, |