From 172293570b790ffcde14128404d9c0e294ca1f30 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 28 Jun 2012 17:23:46 +0200 Subject: Remove peak_sep from detector geometry file, use ir_inn instead --- libcrystfel/src/detector.c | 7 ------- libcrystfel/src/detector.h | 1 - libcrystfel/src/peaks.c | 26 +++++++++++--------------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index b7d809df..f212821d 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -608,8 +608,6 @@ static int parse_field_for_panel(struct panel *panel, const char *key, panel->res = atof(val); } else if ( strcmp(key, "max_adu") == 0 ) { panel->max_adu = atof(val); - } else if ( strcmp(key, "peak_sep") == 0 ) { - panel->peak_sep = atof(val); } else if ( strcmp(key, "badrow_direction") == 0 ) { panel->badrow = val[0]; /* First character only */ if ( (panel->badrow != 'x') && (panel->badrow != 'y') @@ -687,8 +685,6 @@ static void parse_toplevel(struct detector *det, const char *key, det->mask_good = v; } - } else if ( strcmp(key, "peak_sep") == 0 ) { - det->defaults.peak_sep = atof(val); } else if ( strcmp(key, "coffset") == 0 ) { det->defaults.coffset = atof(val); } else if ( parse_field_for_panel(&det->defaults, key, val, det) ) { @@ -738,7 +734,6 @@ struct detector *get_detector_geometry(const char *filename) det->defaults.res = -1.0; det->defaults.badrow = '-'; det->defaults.no_index = 0; - det->defaults.peak_sep = 50.0; det->defaults.fsx = 1.0; det->defaults.fsy = 0.0; det->defaults.ssx = 0.0; @@ -887,7 +882,6 @@ struct detector *get_detector_geometry(const char *filename) } /* It's OK if the badrow direction is '0' */ /* It's not a problem if "no_index" is still zero */ - /* The default peak_sep is OK (maybe) */ /* The default transformation matrix is at least valid */ if ( det->panels[i].max_fs > max_fs ) { @@ -1250,7 +1244,6 @@ int write_detector_geometry(const char *filename, struct detector *det) fprintf(fh, "%s/max_ss = %d\n", p->name, p->max_ss); fprintf(fh, "%s/badrow_direction = %C\n", p->name, p->badrow); fprintf(fh, "%s/res = %g\n", p->name, p->res); - fprintf(fh, "%s/peak_sep = %g\n", p->name, p->peak_sep); fprintf(fh, "%s/clen = %s\n", p->name, p->clen_from); fprintf(fh, "%s/fs = %+fx %+fy\n", p->name, p->fsx, p->fsy); fprintf(fh, "%s/ss = %+fx %+fy\n", p->name, p->ssx, p->ssy); diff --git a/libcrystfel/src/detector.h b/libcrystfel/src/detector.h index 2b4ac5c6..b740965c 100644 --- a/libcrystfel/src/detector.h +++ b/libcrystfel/src/detector.h @@ -62,7 +62,6 @@ struct panel double res; /* Resolution in pixels per metre */ char badrow; /* 'x' or 'y' */ int no_index; /* Don't index peaks in this panel if non-zero */ - double peak_sep; /* Characteristic peak separation */ char *rigid_group; /* Rigid group, or -1 for none */ double adu_per_eV; /* Number of ADU per eV */ double max_adu; /* Treat pixel as unreliable if higher than this */ diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index fe836c3f..121ecb6c 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -390,7 +390,6 @@ static void search_peaks_in_panel(struct image *image, float threshold, int nrej_snr = 0; int nacc = 0; int ncull; - const int pws = p->peak_sep/2; data = image->data; stride = image->width; @@ -433,16 +432,14 @@ static void search_peaks_in_panel(struct image *image, float threshold, max = data[mask_fs+stride*mask_ss]; did_something = 0; - for ( s_ss=biggest(mask_ss-pws/2, - p->min_ss); - s_ss<=smallest(mask_ss+pws/2, - p->max_ss); - s_ss++ ) { - for ( s_fs=biggest(mask_fs-pws/2, - p->min_fs); - s_fs<=smallest(mask_fs+pws/2, - p->max_fs); - s_fs++ ) { + for ( s_ss=biggest(mask_ss-ir_inn, p->min_ss); + s_ss<=smallest(mask_ss+ir_inn, p->max_ss); + s_ss++ ) + { + for ( s_fs=biggest(mask_fs-ir_inn, p->min_fs); + s_fs<=smallest(mask_fs+ir_inn, p->max_fs); + s_fs++ ) + { if ( data[s_fs+stride*s_ss] > max ) { max = data[s_fs+stride*s_ss]; @@ -455,8 +452,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, } /* Abort if drifted too far from the foot point */ - if ( distance(mask_fs, mask_ss, fs, ss) > - p->peak_sep/2.0 ) + if ( distance(mask_fs, mask_ss, fs, ss) > ir_inn ) { break; } @@ -464,7 +460,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, } while ( did_something ); /* Too far from foot point? */ - if ( distance(mask_fs, mask_ss, fs, ss) > p->peak_sep/2.0 ) { + if ( distance(mask_fs, mask_ss, fs, ss) > ir_inn ) { nrej_dis++; continue; } @@ -500,7 +496,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, /* Check for a nearby feature */ image_feature_closest(image->features, f_fs, f_ss, &d, &idx); - if ( d < p->peak_sep/2.0 ) { + if ( d < 2.0*ir_inn ) { nrej_pro++; continue; } -- cgit v1.2.3