nexusformat / definitions

Definitions of the NeXus Standard File Structure and Contents
https://manual.nexusformat.org/
Other
26 stars 55 forks source link

Fix: 1381 change to the axes attribute meaning #1396

Open woutdenolf opened 1 week ago

woutdenolf commented 1 week ago

Closes #1381

HTML RENDERING OF NXDATA FIX <-> current nxdata for comparison

The NXdata definition got a makeover in PR #1213 to make it more understandable. In this effort, the @axes attribute was made less restrictive to allow for an unambiguous discovery of axis fields. This does not make existing files invalid but it does change things for existing readers as pointed out in issue #1381 by @jacobfilik .

The sole purpose of this PR is to rectify PR #1213 and NOT introduce anything new. The alternative PR https://github.com/nexusformat/definitions/pull/1392 by @PeterC-DLS fixes the situation by carefully modifying some sentences here and there. I would argue however that the entire "axes" section in the introduction has been structured with the less restrictive @axes in mind. In this PR I refactor the entire "axes" section as well as make @axes restrictive again.

FYI the less restrictive @axes attribute definition

The `@axes` attribute provides the names of all the `AXISNAME` fields in the NXdata group.
The corresponding `@AXISNAME_indices` attributes provide the signal dimensions they span
and when missing the position(s) of `AXISNAME` in `@axes` are taken as the signal dimensions
spanned by `AXISNAME`. The shape of an `AXISNAME` field is required to be equal to the shape
of the spanned signal dimensions.

This definition is much simpler and more concise than the definition in the "axes" section in the PR. However it removes the restriction that length(axes) == rank(signal) so we need to put it back in with @axes being the default axes, not all axes.

When reviewing this PR, please keep in mind that the purpose is to rectify NXdata, not improve it. Use #1381 for that.