marCCD/SMV: keep the default frame time when the header's exposure is not a time

One deposited marCCD sweep carries -2093438692 in its exposure field. Passed on as
written that is a negative count time, DiffractionExperiment refuses it, and the
whole dataset fails to open - over a number that feeds no geometry, no indexing and
no merge. With the field ignored when it is implausible, that sweep processes and
matches its deposition: P2_12_12_1, cell within 0.12%, and 1.375 A against a
deposited 2.0.

Neither format guarantees the field. The same guard is in the SMV reader, whose TIME
key is no better attested, and both say what they did rather than passing over it
silently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
leonarski_fandClaude Opus 5 committed 2026-09-17 08:34:49 +02:00
1 parent 8288d4cbe6
commit 39a98692e2
2 files changed
+28 -10

No files matched your search

+14 -5
View File
@@ -91,11 +91,20 @@ void JFJochMarCCDReader::ReadFiles(const std::string &path) {
}
dataset_->experiment.IncidentEnergy_keV(WVL_1A_IN_KEV / static_cast<float>(header0_.wavelength_A));
dataset_->experiment.FrameTime(
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(header0_.exposure_s)),
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(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::nanoseconds>(
std::chrono::duration<double>(header0_.exposure_s)),
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(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
+14 -5
View File
@@ -92,11 +92,20 @@ void JFJochSMVReader::ReadFiles(const std::string &path) {
}
dataset_->experiment.IncidentEnergy_keV(WVL_1A_IN_KEV / static_cast<float>(header0_.wavelength_A));
dataset_->experiment.FrameTime(
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(header0_.exposure_s)),
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(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::nanoseconds>(
std::chrono::duration<double>(header0_.exposure_s)),
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(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