aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c5
-rw-r--r--src/pattern_sim.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 1b460d4e..706dfa7b 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -235,6 +235,11 @@ static void process_image(const struct index_args *iargs,
return;
}
+ if (beam->photon_energy == 0) { // read from existing hdf5
+ fill_in_beamParam(beam, hdfile);
+ }
+ image.lambda = ph_en_to_lambda(eV_to_J(beam->photon_energy));
+
if ( image.lambda < 0.0 ) {
if ( beam != NULL ) {
ERROR("Using nominal photon energy of %.2f eV\n",
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 06a1f5e5..17aa8030 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -498,7 +498,12 @@ int main(int argc, char *argv[])
/* Define image parameters */
image.width = image.det->max_fs + 1;
image.height = image.det->max_ss + 1;
- image.lambda = ph_en_to_lambda(eV_to_J(image.beam->photon_energy));
+ if (image.beam->photon_energy == 0) {
+ ERROR("Invalid photon_energy format in beam file\n")
+ return 1;
+ } else {
+ image.lambda = ph_en_to_lambda(eV_to_J(image.beam->photon_energy));
+ }
image.bw = image.beam->bandwidth;
image.div = image.beam->divergence;