New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is 'default' attribute value an absolute reference or a relative one? #1063
Comments
The value of |
step by step process instead of a direct jump (should be better documented) |
This adds to the confusion: https://www.nexusformat.org/2014_How_to_find_default_data.html
|
In 2018 NIAC it was accepted that any group could contain a group@default pointing to an NXdata inside its hierachy. |
I do not know from where you obtain the step-by-step rule. All what it was said in NIAC 2018 is that the target of a the default attribute had to be an NXdata inside the hierarchy of the containing group. Nothing about a step-by-step rule because that would imply the default attribute as pointing to something not an NXentry (for NXroot) or an NXdata (any other group). That was de-facto validating relative paths down to the hierarchy of the containing group. Are you confusing with some sort of depends on? This is what it was reflected in the minutes. https://www.nexusformat.org/NIAC2018Minutes.html Extended Use of the Defaults Attribute Currently we have a default attribute at root level which points to the default data. Currently this is restricted to NXroot, NXentry, NXsubentry. Proposal: allow the default attribute for any NeXus group which contains a plotable NXdata. All in favor |
Perhaps it's worth showing an example just in case there is a misunderstanding of how the
In the above, No paths are necessary, since the default attribute refers to a unique NXdata group within it. As @vasole, says, there is no reason in principle why this can't be extended to any subgroups of NXentry groups that also contain NXdata groups. Which of those groups gets propagated back to be the default group at the root level is to be decided when implementing it. NeXpy (or rather the nexusformat API) has an
All this does is set |
So there are currently two interpretations:
/:NXroot
@default = 'e1' <<< discovery step 1
e1:NXentry
@default = 'p2' <<< discovery step 2
p1:NXprocess
@default = 'd2'
d1:NXdata
d2:NXdata
p2:NXprocess
@default = 'd2' <<< discovery step 3 (we found the NXdata)
d1:NXdata
d2:NXdata <<< this is the default plot
/:NXroot
@default = 'e1' <<< discovery step 1
e1:NXentry
@default = 'p2/d2' <<< discovery step 2 (we found the NXdata)
p1:NXprocess
@default = 'd2'
d1:NXdata
d2:NXdata
p2:NXprocess
@default = 'd2'
d1:NXdata
d2:NXdata <<< this is the default plot Note that in the first interpretation, the number of steps to find the default plot depends on how deep in the tree the default NXdata is stored. In the second interpretation the default NXdata is always found in 2 steps. At the ESRF we have always used interpretation 2. Personally I find interpretation 1 more elegant:
|
@rayosborn You did not show an example where the NXdata is found deeper in the structure but from your explanation it seems nexpy is using interpretation 1 (step-by-step) from #1063 . Is that correct? |
The default value must be a child of the current group and that child must be a NeXus group. Apologies if the documentation was not clear. The proposal to NIAC showed this. |
The value of the |
@woutdenolf, I have always interpreted it as interpretation 1, as I think @prjemian has confirmed. I believe that NeXpy shows that the scheme works perfectly fine in practice. |
@woutdenolf, here is an example of the default attribute pointing deeper in the hierarchy. I just tested this in NeXpy.
In this example, This currently only works for On the other hand, I would caution against propagating a default from too deep in the hierarchy back to the root level. It would be odd, it seems to me, for the default plot for the whole file to be buried where it would otherwise be difficult to find. There may be use cases where it makes sense, so I wouldn't rule it out. |
|
I agree with that, although it's not how I use Actually, this doesn't just apply to |
Yes, I asked to allow an optional default attribute to any group containing an NXdata downstream its hierachy and yes I had in mind option 1. That was unanimously approved in 2018. In practice it has turned put to be quite convenient. Option 1 or option 2, I do not really care, but the feature itself. is very convenient.
|
Concerning the example given by Wout, if the entry only contains an NXdata, even if it is deeper in the hierarchy I would advocate to create softlink at NXentry level pointing to the deeper encountered NXdata. The idea behind the default attribute was to be able to have other NXdatas besides the one at top level. For instance, Each NXdetector or NXprocess could provide a representative NXdata. It has been working quite nice and I do not see a major need for option 2 except perhaps when dealing with external links as pointed out by @woutdenolf . Since it is a work to be done by a program and not by a user, please agree among you what you prefer. |
Adding the attribute 'default' to every group supports the idea that every group (independently where it is in a definition hierarchy) can have its default plot (assuming that there is an NXdata inside). Hence, solution (1) offers a nice situation, that one can get a default plot if you click anywhere in the tree of hdf groups. |
Yes, that was what it was shown to the NIAC in 2018 and what was unanimously approved. |
I think we still need to at least clarify the wording, since I think the use of the word 'path' has led to the confusion about which interpretation is correct. I think the NIAC also needs to clarify the situation concerning the presence of |
In this case, we put the NXdata in the entry group (which could be an entry or subentry called processed_results or whatever analysis/processing). |
That's what we do. I can see an argument for putting the |
This topic was discussed at the code camp and we worded the manual towards saying that the default attribute should be a relative reference to a child group (strict writer), but a reader might find an absolute path. |
Essentially a duplicate of #1003 |
is it allowed for the attribute 'default' to contain absolute references or only a relative one? Shall the relative reference point to one of the subgroups or can it point to a subgroup of a subgroup of a ...?
The text was updated successfully, but these errors were encountered: