aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-16 09:56:24 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:05 +0100
commit0567569d2f97a5c4aae54d6f8b27f0eeb7539b86 (patch)
tree473b9bf0e5129ac4cedffe775b6696a2de6821fa /src
parent5447d802f6c8baedf350c2fe002757b390e7c8da (diff)
indexamajig: Take minimum gradient on command line
Diffstat (limited to 'src')
-rw-r--r--src/calibrate_detector.c2
-rw-r--r--src/indexamajig.c13
-rw-r--r--src/peaks.c4
-rw-r--r--src/peaks.h3
4 files changed, 17 insertions, 5 deletions
diff --git a/src/calibrate_detector.c b/src/calibrate_detector.c
index 7feeb16c..2252842f 100644
--- a/src/calibrate_detector.c
+++ b/src/calibrate_detector.c
@@ -110,7 +110,7 @@ static void sum_peaks(struct image *image, double *sum)
const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS;
/* FIXME: Get threshold value from command line */
- search_peaks(image, 800.0);
+ search_peaks(image, 800.0, 100000.0);
for ( i=0; i<image_feature_count(image->features); i++ ) {
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 984c1e45..799750f3 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -65,6 +65,7 @@ struct static_index_args
int config_sa;
int config_closer;
float threshold;
+ float min_gradient;
struct detector *det;
IndexingMethod indm;
IndexingPrivate *ipriv;
@@ -183,6 +184,8 @@ static void show_help(const char *s)
" --no-sa Don't correct for the differing solid angles of\n"
" the pixels.\n"
" --threshold=<n> Only accept peaks above <n> ADU. Default: 800.\n"
+" --min-gradient=<n> Minimum gradient for Zaefferer peak search.\n"
+" Default: 100,000.\n"
"\n"
"\nIf you used --simulate, you may also want:\n\n"
" --intensities=<file> Specify file containing reflection intensities\n"
@@ -364,7 +367,8 @@ static void process_image(void *pp, int cookie)
}
break;
case PEAK_ZAEF :
- search_peaks(&image, pargs->static_args.threshold);
+ search_peaks(&image, pargs->static_args.threshold,
+ pargs->static_args.min_gradient);
break;
}
@@ -521,6 +525,7 @@ int main(int argc, char *argv[])
int config_checkprefix = 1;
int config_closer = 1;
float threshold = 800.0;
+ float min_gradient = 100000.0;
struct detector *det;
char *geometry = NULL;
IndexingMethod indm;
@@ -574,6 +579,7 @@ int main(int argc, char *argv[])
{"sat-corr", 0, &config_satcorr, 1}, /* Compat */
{"no-sa", 0, &config_sa, 0},
{"threshold", 1, NULL, 't'},
+ {"min-gradient", 1, NULL, 4},
{"no-check-prefix", 0, &config_checkprefix, 0},
{"no-closer-peak", 0, &config_closer, 0},
{0, 0, NULL, 0}
@@ -641,6 +647,10 @@ int main(int argc, char *argv[])
scellr = strdup(optarg);
break;
+ case 4 :
+ min_gradient = strtof(optarg, NULL);
+ break;
+
case 0 :
break;
@@ -831,6 +841,7 @@ int main(int argc, char *argv[])
qargs.static_args.config_closer = config_closer;
qargs.static_args.cellr = cellr;
qargs.static_args.threshold = threshold;
+ qargs.static_args.min_gradient = min_gradient;
qargs.static_args.det = det;
qargs.static_args.indm = indm;
qargs.static_args.ipriv = ipriv;
diff --git a/src/peaks.c b/src/peaks.c
index c75ffd21..2098f6ec 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -302,7 +302,7 @@ int integrate_peak(struct image *image, int xp, int yp,
}
-void search_peaks(struct image *image, float threshold)
+void search_peaks(struct image *image, float threshold, float min_gradient)
{
int x, y, width, height;
float *data;
@@ -364,7 +364,7 @@ void search_peaks(struct image *image, float threshold)
/* Calculate overall gradient */
grad = dxs + dys;
- if ( grad < 100000 ) continue;
+ if ( grad < min_gradient ) continue;
mask_x = x;
mask_y = y;
diff --git a/src/peaks.h b/src/peaks.h
index 163a407c..cfc3d322 100644
--- a/src/peaks.h
+++ b/src/peaks.h
@@ -19,7 +19,8 @@
#include <pthread.h>
-extern void search_peaks(struct image *image, float threshold);
+extern void search_peaks(struct image *image, float threshold,
+ float min_gradient);
extern void dump_peaks(struct image *image, FILE *ofh, pthread_mutex_t *mutex);
extern void output_intensities(struct image *image, UnitCell *cell,