From 732af8778a49cacbfffe3c451125be84d7f86ee2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 27 Feb 2010 12:12:04 +0100 Subject: More tests for odd situations --- src/detector.c | 12 +++++++++--- src/diffraction-gpu.c | 3 +++ src/pattern_sim.c | 4 ---- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/detector.c b/src/detector.c index f66ad525..92094639 100644 --- a/src/detector.c +++ b/src/detector.c @@ -85,6 +85,12 @@ void record_image(struct image *image, int do_poisson) if ( isinf(intensity) ) { ERROR("Infinity at %i,%i\n", x, y); } + if ( intensity < 0.0 ) { + ERROR("Infinity at %i,%i\n", x, y); + } + if ( isnan(intensity) ) { + ERROR("NaN at %i,%i\n", x, y); + } p = find_panel(&image->det, x, y); @@ -107,15 +113,15 @@ void record_image(struct image *image, int do_poisson) } else { cf = intensity * ph_per_e * sa * DQE; counts = rint(cf); - if ( counts < 0.0 ) { - ERROR("Negative at %i,%i %f\n", x, y, counts); - } } image->data[x + image->width*y] = counts * DETECTOR_GAIN; if ( isinf(image->data[x+image->width*y]) ) { ERROR("Processed infinity at %i,%i\n", x, y); } + if ( isnan(image->data[x+image->width*y]) ) { + ERROR("Processed NaN at %i,%i\n", x, y); + } if ( image->data[x+image->width*y] < 0.0 ) { ERROR("Processed negative at %i,%i %f\n", x, y, counts); } diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c index 851ed70c..69d21912 100644 --- a/src/diffraction-gpu.c +++ b/src/diffraction-gpu.c @@ -245,6 +245,9 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image, if ( val < 0.0 ) { ERROR("Extracting negative at %i,%i\n", x, y); } + if ( isnan(val) ) { + ERROR("Extracting NaN at %i,%i\n", x, y); + } tt = tt_ptr[x + image->width*y]; image->data[x + image->width*y] = val; diff --git a/src/pattern_sim.c b/src/pattern_sim.c index a29a8f0e..9542e494 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -307,10 +307,6 @@ int main(int argc, char *argv[]) for ( x=0; x