Skip to content

Read source position from NXmoderator - #878

Draft
jl-wynen wants to merge 1 commit into
mainfrom
source-position-from-moderator
Draft

jl-wynen wants to merge 1 commit into
mainfrom
source-position-from-moderator

Conversation

@jl-wynen

Copy link
Copy Markdown
Member

Fixes #120

(Draft for now because I am using CI to run the tests)

I considered a couple of alternatives:

  1. Override NeXusClass[snx.NXsource] as we used to do for BIFROST. But as noted in Consider loading source from NXmoderator #120 (comment), this breaks code that expects Component[snx.NXsource] to be an actual NXsource.
  2. Override compute_position(transform: NeXusTransformation[snx.NXmoderator) -> Position[snx.NXsource] This would avoid the problem in point 1, but would still be strange because it hides the actual NXsource and could lead to confusion.
  3. Explicitly request moderator_position: Position[snx.NXmoderator] in all providers. This would be clean but would lock us in to using the moderator everywhere.
  4. (chosen) Make a distinct NeutronSourcePosition type. This allows us to provide positions from either the moderator or source, depending on what file we read (e.g., ESS vs McStas)
  • I opted to raise an exception whenever someone requests Position[snx.NXsource] because that is an easy mistake to make but hard to spot.

@YooSunYoung The NMX workflow tests fail because the test file does not contain a moderator. Are the tests designed for actual ESS files or for simulation data? In the former case, we should update the file. In the latter, we should update the workflow to load NXsource.

@github-actions github-actions Bot added essdiffraction Issues for essdiffraction. essimaging Issues for essimaging. essnmx Issues for essnmx. essreduce Issues for essreduce. essreflectometry Issues for essreflectometry. esssans Issues for esssans. essspectroscopy Issues for essspectroscopy. labels Nov 13, 2026
"neutron production (accelerator, target, etc.).\n\n"
"Use NeutronSourcePosition[RunType] or equivalently "
"Position[scippnexus.NXmoderator, RunType]. If this does not work for you, "
"insert your providder to overridethe one that produced this error."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"insert your providder to overridethe one that produced this error."
"insert your provider to override the one that produced this error."

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

essdiffraction Issues for essdiffraction. essimaging Issues for essimaging. essnmx Issues for essnmx. essreduce Issues for essreduce. essreflectometry Issues for essreflectometry. esssans Issues for esssans. essspectroscopy Issues for essspectroscopy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider loading source from NXmoderator

2 participants