diff options
author | Alexandra Tolstikova <alexandra.tolstikova@desy.de> | 2017-11-16 13:46:23 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-09-10 15:01:10 +0200 |
commit | 17aec9c77e9b75510e43b0fb073df75f66849761 (patch) | |
tree | 0a9e0252b5c81ad6ad451f513a9a3834b582e10a /src/pattern_sim.c | |
parent | ec9f2c41c1f21968412eb4b7f57fda69ed6e37b1 (diff) |
pattern_sim: read spectrum from file
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r-- | src/pattern_sim.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 6c9eb880..d47c4b60 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -368,6 +368,7 @@ int main(int argc, char *argv[]) char *outfile = NULL; char *geometry = NULL; char *spectrum_str = NULL; + char *spectrum_fn = NULL; GradientMethod grad; SpectrumType spectrum_type; int ndone = 0; /* Number of simulations done (images or not) */ @@ -429,6 +430,7 @@ int main(int argc, char *argv[]) {"photon-energy", 1, NULL, 9}, {"nphotons", 1, NULL, 10}, {"beam-radius", 1, NULL, 11}, + {"spectrum-file", 1, NULL, 12}, {0, 0, NULL, 0} }; @@ -590,6 +592,9 @@ int main(int argc, char *argv[]) } break; + case 12 : + spectrum_fn = strdup(optarg); + break; case 0 : break; @@ -695,6 +700,8 @@ int main(int argc, char *argv[]) strcasecmp(spectrum_str, "twocolours") == 0 || strcasecmp(spectrum_str, "twocolors") == 0) { spectrum_type = SPECTRUM_TWOCOLOUR; + } else if ( strcasecmp(spectrum_str, "fromfile") == 0) { + spectrum_type = SPECTRUM_FROMFILE; } else { ERROR("Unrecognised spectrum type '%s'\n", spectrum_str); return 1; @@ -855,6 +862,11 @@ int main(int argc, char *argv[]) STATUS(" X-ray spectrum: two colour, " "separation %.5f %%\n", image.bw*100.0); break; + + case SPECTRUM_FROMFILE: + STATUS(" X-ray spectrum: from %s\n", + spectrum_fn); + break; } if ( random_size ) { STATUS(" Crystal size: random, between " @@ -977,6 +989,11 @@ int main(int argc, char *argv[]) image.spectrum = generate_twocolour(&image); break; + case SPECTRUM_FROMFILE : + image.spectrum = generate_spectrum_fromfile(&image, + spectrum_fn); + break; + } cell_get_parameters(cell, &a, &b, &c, &d, &d, &d); |