Closed Blackclaws closed 2 months ago
@Blackclaws the spec is tricky to decipher, but the title
you link to actually defines an optional dataset named title
inside the NXdata
group, not an attribute on the group. You can tell because it's lower-case and not prefixed with @
.
Attributes are prefixed with @
. For instance, @signal
defines an attribute named signal
on the NXdata
group.
Uppercase fields, like DATA
, define child datasets whose actual names are defined somewhere else (e.g. if the signal
attribute's value is "foo"
, then DATA
refers to a child dataset named foo
).
If you'd like to define the title of the plot in an attribute instead of a dataset, I recommend using the long_name
attribute on the DATA
(i.e. signal) dataset. You can check out /nexus_entry/image
in the mock demo for an example.
Is your feature request related to a problem?
As per the nexus specification: https://hdf5.gitlab-pages.esrf.fr/nexus/nxdata_axes/classes/base_classes/NXdata.html#nxdata-title-field
A title attribute on NXData should be one way to define a title for a plot. Right now h5web only supports a "title" dataset for that purpose.
Requested solution or feature
Implement reading of title attribute or fall back to a "title" dataset otherwise.
Additional context
I'd be happy to try and contribute this feature if wanted.