diff options
author | Thomas White <taw@physics.org> | 2011-06-01 18:24:30 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:27 +0100 |
commit | acf2a729772050849cff0f2e1bba8bfa64096a05 (patch) | |
tree | 8a30e38af7f8ddd6f50a26a2f6d500fa78401c11 /src | |
parent | e0c2ff59af7421d2ef10ffc02978ff0964b5daff (diff) |
Tidy up peak integration and update unit test
Diffstat (limited to 'src')
-rw-r--r-- | src/peaks.c | 24 |
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); + } } } |