aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-04 10:48:43 +0100
committerThomas White <taw@physics.org>2009-12-04 10:48:43 +0100
commit6a378dfb14c8f3d539e93b01c8c5dda77350070a (patch)
tree10b3c1663d458b9c784595b69976ab01a0f4455f
parent903d944cb22d818096e8bba23274a18902396e4c (diff)
Add --no-bloom option
-rw-r--r--src/detector.c6
-rw-r--r--src/detector.h3
-rw-r--r--src/pattern_sim.c13
3 files changed, 17 insertions, 5 deletions
diff --git a/src/detector.c b/src/detector.c
index de1efc2b..5b12b007 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -142,14 +142,14 @@ static uint16_t *bloom(int *hdr_in, int width, int height)
}
-void record_image(struct image *image, int do_water, int do_poisson)
+void record_image(struct image *image, int do_water, int do_poisson,
+ int do_bloom)
{
int x, y;
double total_energy, energy_density;
double ph_per_e;
double pix_area, Lsq;
double area;
- const int do_bloom = 1;
/* How many photons are scattered per electron? */
area = M_PI*pow(BEAM_RADIUS, 2.0);
@@ -209,7 +209,7 @@ void record_image(struct image *image, int do_water, int do_poisson)
image->hdr[x + image->width*y] = counts;
}
- progress_bar(x, image->width-1, "Adding water and noise");
+ progress_bar(x, image->width-1, "Post-processing");
}
if ( do_bloom ) {
diff --git a/src/detector.h b/src/detector.h
index f4c6f562..7b9d567c 100644
--- a/src/detector.h
+++ b/src/detector.h
@@ -18,6 +18,7 @@
#include "image.h"
-extern void record_image(struct image *image, int do_water, int do_poisson);
+extern void record_image(struct image *image, int do_water, int do_poisson,
+ int do_bloom);
#endif /* DETECTOR_H */
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 0c5350a8..6755f53e 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -43,8 +43,16 @@ static void show_help(const char *s)
" --no-images Do not output any HDF5 files.\n"
" -r, --random-orientation Use a randomly generated orientation\n"
" (a new orientation will be used for each image).\n"
+"\n"
+"By default, the simulation aims to be as accurate as possible. For greater\n"
+"speed, or for testing, you can choose to disable certain things using the\n"
+"following options.\n"
+"\n"
" --no-water Do not simulate water background.\n"
" --no-noise Do not calculate Poisson noise.\n"
+" --no-bloom Do not calculate CCD bloom (intensities which are\n"
+" above the recordable range will be clamped to\n"
+" the maximum allowable value).\n"
);
}
@@ -144,6 +152,7 @@ int main(int argc, char *argv[])
int config_noimages = 0;
int config_nowater = 0;
int config_nonoise = 0;
+ int config_nobloom = 0;
int number = 1; /* Index for the current image */
int n_images = 1; /* Generate one image by default */
int done = 0;
@@ -158,6 +167,7 @@ int main(int argc, char *argv[])
{"no-images", 0, &config_noimages, 1},
{"no-water", 0, &config_nowater, 1},
{"no-noise", 0, &config_nonoise, 1},
+ {"no-bloom", 0, &config_nobloom, 1},
{0, 0, NULL, 0}
};
@@ -233,7 +243,8 @@ int main(int argc, char *argv[])
image.hdr = NULL;
get_diffraction(&image);
- record_image(&image, !config_nowater, !config_nonoise);
+ record_image(&image, !config_nowater, !config_nonoise,
+ !config_nobloom);
if ( config_nearbragg ) {
output_intensities(&image);