From 762ed2c39f48e226ddeab459e9b00dbc20b9eaef Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 23 Jan 2014 15:30:29 +0100 Subject: pattern_sim: Add --background --- src/pattern_sim.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pattern_sim.c b/src/pattern_sim.c index d852d986..08fc75dd 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -89,6 +89,7 @@ static void show_help(const char *s) " --no-noise Do not calculate Poisson noise.\n" " -s, --sample-spectrum= Use N samples from spectrum. Default 3.\n" " -x, --spectrum= Type of spectrum to simulate.\n" +" --background= Add N photons of Poisson background (default 0).\n" ); } @@ -249,6 +250,7 @@ int main(int argc, char *argv[]) SymOpList *sym; int nsamples = 3; gsl_rng *rng; + int background = 0; /* Long options */ const struct option longopts[] = { @@ -273,6 +275,7 @@ int main(int argc, char *argv[]) {"gpu-dev", 1, NULL, 2}, {"min-size", 1, NULL, 3}, {"max-size", 1, NULL, 4}, + {"background", 1, NULL, 5}, {0, 0, NULL, 0} }; @@ -364,6 +367,14 @@ int main(int argc, char *argv[]) random_size++; break; + case 5 : + background = strtol(optarg, &rval, 10); + if ( *rval != '\0' ) { + ERROR("Invalid background level.\n"); + return 1; + } + break; + case 0 : break; @@ -622,7 +633,7 @@ int main(int argc, char *argv[]) goto skip; } - record_image(&image, !config_nonoise, rng); + record_image(&image, !config_nonoise, background, rng); if ( powder_fn != NULL ) { -- cgit v1.2.3