From acf2a729772050849cff0f2e1bba8bfa64096a05 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 1 Jun 2011 18:24:30 +0200 Subject: Tidy up peak integration and update unit test --- src/peaks.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/peaks.c') 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); + } } } -- cgit v1.2.3