From b5000a6e66dbc7a0c01f06add3656044aeb8b894 Mon Sep 17 00:00:00 2001 From: Nadia Zatsepin Date: Sat, 20 Oct 2012 06:34:37 -0700 Subject: Check for nonsensical value of lambda (too high) in HDF5 --- src/im-sandbox.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 1a344125..98278571 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -248,8 +248,27 @@ static void process_image(const struct index_args *iargs, return; } } + + if ( image.lambda > 1000 ) { + if ( beam != NULL ) { + ERROR("Nonsensical wavelength in HDF5." + "Using nominal photon energy from beam file: %.2f eV\n", + beam->photon_energy); + image.lambda = ph_en_to_lambda( + eV_to_J(beam->photon_energy)); + } else { + ERROR("No wavelength in file, so you need to give " + "a beam parameters file with -b.\n"); + hdfile_close(hdfile); + free_detector_geometry(image.det); + return; + } + } + fill_in_values(image.det, hdfile); + + if ( config_cmfilter ) { filter_cm(&image); } -- cgit v1.2.3