aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/detector.c4
-rw-r--r--src/detector.h1
-rw-r--r--src/peaks.c18
3 files changed, 20 insertions, 3 deletions
diff --git a/src/detector.c b/src/detector.c
index da423235..6a80ac0c 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -265,6 +265,7 @@ struct detector *get_detector_geometry(const char *filename)
det->panels[i].res = -1;
det->panels[i].badrow = '0';
det->panels[i].no_index = 0;
+ det->panels[i].peak_sep = 50.0;
}
continue;
@@ -311,6 +312,8 @@ struct detector *get_detector_geometry(const char *filename)
det->panels[np].clen = atof(bits[2]);
} else if ( strcmp(path[1], "res") == 0 ) {
det->panels[np].res = atof(bits[2]);
+ } else if ( strcmp(path[1], "peak_sep") == 0 ) {
+ det->panels[np].peak_sep = atof(bits[2]);
} else if ( strcmp(path[1], "badrow_direction") == 0 ) {
det->panels[np].badrow = bits[2][0];
if ( (det->panels[np].badrow != 'x')
@@ -397,6 +400,7 @@ struct detector *get_detector_geometry(const char *filename)
det->panels[i].badrow);
/* 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) */
if ( det->panels[i].max_x > max_x ) {
max_x = det->panels[i].max_x;
diff --git a/src/detector.h b/src/detector.h
index 720b5351..375731cd 100644
--- a/src/detector.h
+++ b/src/detector.h
@@ -32,6 +32,7 @@ struct panel
float res; /* Resolution */
char badrow; /* 'x' or 'y' */
int no_index; /* Don't index peaks in this panel if non-zero */
+ float peak_sep; /* Characteristic peak separation */
};
struct detector
diff --git a/src/peaks.c b/src/peaks.c
index 7c91f817..b30c4815 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -339,10 +339,15 @@ void search_peaks(struct image *image, float threshold)
double max;
unsigned int did_something;
int r;
+ struct panel *p;
/* Overall threshold */
if ( data[x+width*y] < threshold ) continue;
+ p = find_panel(image->det, x, y);
+ if ( !p ) continue;
+ if ( p->no_index ) continue;
+
/* Ignore streak */
if ( in_streak(x, y) ) continue;
@@ -387,12 +392,14 @@ void search_peaks(struct image *image, float threshold)
}
/* Abort if drifted too far from the foot point */
- if ( distance(mask_x, mask_y, x, y) > 50.0 ) break;
+ if ( distance(mask_x, mask_y, x, y) > p->peak_sep ) {
+ break;
+ }
} while ( did_something );
/* Too far from foot point? */
- if ( distance(mask_x, mask_y, x, y) > 50.0 ) {
+ if ( distance(mask_x, mask_y, x, y) > p->peak_sep ) {
nrej_dis++;
continue;
}
@@ -429,7 +436,7 @@ void search_peaks(struct image *image, float threshold)
/* Check for a nearby feature */
image_feature_closest(image->features, fx, fy, &d, &idx);
- if ( d < 15.0 ) {
+ if ( d < p->peak_sep ) {
nrej_pro++;
continue;
}
@@ -523,6 +530,11 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
double dist;
int found = 0;
int j;
+ struct panel *p;
+
+ p = find_panel(image->det, x, y);
+ if ( p == NULL ) continue;
+ if ( p->no_index ) continue;
q = get_q(image, x, y, 1, NULL, 1.0/image->lambda);