aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-02-27 12:12:04 +0100
committerThomas White <taw@bitwiz.org.uk>2010-02-27 12:12:04 +0100
commit732af8778a49cacbfffe3c451125be84d7f86ee2 (patch)
treec68b92d1c18c07c92e1318bc5d880feb6ba9f7a8 /src
parent6170796e45768ed01b93304c1e363ef4a2b5a8fe (diff)
More tests for odd situations
Diffstat (limited to 'src')
-rw-r--r--src/detector.c12
-rw-r--r--src/diffraction-gpu.c3
-rw-r--r--src/pattern_sim.c4
3 files changed, 12 insertions, 7 deletions
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<image.width; x++ ) {
for ( y=0; y<image.height; y++ ) {
powder[x+w*y] += (double)image.data[x+w*y];
- if ( image.data[x+w*y] < 0 ) {
- STATUS("Negative! %f %i %i\n",
- image.data[x+w*y], x, y);
- }
}
}