aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-27 16:55:02 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:51 +0100
commitd9dd0cefca108ec5dc7f08aad4be9b5c2ded4389 (patch)
treee5c2e5b221d164fd1150d84f23dfc4b5f8e4dde7 /src
parent6ef48812938a69ca745e97d4dc9c1f19e3d0a08c (diff)
indexamajig: Make saturation correction optional and default to off
Diffstat (limited to 'src')
-rw-r--r--src/calibrate_detector.c2
-rw-r--r--src/hdf5-file.c4
-rw-r--r--src/hdf5-file.h2
-rw-r--r--src/indexamajig.c8
-rw-r--r--src/powder_plot.c2
-rw-r--r--src/render.c6
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; x<image.width; x++ ) {
for ( y=0; y<image.height; y++ ) {
diff --git a/src/render.c b/src/render.c
index efbbfcb9..faad77dc 100644
--- a/src/render.c
+++ b/src/render.c
@@ -77,7 +77,7 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max)
image->features = 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);