Open prjemian opened 4 years ago
This is automatically handled in the nexusformat package. Each group has a plottable_data
attribute that either follows the default
breadcrumbs or returns the first NXdata group it finds. I have added a cell to the end of the NeXus Examples notebook that shows this.
I'm not sure it's worth doing this in h5py, because it would be a complicated chain of if statements. I can cut and paste the code we use in nexusformat
to achieve this. Also, having no signal
attribute is a standard violation. I don't think we should train our users how to cope with bad files - we should encourage them to write good ones.
Is it so difficult to say that it can be a default entry specified at NXroot level and a default NXdata specified as NXentry attribute?
Any other NXdata not specified as default attribute in NXentry should not be considered default. If we start searching the tree to find plots, file browsing with hundreds of entries is going to be veeeery slow.
In terms of h5py, it is not difficult at all to check if NXroot has the default attribute, that the entry exists and that it has the default attribute and it is an NXdata. Going beyond that is out of scope.
Example is not ready. Moving to next milestone.
@vasole - With @default
attributes, the easy case is solved but the statement of the problem above is to parse any NeXus HDF5 data file, whether nor not there is such a trail. The search need not be so tedious, rather finding the first matching classpath NXentry/NXdata/field
if no trail attributes are provided.
The complexity of this matter is described at length in the manual but we want some example code to help navigate this complexity.
The example should be able to parse any NeXus HDF5 data file, whether nor not there is a trail of
@default
and/or@signal
attributes.Related to issues #415, #443, #457, #665, and #741, and PR #737.