Tell a Smargon head position from the spindle by equipment_component

The reader recognised chi and phi by name. phi is an ordinary spindle name in MX, so a file whose
rotation axis is called phi had it read back as a head position as well as the spindle - and writing
that experiment out again threw, because the sample chain then tried to create phi twice. In the
other direction a still with a head position had chi, its alphabetically first stationary axis,
adopted as the goniometer.

Both are now settled by the file: the axes jfjoch writes for a Smargon carry
equipment_component="smargon", the reader takes a head position only from a tagged axis, and skips
tagged axes when looking for the spindle. NXmx defines equipment_component as an identifier of the
component of the equipment a transformation belongs to, which is what this is; there is no
"equipment" attribute in NeXus at all.

Adds HDF5Object::AttrExists, since the tag is absent on every file from anywhere else.

The two tests assert on the written file - the axis length and the attribute - because the reader
cannot see either: it does not look at a shape, and it did not look at the tag. That is the same gap
that let the one-image shape through.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VfYvJT5Nb71suJCowRBn5z
This commit is contained in:
2026-08-23 10:49:47 +02:00
co-authored by Claude Opus 5
parent 8dd3ee6576
commit ce11cade84
6 changed files with 156 additions and 4 deletions
+4
View File
@@ -534,6 +534,10 @@ std::vector<double> HDF5Object::ReadAttrVec(const std::string &name) {
return ret;
}
bool HDF5Object::AttrExists(const std::string &name) {
return H5Aexists(id, name.c_str()) > 0;
}
std::string HDF5Object::ReadAttrStr(const std::string &name) {
hid_t attr_id = H5Aopen(id, name.c_str(), H5P_DEFAULT);
if (attr_id < 0)