Skip to content

Workflow patches for @inputs and time-dependent transformations#93

Open
g5t wants to merge 2 commits intomainfrom
g5t-workflow-patches
Open

Workflow patches for @inputs and time-dependent transformations#93
g5t wants to merge 2 commits intomainfrom
g5t-workflow-patches

Conversation

@g5t
Copy link
Collaborator

@g5t g5t commented Feb 27, 2026

Seemingly depends on my PR to essreduce, though I imagine there is a better way to achieve the reduction to the first-time-point only. Otherwise loading any data from the files fails due to transformation dependency-chain resolution problems.

  • Ensures that only the first time-point is used in calculating per-detector-element properties.
  • Tries to use the @inputs neutron-path information, now present in simulated BIFROST NeXus files, to resolve detector -> analyzer relationships. This approach works partly-outside of the normal workflow and likely needs tweaking to work the correct way.

g5t added 2 commits February 27, 2026 10:29
The positions and orientation of components after the sample position
are, strictly speaking, time-dependent parameters. Previously their
transformation chains lacked this fidelity due to limitations in
creating the NeXus Structure JSON via `moreniius`. Those limitations
have been lifted and newly-generated BIFROST simulation files include
NXtransformation groups with NXlog constituents.

In order to calculate the correct analyzer and sample scattering angle
for each detector pixel, the BIFROST workflow performs some geometry
calculations in the coordinate frame which rotates with the detector
tank, around the sample position.
Since the analyzers and detectors are stationary in this frame, we can
(and must) remove any time-dependence from their positions and
orientations.

This PR introduces a quick-and-dirty hack to only use the first
time-point from any time-dependent transformation result for the
- sample
- analyzers
- detectors
The NeXus format specification now allows most base objects to specify
two attributes which help define the *expected* beam path through a
collection of instrument components: `@inputs` and `@outputs`.

Updates to `moreniius` mean that the BIFROST NeXus Structure JSON now
contains these attributes, including the one-to-many and many-to-one
transitions between, e.g., the sample position and the 45 analyzers.

Given a detector's HDF5 Group, it is possible to follow the @inputs
attributes analagously to a depends-on chain to identify which analyzer
the detector should have received its neutron events from.

This commit adds functionality which has only been tested outside of the
workflow, by defining the `DetectorAnalyzerMap` at repl scope and the
patching `ess.bifrost.io.nexus._get_analyzer_for_detector_name` to use
the static relational information.
I imagine it needs work to mold it into an appropriate `sciline`
workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant