aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-08-13 17:16:46 +0200
committerThomas White <taw@physics.org>2014-08-13 17:16:46 +0200
commitd4a727a2ef2b07bbea24452001209fa42d851f64 (patch)
treecb86be2e394879aee4b1fb55d33394e5049d108b /libcrystfel/src
parentea852d0ab4944a5b63f764207c742b6791a9154c (diff)
Remove old bad region tests and use dp instead of data for integration of peaks
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/peaks.c48
1 files changed, 6 insertions, 42 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 15f37a4e..b6b5b957 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -269,8 +269,6 @@ static int integrate_peak(struct image *image, int cfs, int css,
for ( dss=-ir_out; dss<=+ir_out; dss++ ) {
double val;
- uint16_t flags;
- int idx;
/* Restrict to annulus */
if ( dfs*dfs + dss*dss > out_lim_sq ) continue;
@@ -285,23 +283,7 @@ static int integrate_peak(struct image *image, int cfs, int css,
return 14;
}
- idx = dfs+cfs+image->width*(dss+css);
-
- /* Veto this peak if we tried to integrate in a bad region */
- if ( image->flags != NULL ) {
-
- flags = image->flags[idx];
-
- /* It must have all the "good" bits to be valid */
- if ( !((flags & image->det->mask_good)
- == image->det->mask_good) ) return 5;
-
- /* If it has any of the "bad" bits, reject */
- if ( flags & image->det->mask_bad ) return 6;
-
- }
-
- val = image->data[idx];
+ val = image->dp[pn][p_cfs+dfs + p->w*(p_css+dss)];
/* Check if peak contains saturation in bg region */
if ( (saturated != NULL) && (val > p->max_adu) ) *saturated = 1;
@@ -325,8 +307,6 @@ static int integrate_peak(struct image *image, int cfs, int css,
for ( dss=-ir_inn; dss<=+ir_inn; dss++ ) {
double val;
- uint16_t flags;
- int idx;
/* Inner mask radius */
if ( dfs*dfs + dss*dss > lim_sq ) continue;
@@ -336,33 +316,17 @@ static int integrate_peak(struct image *image, int cfs, int css,
|| (p_cfs+dfs < 0 ) || (p_css+dss < 0) ) return 8;
/* Wandered into a bad region? */
- if ( in_bad_region(image->det, p->min_fs+p_cfs+dfs,
- p->min_ss+p_css+dss) )
- {
- return 13;
- }
-
- idx = dfs+cfs+image->width*(dss+css);
-
- /* Veto this peak if we tried to integrate in a bad region */
- if ( image->flags != NULL ) {
-
- flags = image->flags[idx];
-
- /* It must have all the "good" bits to be valid */
- if ( !((flags & image->det->mask_good)
- == image->det->mask_good) ) return 9;
-
- /* If it has any of the "bad" bits, reject */
- if ( flags & image->det->mask_bad ) return 10;
-
+ if ( image->bad[pn][p_cfs+dfs + p->w*(p_css+dss)] ) {
+ return 15;
}
- val = image->data[idx] - bg_mean;
+ val = image->dp[pn][p_cfs+dfs + p->w*(p_css+dss)];
/* Check if peak contains saturation */
if ( (saturated != NULL) && (val > p->max_adu) ) *saturated = 1;
+ val -= bg_mean;
+
pk_counts++;
pk_total += val;