Skip to content
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

Support for non-dimensional coordinates in NXdata #139

Open
sanbrock opened this issue Sep 14, 2022 · 5 comments
Open

Support for non-dimensional coordinates in NXdata #139

sanbrock opened this issue Sep 14, 2022 · 5 comments
Assignees

Comments

@sanbrock
Copy link

sanbrock commented Sep 14, 2022

The python library xarrays specifies the so called non-dimension coordinates

Let us imagine we make a 2D mesh scan and collect the results in a 2D array (x,y). Also, we make another 2D array (x,y) for the timestamps of each measurements at the given location. We may want to plot the results (from their original 2D (x,y) array) against the time. So we need to build a new coordinate of time from its 2D array. The same transformation needed for the time array linearisation should be also applied on the results array.
Another example from xarrays

Such description would also support describing sheared axes and make proper plots when axes are not orthogonal to one another, etc. #102

@sanbrock sanbrock self-assigned this Sep 14, 2022
@sanbrock
Copy link
Author

sanbrock commented Sep 14, 2022

A possibility to implement this in NXdata.nxdl is a new attribute:

@NON_DIMENSION_axis:NX_CHAR
This represents a coordinate axis which can be referenced among @axes. The labels on this axis is the collection of values of the Field with the same name.

The value of this attribute is a string array listing the coordinate axes corresponding to the dimensions of the Field.

The transformation required to linearize the Field need to be applied to all data points following the listed referenced coordinate axes.

E.g.
data:NXdata
@signal="measurement"
@axes=["x","y","time_axis"]
@x_indices=0
@y_indices=1
@time_axis_indices=0
@time_axis=["x","y"]
measurement: float[200,100]
time_axis: float[200,100]
x: float[200]
y: float[100]

Since "measurement" data axes are connected to "x"and "y", when plotting against "time_axis", a 1D curve needs to be generated from the linearized "measurement" data.

@sanbrock sanbrock moved this to Todo in NIAC2022 project Sep 14, 2022
@benajamin
Copy link
Contributor

Please indicate if you would like to see this included in NeXus

@benajamin
Copy link
Contributor

I feel that NeXus should only provide the data to be plotted and should not go so far as to give instructions on how the data should be presented.

@mkoennecke
Copy link
Contributor

I think this goes a long way down the road of very specialized data analysis. We need to make sure that all necessary data is stored in order to make that specialized data analysis possible but not to do it in NeXus. And the data storage requirement is fulfilled.

@sanbrock sanbrock moved this from Todo to In Progress in NIAC2022 project Sep 14, 2022
@woutdenolf
Copy link

woutdenolf commented Sep 14, 2022

This can currently be achieved by

data:NXdata
@signal="measurement"
@axes=["x","y"]
measurement: float[200,100]
x: float[200]
y: float[100]

and

data:NXdata
@signal="measurement"
@axes=["time_axis"]
measurement: float[20000]
time_axis: float[20000]

The measurement dataset in the second NXdata group could be a virtual datasets which links to the measurement dataset in the first NXdata group. In this case if you need both NXdata groups, you are not duplicating data.

@benajamin benajamin moved this from In Progress to Done in NIAC2022 project Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants