aboutsummaryrefslogtreecommitdiff
path: root/src/peaks.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-01 18:24:30 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:27 +0100
commitacf2a729772050849cff0f2e1bba8bfa64096a05 (patch)
tree8a30e38af7f8ddd6f50a26a2f6d500fa78401c11 /src/peaks.c
parente0c2ff59af7421d2ef10ffc02978ff0964b5daff (diff)
Tidy up peak integration and update unit test
Diffstat (limited to 'src/peaks.c')
-rw-r--r--src/peaks.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 4b87ba08..936601a3 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -222,20 +222,22 @@ int integrate_peak(struct image *image, int cfs, int css,
if ( val > max ) max = val;
- /* Inner mask */
+ /* If outside inner mask, estimate noise from this region */
if ( fs*fs + ss*ss > lim_sq ) {
- /* Estimate noise from this region */
- noise += val; //fabs(val);
+
+ /* Noise */
+ noise += val;
noise_counts++;
- /* Estimate the standard deviation of the noise */
- noise_meansq += fabs(val)*fabs(val) ;
- continue;
- }
+ noise_meansq += pow(val, 2.0);
- pixel_counts ++;
- total += val;
- fsct += val*(cfs+fs);
- ssct += val*(css+ss);
+ } else {
+
+ /* Peak */
+ pixel_counts++;
+ total += val;
+ fsct += val*(cfs+fs);
+ ssct += val*(css+ss);
+ }
}
}