diff options
author | Thomas White <taw@physics.org> | 2010-01-08 14:55:13 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-01-08 14:55:13 +0100 |
commit | a374cdb2396659d711f85851cb0904ccf7c9731d (patch) | |
tree | 5b63c80820293aa5b25c805352dc2c928a5f9a30 | |
parent | ed795ee42e10c2fc3176d960a5c8b8ea29d3ea8a (diff) |
Small fixes
-rw-r--r-- | src/hdf5-file.c | 4 | ||||
-rw-r--r-- | src/render.c | 2 | ||||
-rw-r--r-- | src/utils.c | 6 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c index b1f78b3b..0e9453cf 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -246,8 +246,8 @@ int hdf5_read(struct hdfile *f, struct image *image) image->width = f->ny; /* FIXME: The following are basically made up... */ - image->x_centre = image->width/2; - image->y_centre = image->height/2; + image->x_centre = image->width/2 - 19; + image->y_centre = image->height/2 - 35; image->lambda = ph_en_to_lambda(eV_to_J(1793.0)); image->fmode = FORMULATION_CLEN; image->camera_len = 75.0e-3; /* 75 mm camera length */ diff --git a/src/render.c b/src/render.c index e2412e96..4de441f3 100644 --- a/src/render.c +++ b/src/render.c @@ -19,6 +19,7 @@ #include <stdint.h> #include "hdf5-file.h" +#include "render.h" /* Set to 1 to measure mean intensity in a rectangle */ #define MEASURE_INT 0 @@ -80,6 +81,7 @@ if ( val > max ) p = 0.0; \ r = 255.0*p; g = 255.0*p; b = 255.0*p; + /* NB This function is shared between render_get_image() and * render_get_colour_scale() */ static void render_free_data(guchar *data, gpointer p) diff --git a/src/utils.c b/src/utils.c index 1f72c558..cad7ff1b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -102,11 +102,11 @@ int poisson_noise(double expected) int k = 0; double p = 1.0; - L = exp(-expected); - /* For large values of the mean, we get big problems with arithmetic. * In such cases, fall back on a Gaussian with the right variance. */ - if ( !isnormal(L) ) return fake_poisson_noise(expected); + if ( L > 100.0 ) return fake_poisson_noise(expected); + + L = exp(-expected); do { |