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

add depends_on and related to all component type classes #897

Closed
wants to merge 10 commits into from

Conversation

mkoennecke
Copy link
Contributor

@mkoennecke mkoennecke commented Mar 23, 2021

Fixes #681, This is the first version of adding NXtransformations, depends_on and NXoff_geometry to all base classes needing them.

…ave a depends_on field and

NXtransformations group. Done until NXinsertion_device in the base class list.
base_classes/NXaperture.nxdl.xml Outdated Show resolved Hide resolved
base_classes/NXattenuator.nxdl.xml Outdated Show resolved Hide resolved
</doc>
</field>

<group name="transformations" type="NXtransformations" minOccurs="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this name fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it is a good idea to have that in the same place in each group. Is there a use case for another name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is not important from a parsing perspective because you are always following a depends_on path to find it anyway. I also can't think of a use case for allowing a different name though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prjemian Can you chime in on this? From session G of CodeCamp2021, we are split on this issue. Whether to specify the name as transformations or leave it optional. (Note, nobody had a really strong opinion :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, not sure why it is necessary to require the exact name. Within the BES Bluesky communitym there is a group looking at XPCS data and has begun learning how to apply NX transformations. They have assumed the name is not required to be exactly transformations. Thus, in any NXDL spec, the name could be omitted unless there are two or more NXtransformations groups in the same directory. In such case, they need names to avoid ambiguity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the crystallography community, prescriptive naming is not likely to work.

On the matter of deprecating distance in favor of deriving it from the axis chain, that also is not likely to work, since distance, wavelength and beam center are essential data for
processing. The best we are likely to be able t do is to make it clear when they are derived versus when they are directly observed and make derived the default.

the instrument.
</doc>
</group>
<group type="NXoff_geometry" minOccurs="0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or "NXcylindrical_geometry"

* transformation_type
* depends_on

as needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it agreed by NIAC to prefer using these names? I sometimes use the name of a motion axis device for example.
Should we also explicitly mention that an NXlog can be used in place of a dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? These are the standard transformation related attribute types.

At the beginning of the code camp we discussed this issue and decided to move all the older NeXus
positioning fields into NXtransformations. The use case you describe, an axis name called hugo with a very weird operation, is still possible.

The NXlog is a good point and I see where I can fit this in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, by "these names" I meant "distance", "height", etc.

@prjemian prjemian changed the title Issue 681 add depends_on and related to all component type classes Mar 23, 2021
@prjemian prjemian added this to the NXDL 2021.10 milestone Mar 23, 2021
<doc>
NeXus positions components by applying a set of translations and rotations
to apply to the component starting from 0, 0, 0. The order of these operations
is critical and form a what NeXus calls a dependency chain. The depends_on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should read "and forms what NeXus..."

<dimensions rank="1">
<dim index="1" value="3" />
</dimensions>
<enumeration>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute is defined as having a number type thus can probably cannot be an enumeration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not quite right: arrays are not allowed as enumeration items.

@@ -176,6 +192,207 @@
differences. Use of ``AXISNAME_end`` is recommended.
</doc>
</field>
<field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the coordinate frame's z axis direction. I think the frame should be left as a choice for beamlines/facilities.

Copy link
Contributor

@yayahjb yayahjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments on prescriptive naming and keeping explicit distance, beam center and wavelength, and note that the enumeration issue still needs to be resolved, but all that being said, it really is time to make use of NXtranformations the norm.

@phyy-nx
Copy link
Contributor

phyy-nx commented Mar 29, 2021

I believe that what @mkoennecke has done is to add depends_on and NXtransformations where they were missing, which I'm quite pleased about. However, as discussed in one of the code camp sessions, going further and deprecating distance and beam center fields is likely not necessary. I've reverted the deprectations and replaced them with comments here:

issue-681...issue-681-aaron

Further, while I was working on this, I see that @mkoennecke added the deprecated fields explicitly to NXtransformations as example names for beamline components. For example, compare this removal of distance to where it was added as an example axis name to NXtransformations.

I think the additions to NXtransformations aren't needed in formal NXdl language. I'd instead like to see examples as text, such as what @yayahjb and I are hoping to do when resolving #412. That would make it more clear that axis names and conventions aren't proscriptive. But as that's more work, I'd instead propose reverting most of the changes to NXtransformations as the next step in this PR. Would love to hear any feedback though.

Thanks!

@yayahjb
Copy link
Contributor

yayahjb commented Mar 30, 2021 via email

@mkoennecke
Copy link
Contributor Author

Hmmh, IMHO we should not give up to quickly on names for transformations. I am in favor to keep them at least as suggestions. Some of them are very old names, with NeXus since its inception. These are things like distance, rotation_angle, polar_angle, height and such. Then there are names which never got popular like azimuthal_angle, meridional_angle. May be drop those. We not only have to cater for the anarchic MX community but also for people who are relatively new to NeXus and would prefer a little hand holding when choosing a name for say: a translation in x or y.

@rayosborn
Copy link
Contributor

The comment by @mkoennecke about deprecating polar_angle, etc, alarmed me. Are people actually suggesting deprecating distance, polar_angle, azimuthal_angle, etc, in favor of abstract depends_on chains? I hope not because we use them all the time. Personally, I have never used transformations and I think it would be a mistake to force everyone to use them. It is another non-intuitive aspect of the standard for people to learn, and I don't think we even provide a tutorial (please point me to one if I'm wrong). If I have got the wrong end of the stick, please ignore this comment.

@prjemian
Copy link
Contributor

As far as I know, there is no tutorial but there is documentation in addition to what is provided by the NXtransformation base class. The manual has a section with one example. More examples would be very useful.

@yayahjb
Copy link
Contributor

yayahjb commented Mar 30, 2021 via email

@mkoennecke
Copy link
Contributor Author

I have updated this pull request by merging in aaron's changes which remove most of the deprecated messages and merged with main. Please review again.

@prjemian prjemian mentioned this pull request Jun 13, 2022
Copy link
Contributor

@prjemian prjemian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An apparent duplicate PR exists (#999 (comment)). Please consider which if these two pull requests to pursue and close the other with a suitable comment.

@phyy-nx
Copy link
Contributor

phyy-nx commented Jun 14, 2022

I am working on a unified PR for #897 and #999

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.

Explicitly add depends_on and shape fields to all component type classes?
7 participants