aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples/lcls-dec.geom2
-rw-r--r--doc/examples/lcls-june-r0013-r0128.geom2
-rw-r--r--doc/examples/lcls-xpp-estimate.geom1
-rw-r--r--doc/examples/simple.geom2
-rw-r--r--doc/geometry.txt3
-rw-r--r--src/detector.c4
-rw-r--r--src/detector.h1
-rw-r--r--src/peaks.c18
8 files changed, 30 insertions, 3 deletions
diff --git a/doc/examples/lcls-dec.geom b/doc/examples/lcls-dec.geom
index 7403f004..9ca0ea58 100644
--- a/doc/examples/lcls-dec.geom
+++ b/doc/examples/lcls-dec.geom
@@ -10,6 +10,7 @@ n_panels = 2
0/clen = 67.8e-3
0/res = 13333.3 ; 75 micron pixel size
0/badrow_direction = y
+0/peak_sep = 50
; Lower panel
1/min_x = 0
@@ -21,3 +22,4 @@ n_panels = 2
1/clen = 70.8e-3
1/res = 13333.3 ; 75 micron pixel size
1/badrow_direction = y
+1/peak_sep = 50
diff --git a/doc/examples/lcls-june-r0013-r0128.geom b/doc/examples/lcls-june-r0013-r0128.geom
index 1e3834d8..73e1ceea 100644
--- a/doc/examples/lcls-june-r0013-r0128.geom
+++ b/doc/examples/lcls-june-r0013-r0128.geom
@@ -10,6 +10,7 @@ n_panels = 2
0/clen = 64.78e-3
0/res = 13333.3 ; 75 micron pixel size
0/badrow_direction = y
+0/peak_sep = 50
; Lower panel (furthest from the beam)
1/min_x = 0
@@ -21,3 +22,4 @@ n_panels = 2
1/clen = 67.73e-3
1/res = 13333.3 ; 75 micron pixel size
1/badrow_direction = y
+1/peak_sep = 50
diff --git a/doc/examples/lcls-xpp-estimate.geom b/doc/examples/lcls-xpp-estimate.geom
index 01947102..8cef9ce9 100644
--- a/doc/examples/lcls-xpp-estimate.geom
+++ b/doc/examples/lcls-xpp-estimate.geom
@@ -9,3 +9,4 @@ n_panels = 1
0/clen = 0.08 ; 8 cm camera length
0/res = 9090 ; 110 micron pixel size
0/badrow_direction = x
+0/peak_sep = 4
diff --git a/doc/examples/simple.geom b/doc/examples/simple.geom
index 0c309c27..fe14a9d3 100644
--- a/doc/examples/simple.geom
+++ b/doc/examples/simple.geom
@@ -9,6 +9,7 @@ n_panels = 2
0/cy = 502.0
0/clen = 50.0e-3
0/res = 13333.3 ; 75 micron pixel size
+0/peak_sep = 50
; Lower panel
1/min_x = 0
@@ -19,3 +20,4 @@ n_panels = 2
1/cy = 522.0
1/clen = 50.0e-3
1/res = 13333.3 ; 75 micron pixel size
+1/peak_sep = 50
diff --git a/doc/geometry.txt b/doc/geometry.txt
index e24d24df..c195bb37 100644
--- a/doc/geometry.txt
+++ b/doc/geometry.txt
@@ -54,6 +54,9 @@ n_panels = 1
; indexing nor integrated and recorded in the stream.
0/no_index = false
+; The lower bound on true peak separation is about 50 pixels
+0/peak_sep = 50
+
See the "examples" folder for some examples.
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);