reader: a link to a file that is not there is not a dataset that exists

Every DECTRIS Eiger master links saturation_value, pixel_mask,
bit_depth_readout and serial_number into a companion <prefix>_meta.h5, and
that file is routinely not kept when a dataset is archived or deposited. The
existence test asked only whether the LINK was written, which it is, so every
optional-field guard in the reader answered yes and the read that followed
threw. A deposited Eiger 16M set could not be opened at all, over values the
reader was perfectly prepared to do without.

Exists() now asks the second question too - whether the object the link names
can be reached - so an orphaned link reads as absent and the fallbacks behind
it do their job.

The saturation value is then allowed to be missing outright, because on such a
file it is: neither the NXmx name nor the DECTRIS one is readable, and there is
no third place to look. Left unset, GetSaturationLimit() falls back to the
container's own overflow. That is the safe direction - it can only fail to call
a pixel saturated, where too LOW a value drops the whole reflection and
silently removes the strongest data - and the run says out loud that nothing
will be called saturated.

The set that could not be opened now processes to 2.17 A against a deposited
2.40 A, in the deposited space group, with a cell agreeing to 0.08%. Output is
byte-identical on datasets that already opened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFEJG6WBQv8th4UJFNe53N
(cherry picked from commit 0637979f6d95b446406ab70d1f3982841d195b36)
This commit is contained in:
2026-08-30 21:43:54 +02:00
parent fb18457e6f
commit 6ed4ea541e
4 changed files with 62 additions and 5 deletions
+10 -1
View File
@@ -1072,7 +1072,16 @@ std::string HDF5Object::GetString(const std::string &name, const std::string &de
bool HDF5Object::Exists(const std::string &name) const {
H5E_BEGIN_TRY {
return H5Lexists(GetID(), name.c_str(), H5P_DEFAULT) > 0;
// The LINK has to be there and the object it names has to be reachable. Those are two
// different questions for an external link, and every DECTRIS Eiger master asks the second
// one: it links saturation_value, pixel_mask, bit_depth_readout and serial_number into a
// companion <prefix>_meta.h5 that is routinely not kept when a dataset is archived or
// deposited. H5Lexists then says yes - the link is written in the master - and the read that
// follows throws, which turns every optional-field guard in the reader into a hard failure
// and refuses the whole file over a value it was prepared to do without.
if (H5Lexists(GetID(), name.c_str(), H5P_DEFAULT) <= 0)
return false;
return H5Oexists_by_name(GetID(), name.c_str(), H5P_DEFAULT) > 0;
} H5E_END_TRY;
return false;
}