From d9dd0cefca108ec5dc7f08aad4be9b5c2ded4389 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 27 Jun 2010 16:55:02 +0200 Subject: indexamajig: Make saturation correction optional and default to off --- src/calibrate_detector.c | 2 +- src/hdf5-file.c | 4 ++-- src/hdf5-file.h | 2 +- src/indexamajig.c | 8 +++++++- src/powder_plot.c | 2 +- src/render.c | 6 +++--- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/calibrate_detector.c b/src/calibrate_detector.c index 044cc93d..70b70c71 100644 --- a/src/calibrate_detector.c +++ b/src/calibrate_detector.c @@ -175,7 +175,7 @@ static void *process_image(void *pargsv) return NULL; } - hdf5_read(hdfile, &image); + hdf5_read(hdfile, &image, 1); if ( pargs->config_cmfilter ) { filter_cm(&image); diff --git a/src/hdf5-file.c b/src/hdf5-file.c index a5fc7d26..71ab0354 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -326,7 +326,7 @@ static void debodge_saturation(struct hdfile *f, struct image *image) } -int hdf5_read(struct hdfile *f, struct image *image) +int hdf5_read(struct hdfile *f, struct image *image, int satcorr) { herr_t r; float *buf; @@ -379,7 +379,7 @@ int hdf5_read(struct hdfile *f, struct image *image) image->f0_available = 1; } - debodge_saturation(f, image); + if ( satcorr ) debodge_saturation(f, image); return 0; } diff --git a/src/hdf5-file.h b/src/hdf5-file.h index 455628bd..7e662799 100644 --- a/src/hdf5-file.h +++ b/src/hdf5-file.h @@ -27,7 +27,7 @@ struct hdfile; extern int hdf5_write(const char *filename, const void *data, int width, int height, int type); -extern int hdf5_read(struct hdfile *f, struct image *image); +extern int hdf5_read(struct hdfile *f, struct image *image, int satcorr); extern struct hdfile *hdfile_open(const char *filename); extern int hdfile_set_image(struct hdfile *f, const char *path); diff --git a/src/indexamajig.c b/src/indexamajig.c index 89003b34..1e005ceb 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -59,6 +59,7 @@ struct process_args int config_nomatch; int config_unpolar; int config_sanity; + int config_satcorr; struct detector *det; IndexingMethod indm; const double *intensities; @@ -126,6 +127,8 @@ static void show_help(const char *s) " --unpolarized Don't correct for the polarisation of the X-rays.\n" " --check-sanity Check that indexed locations approximately correspond\n" " with detected peaks.\n" +" --sat-corr Correct values of saturated peaks using a table\n" +" included in the HDF5 file.\n" "\n\nOptions for greater performance or verbosity:\n\n" " --verbose Be verbose about indexing.\n" " --gpu Use the GPU to speed up the simulation.\n" @@ -288,7 +291,7 @@ static void *process_image(void *pargsv) return result; } - hdf5_read(hdfile, &image); + hdf5_read(hdfile, &image, pargs->config_satcorr); if ( config_cmfilter ) { filter_cm(&image); @@ -409,6 +412,7 @@ int main(int argc, char *argv[]) int config_alternate = 0; int config_unpolar = 0; int config_sanity = 0; + int config_satcorr = 0; struct detector *det; char *geometry = NULL; IndexingMethod indm; @@ -449,6 +453,7 @@ int main(int argc, char *argv[]) {"prefix", 1, NULL, 'x'}, {"unpolarized", 0, &config_unpolar, 1}, {"check-sanity", 0, &config_sanity, 1}, + {"sat-corr", 0, &config_satcorr, 1}, {0, 0, NULL, 0} }; @@ -609,6 +614,7 @@ int main(int argc, char *argv[]) pargs->config_nomatch = config_nomatch; pargs->config_unpolar = config_unpolar; pargs->config_sanity = config_sanity; + pargs->config_satcorr = config_satcorr; pargs->cell = cell; pargs->det = det; pargs->indm = indm; diff --git a/src/powder_plot.c b/src/powder_plot.c index f0d30553..f721d02e 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) hdfile = hdfile_open(filename); hdfile_set_image(hdfile, "/data/data"); - hdf5_read(hdfile, &image); + hdf5_read(hdfile, &image, 1); for ( x=0; xfeatures = NULL; image->data = NULL; - hdf5_read(dw->hdfile, image); + hdf5_read(dw->hdfile, image, 1); dw->image_dirty = 0; if ( dw->cmfilter ) filter_cm(image); if ( dw->noisefilter ) filter_noise(image, NULL); @@ -482,7 +482,7 @@ int render_tiff_fp(DisplayWindow *dw, const char *filename) if ( image == NULL ) return 1; image->features = NULL; image->data = NULL; - hdf5_read(dw->hdfile, image); + hdf5_read(dw->hdfile, image, 1); if ( dw->cmfilter ) filter_cm(image); if ( dw->noisefilter ) filter_noise(image, NULL); @@ -527,7 +527,7 @@ int render_tiff_int16(DisplayWindow *dw, const char *filename) if ( image == NULL ) return 1; image->features = NULL; image->data = NULL; - hdf5_read(dw->hdfile, image); + hdf5_read(dw->hdfile, image, 1); if ( dw->cmfilter ) filter_cm(image); if ( dw->noisefilter ) filter_noise(image, NULL); -- cgit v1.2.3