diff options
author | Thomas White <taw@physics.org> | 2014-11-14 15:47:33 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-11-14 15:47:33 +0100 |
commit | e0a717ebe6981cd14f268056bdcdc7ba53dfe029 (patch) | |
tree | 1564a1a9b360a3f888c360950f5f178f7c9e6648 /src/pattern_sim.c | |
parent | f98c55524c74647ac999746929b8206f1ab178c0 (diff) |
Allow geometry files to not contain photon_energy
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r-- | src/pattern_sim.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c index af8fd4a4..fe30ae4c 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -270,6 +270,7 @@ int main(int argc, char *argv[]) double beam_radius = 1e-6; /* metres */ double bandwidth = 0.01; double photon_energy = 9000.0; + struct beam_params beam; /* Long options */ const struct option longopts[] = { @@ -537,12 +538,18 @@ int main(int argc, char *argv[]) ERROR("You need to specify a geometry file with --geometry\n"); return 1; } - image.det = get_detector_geometry(geometry, NULL); + image.det = get_detector_geometry(geometry, &beam); if ( image.det == NULL ) { ERROR("Failed to read detector geometry from '%s'\n", geometry); return 1; } free(geometry); + if ( (beam.photon_energy > 0.0) && (beam.photon_energy_from == NULL) ) { + ERROR("WARNING: An explicit photon energy was found in the " + "geometry file. It will be ignored!\n"); + ERROR("The value given on the command line " + "(with --photon-energy) will be used instead.\n"); + } if ( spectrum_str == NULL ) { STATUS("You didn't specify a spectrum type, so" |