-
Notifications
You must be signed in to change notification settings - Fork 56
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
NXdata - @AXISNAME_indices confusion #1212
Comments
So it seems this is possible (I had no idea)
|
I'll work on this once #1210 is resolved |
|
Ok I think I understand now. I'll make a PR to improve the docs accordingly. |
Since you have raised the issue, I argued against the |
Then we're in the same boat. If it is not used in NeXpy, silx, h5web, ... then I don't see the point either. Even in the example above where |
Nevertheless I will improve the docs. Then we can perhaps discuss deprecation at some NIAC meeting. |
The two of you are in agreement with each other. This has been brought up before and discussed. I'm on travel now and will do the research y'all are missing when I get back. There are cases for this when it is important to have a distinction. |
Ok I guess this is an example where the data_2d:NXdata
@signal="data"
@axes=["pressure", "time", "."]
@time_indices=1
@pressure_indices=[2, 0]
data: float[20,1000,30]
time: float[1000]
pressure: float[30,20] |
Right, it's pathological for sure. Without |
I think "pathological" is the right word. At the moment, everyone reading the NeXus manual has to get their head around what the purpose of the |
What does this mean?
|
The global docs of NXdata contain this text
which eliminates the use case above. I believe the global NXdata doc section contains too many things which as a duplicate of what is provided in the docs of the field and attributes. I will propose a significantly reduces version. |
I also see the words |
Also: https://manual.nexusformat.org/classes/base_classes/NXdata.html#nxdata-axisname-field This forces the axes to have rank 1 which also eliminates the example. |
So the documentation contradicts itself. The fundamental question is: can the rank of an axis be larger than 1? |
Thanks for looking into this so carefully. The |
For now I assume The rendered version: https://hdf5.gitlab-pages.esrf.fr/nexus/nxdata_axes/classes/base_classes/NXdata.html |
In case of an axis that spans more than one dimensions, it would make more sense to do this
than this
The "." should only be used when the data does not have coordinates along that dimension. Would that change the current definition? |
An obvious example is an X-Y scan where the |
FYI At the ESRF we never store data like that. Axes are always stored as a flat 1D arrays. So suppose you do a 2D scan of 10 x 20 points than The problem we have with this is that NXdata does not support this type of data. |
You also need |
I looked into plotting irregular 2D arrays and even implemented a Voronoi plot in NeXpy as a potential solution, but it never made much sense. The irregular grid plot conveyed no extra information than the regular grid. I can see the need to use accurate coordinates in data analysis, but less so in plotting unless the motor positions are strongly distorted. A while ago, I proposed that we consider an alternative NXdata-like class for storing counts and data coordinates. This would be something like NXevent_data, but not specific to time-of-flight neutron data. I think at the time, it seemed too hypothetical. @PeterC-DLS, do you have examples in Diamond of NeXus files storing data in the way you describe? |
We did implement something like that in silx but we need to use non-compliant NXdata structures as described in #1214 |
Ok I think I finally understand what this means. I will propose the following rewording
|
Looking at https://www.nexusformat.org/2014_axes_and_uncertainties.html I found this unexpected example
So essentially this means there is no logic in the order of the names in It would make more sense to me to have
To me it seems that the introduction of |
Isn't there a later version? This was the proposal. |
I took these examples from here: https://www.nexusformat.org/2014_axes_and_uncertainties.html which we also link in NXdata so I assume these are the official examples. |
@woutdenolf, your example above shows that promoting the I repeat my earlier request for actual existing examples of files where |
My proposal would be
Example without indices
Example with indices
|
A simpler proposal: the dimensions spanned by This means in python, you would do this to get all axes and the dimensions they span: def get_axes_dims(nxdata: h5py.Group) -> Dict[str,List[int]]:
axes_data_dims = dict()
axes = nxdata.attrs.get("axes", list())
for axisname in set(axes):
if axisname == ".":
continue
data_dims = nxdata.attrs.get(f"{axisname}_indices", None)
if data_dims is None:
data_dims = [i for i,s in enumerate(axes) if s == axisname]
elif not isinstance(data_dims, Sequence):
data_dims = [indices]
else:
data_dims = list(data_dims)
axes_data_dims[axisname] = data_dims
return axes_data_dims |
One thing is still unclear to me: what is the rank of By looking at Possibility 1 (definition in spirit but not in practice)The rank of This seems to be the intention as shown in these examples. However the official A 2D scatter data example:
Possibility 2 (definition in practice but not in spirit)The rank of This matches the official If this would be the definition you would also need to describe the array order. For example we can say that the order must be C-order (i.e. the last dimension is the major dimension). As there is no mentioning of this anywhere in the documentation, I suspect this was never the intention of the definition. A 2D scatter data example:
ProposalThe rank of Note that this is valid (
But this is NOT valid (
A user would have to do this instead:
|
Another thing that is not clear: the definition of |
No idea what any of this means.
As far as I understand, the number of strings in
@axes
must be equal to the number of dimensions of the signal as well as the auxiliary signals. This means that there is exactly one axis field for each signal dimension, but an axis field can be re-used for multiple dimensions. Is this correct?If this is correct,
AXISNAME_indices
is completely redundant. However we haveWhich seems to indicate I'm missing something.
The text was updated successfully, but these errors were encountered: