diff --git a/reader/JFJochMarCCDReader.cpp b/reader/JFJochMarCCDReader.cpp index 5e3cdc902..5e517cf25 100644 --- a/reader/JFJochMarCCDReader.cpp +++ b/reader/JFJochMarCCDReader.cpp @@ -91,11 +91,20 @@ void JFJochMarCCDReader::ReadFiles(const std::string &path) { } dataset_->experiment.IncidentEnergy_keV(WVL_1A_IN_KEV / static_cast(header0_.wavelength_A)); - dataset_->experiment.FrameTime( - std::chrono::duration_cast( - std::chrono::duration(header0_.exposure_s)), - std::chrono::duration_cast( - std::chrono::duration(header0_.exposure_s))); + // Only when the header states a sane one. The exposure field is not always filled in: one + // deposited sweep carries -2093438692 there, which is not a time at all, and passing it on + // refuses the whole dataset over a number that affects no geometry and no result. A day is a + // generous upper bound for a single frame. + if (header0_.exposure_s > 0.0 && header0_.exposure_s < 86400.0) + dataset_->experiment.FrameTime( + std::chrono::duration_cast( + std::chrono::duration(header0_.exposure_s)), + std::chrono::duration_cast( + std::chrono::duration(header0_.exposure_s))); + else + Logger("MarCCDReader").Warning("{} states an implausible exposure time ({} s); the " + "default frame time is kept. Nothing in the geometry or the " + "merge depends on it.", files_[0], header0_.exposure_s); // The rotation angle of every image, from its own header. Reading one costs a 4 kB read, so on // a sweep of several thousand frames this is worth spreading over the cores, as the CBF path diff --git a/reader/JFJochSMVReader.cpp b/reader/JFJochSMVReader.cpp index 44f8def96..51e0a5d6c 100644 --- a/reader/JFJochSMVReader.cpp +++ b/reader/JFJochSMVReader.cpp @@ -92,11 +92,20 @@ void JFJochSMVReader::ReadFiles(const std::string &path) { } dataset_->experiment.IncidentEnergy_keV(WVL_1A_IN_KEV / static_cast(header0_.wavelength_A)); - dataset_->experiment.FrameTime( - std::chrono::duration_cast( - std::chrono::duration(header0_.exposure_s)), - std::chrono::duration_cast( - std::chrono::duration(header0_.exposure_s))); + // Only when the header states a sane one. The exposure field is not always filled in: one + // deposited sweep carries -2093438692 there, which is not a time at all, and passing it on + // refuses the whole dataset over a number that affects no geometry and no result. A day is a + // generous upper bound for a single frame. + if (header0_.exposure_s > 0.0 && header0_.exposure_s < 86400.0) + dataset_->experiment.FrameTime( + std::chrono::duration_cast( + std::chrono::duration(header0_.exposure_s)), + std::chrono::duration_cast( + std::chrono::duration(header0_.exposure_s))); + else + Logger("SMVReader").Warning("{} states an implausible exposure time ({} s); the " + "default frame time is kept. Nothing in the geometry or the " + "merge depends on it.", files_[0], header0_.exposure_s); // The rotation angle of every image, from its own header. Reading one costs a 4 kB read, so on // a sweep of several thousand frames this is worth spreading over the cores, as the CBF path