aboutsummaryrefslogtreecommitdiff
path: root/src/pattern_sim.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-01-23 15:30:29 +0100
committerThomas White <taw@physics.org>2014-01-23 16:07:37 +0100
commit762ed2c39f48e226ddeab459e9b00dbc20b9eaef (patch)
tree5dcc70e7736610145b931e9f6fbce1d6f6dc708a /src/pattern_sim.c
parent3776f8cbfd41798a1591a1a5a337fffef3322bd5 (diff)
pattern_sim: Add --background
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r--src/pattern_sim.c13
1 files changed, 12 insertions, 1 deletions
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=<N> Use N samples from spectrum. Default 3.\n"
" -x, --spectrum=<type> Type of spectrum to simulate.\n"
+" --background=<N> 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 ) {