aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/peakfinder8.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/peakfinder8.c')
-rw-r--r--libcrystfel/src/peakfinder8.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libcrystfel/src/peakfinder8.c b/libcrystfel/src/peakfinder8.c
index 417465df..f96750de 100644
--- a/libcrystfel/src/peakfinder8.c
+++ b/libcrystfel/src/peakfinder8.c
@@ -32,6 +32,7 @@
#include <config.h>
#endif
+#include <float.h>
#include <math.h>
#include <stdlib.h>
@@ -363,13 +364,15 @@ static void fill_radial_bins(float *data,
int curr_r;
float value;
- for ( iss = 0; iss<h ; iss++ ) {
- for ( ifs = 0; ifs<w ; ifs++ ) {
+ for ( iss=0; iss<h; iss++ ) {
+ for ( ifs=0; ifs<w; ifs++ ) {
pidx = iss * w + ifs;
if ( mask[pidx] != 0 ) {
curr_r = (int)rint(r_map[pidx]);
value = data[pidx];
- if ( value < rthreshold[curr_r ] && value>lthreshold[curr_r]) {
+ if ( value < rthreshold[curr_r]
+ && value > lthreshold[curr_r] )
+ {
roffset[curr_r] += value;
rsigma[curr_r] += (value * value);
rcount[curr_r] += 1;
@@ -397,8 +400,8 @@ static void compute_radial_stats(float *rthreshold,
if ( rcount[ri] == 0 ) {
roffset[ri] = 0;
rsigma[ri] = 0;
- rthreshold[ri] = 1e9;
- lthreshold[ri] = -1e9;
+ rthreshold[ri] = FLT_MAX;
+ lthreshold[ri] = FLT_MIN;
} else {
this_offset = roffset[ri] / rcount[ri];
this_sigma = rsigma[ri] / rcount[ri] - (this_offset * this_offset);
@@ -1064,6 +1067,7 @@ int peakfinder8(struct image *img, int max_n_peaks,
for ( i=0 ; i<rstats->n_rad_bins ; i++) {
rstats->rthreshold[i] = 1e9;
+ rstats->lthreshold[i] = -1e9;
}
for ( it_counter=0 ; it_counter<iterations ; it_counter++ ) {