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
+2
View File
@@ -1504,8 +1504,10 @@ std::vector<DetectorTransformation> DiffractionExperiment::BuildTransformationCh
if (const auto smargon = dataset.GetSmargonPosition()) {
const auto n = static_cast<size_t>(std::max<int64_t>(image_num, 1));
add(DetectorTransformation("chi", TransformationType::Rotation, smargon->chi_axis)
.EquipmentComponent("smargon")
.Values(std::vector<float>(n, smargon->chi_deg)));
add(DetectorTransformation("phi", TransformationType::Rotation, smargon->phi_axis)
.EquipmentComponent("smargon")
.Values(std::vector<float>(n, smargon->phi_deg)));
}