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

WIP: add transformation field to NXdata #1033

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

woutdenolf
Copy link
Contributor

@woutdenolf woutdenolf commented Mar 13, 2022

Closes nexusformat/NIAC#102

Proposal

Add the attribute passive_transformation and field TRANSFORMATION to NXdata.

myplot:NXdata
  @passive_transformation = 'reciprocal_space'
  reciprocal_space NX_FLOAT (n+1, n+1)
    @transformation_type = 'affine'

To be decided:

  • do save the active or passive transformation matrix?
    -> currently I chose passive because transforming an image is often done by defining a grid in the plotting frame, transforming the grid coordinates to the data frame and interpolate the image.
  • should be matrix be for [x,y,1]^T coordinates (natural for 2D) or [y,x,1]^T (natural for n-D)?
    -> currently I chose [y,x,1]^T as it keeps the coordinate order defined by AXISNAME_indices.

Example

An example for a 3D signal

myplot:NXdata
  @axes = ['Ql', 'Qk', 'Qh']
  @passive_transformation = "reciprocal_space"
  Qh = float64(1601)
    @long_name = 'H (rlu)'
  Qk = float64(801)
    @long_name = 'K (rlu)'
  Ql = float64(1201)
    @long_name = 'L (rlu)'
  reciprocal_space = float64(4, 4)
    @transformation_type = 'affine'

Preview of PR changes

NXdata rendering:

https://hdf5.gitlab-pages.esrf.fr/nexus/nxdata_transformation/classes/base_classes/NXdata.html#nxdata-transformation-field

Additional documentation and code examples for reference frames:

https://hdf5.gitlab-pages.esrf.fr/nexus/nxdata_transformation/notebooks/index.html

Extra dependencies

nbsphinx and ipython are needed to include jupyter notebooks in the documentation.

These can be pip installed but nbsphinx also needs pandoc, which is a system package.

Edit: to be decided whether this is acceptable. Perhaps add pandoc system installation to make install for linux, windows and mac?

@woutdenolf woutdenolf force-pushed the notebook_for_reference_frames branch 2 times, most recently from ec28489 to e2afee4 Compare March 13, 2022 11:55
.gitignore Outdated Show resolved Hide resolved
.github/env-workflow.yml Outdated Show resolved Hide resolved
manual/source/conf.py Outdated Show resolved Hide resolved
@woutdenolf woutdenolf changed the title add a jupyter notebook on the topic of reference frames WIP: add a jupyter notebook on the topic of reference frames Mar 24, 2022
@prjemian
Copy link
Contributor

prjemian commented Mar 26, 2022 via email

prjemian added a commit that referenced this pull request Jun 13, 2022
@prjemian prjemian self-requested a review June 15, 2022 19:15
@prjemian
Copy link
Contributor

I like the way this looks. Makes it so easy to add documentation which becomes part of the manual_ from a Jupyter notebook.

Noticing that a single notebook creates 4 subsections. Was expecting a single subsection per notebook, with sub-subsections. Was that intentional? Is it designed (by the notebook author)? Looks like it. Each of the sections there use #. Thinking that a notebook should only have a single level-1 heading, then level-2 (##) or more below that heading. The idea is that all this content belongs to this one document.

@prjemian
Copy link
Contributor

@woutdenolf Should we consider this PR at the 2022-06 Code Camp?

@woutdenolf
Copy link
Contributor Author

woutdenolf commented Jun 16, 2022

I made this to discuss nexusformat/NIAC#102

Maybe after some cleanup this can be actually part of the documentation.

Not for 2022-06 Code Camp I would say.

@prjemian prjemian added this to the NXDL 2023.06 milestone Sep 14, 2022
@woutdenolf woutdenolf force-pushed the notebook_for_reference_frames branch 4 times, most recently from 33b0b80 to c53f839 Compare September 24, 2022 20:06
@woutdenolf woutdenolf changed the title WIP: add a jupyter notebook on the topic of reference frames WIP: add transformation field to NXdata Sep 24, 2022
@woutdenolf woutdenolf force-pushed the notebook_for_reference_frames branch 5 times, most recently from efb0629 to 39c72a1 Compare September 24, 2022 22:42
@woutdenolf woutdenolf force-pushed the notebook_for_reference_frames branch 3 times, most recently from ed18533 to 9051d04 Compare October 9, 2022 12:28
@vincefn
Copy link

vincefn commented Oct 10, 2022

Looks good to me. This will also be useful for 3D reciprocal space plots.
I would suggest to add a link in the doc to https://en.wikipedia.org/wiki/Active_and_passive_transformation to explain the notion of passive/active transformations, which can be a bit obscure otherwise.

@woutdenolf
Copy link
Contributor Author

woutdenolf commented Oct 10, 2022

NXdata has a link to this (If you don't see the link, make sure to refresh the page or clear cache). The passive/active transformation is defined there. Perhaps not clear enough? I'd like to avoid links to wikipedia.

@woutdenolf woutdenolf force-pushed the notebook_for_reference_frames branch 6 times, most recently from 04c5875 to 25ae5cb Compare December 22, 2022 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal to add 'angles' attribute to NXdata groups
3 participants