aboutsummaryrefslogtreecommitdiff
path: root/src/pattern_sim.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-30 14:23:39 +0100
committerThomas White <taw@physics.org>2009-11-30 14:23:39 +0100
commit5739d122831f5726b67cbfa6427ab0a6dc092798 (patch)
treefb132a0de1afd27a5d4bdd48ed6dbcff66beb902 /src/pattern_sim.c
parentf69a0db1ab73f30ba142625a4f2e38f750481ec2 (diff)
Add --no-images option (and clean up --help)
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r--src/pattern_sim.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index e3c5ec8a..bdca6462 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -30,17 +30,20 @@
static void show_help(const char *s)
{
- printf("Syntax: %s\n\n", s);
+ printf("Syntax: %s [options]\n\n", s);
printf(
"Simulate diffraction patterns from small crystals probed with femosecond\n"
"pulses of X-rays from a free electron laser.\n"
"\n"
-" -h, --help Display this help message\n"
-" --simulation-details Show technical details of the simulation\n"
-" --near-bragg Output h,k,l,I near Bragg conditions\n"
+" -h, --help Display this help message.\n"
+" --simulation-details Show technical details of the simulation.\n"
+"\n"
+" --near-bragg Output h,k,l,I near Bragg conditions.\n"
+" -n, --number=<N> Generate N images. Default 1.\n"
+" --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, --number=<N> Generate N images. Default 1\n");
+" (a new orientation will be used for each image).\n"
+);
}
@@ -133,10 +136,10 @@ int main(int argc, char *argv[])
{
int c;
struct image image;
- char filename[1024];
int config_simdetails = 0;
int config_nearbragg = 0;
int config_randomquat = 0;
+ int config_noimages = 0;
int number = 1; /* Index for the current image */
int n_images = 1; /* Generate one image by default */
int done = 0;
@@ -148,6 +151,7 @@ int main(int argc, char *argv[])
{"near-bragg", 0, &config_nearbragg, 1},
{"random-orientation", 0, NULL, 'r'},
{"number", 1, NULL, 'n'},
+ {"no-images", 0, &config_noimages, 1},
{0, 0, NULL, 0}
};
@@ -229,11 +233,18 @@ int main(int argc, char *argv[])
output_intensities(&image);
}
- snprintf(filename, 1023, "results/sim-%i.h5", number);
- number++;
+ if ( !config_noimages ) {
+
+ char filename[1024];
+
+ snprintf(filename, 1023, "results/sim-%i.h5", number);
+ number++;
- /* Write the output file */
- hdf5_write(filename, image.data, image.width, image.height);
+ /* Write the output file */
+ hdf5_write(filename, image.data,
+ image.width, image.height);
+
+ }
/* Clean up */
free(image.data);