diff options
author | Thomas White <taw@physics.org> | 2010-03-29 16:17:17 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-03-29 16:17:17 +0200 |
commit | 86c55dc5590ed44e61d4fa95eec2273cdf13623f (patch) | |
tree | 0a64636ac7450e32d07c2f8b83b9d3ba41f91d3e /src/peaks.c | |
parent | 2f515b4fe79633279baf989191fc3c1e04f56175 (diff) |
integrate_peak(): Handle the situation where there is no intensity
Diffstat (limited to 'src/peaks.c')
-rw-r--r-- | src/peaks.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/peaks.c b/src/peaks.c index 02ad6492..cf0b4ae0 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -160,9 +160,16 @@ static void integrate_peak(struct image *image, int xp, int yp, } } - *xc = (float)xct / total; - *yc = (float)yct / total; - *intensity = total; + /* The centroid is excitingly undefined if there is no intensity */ + if ( total != 0 ) { + *xc = (float)xct / total; + *yc = (float)yct / total; + *intensity = total; + } else { + *xc = (float)xp; + *yc = (float)yp; + *intensity = 0; + } } |