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

Expose NeXus transformation chains in workflow steps #114

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Oct 2, 2024

Part of #96.

This is not completing this task, but does most of the prep work. The idea is that the to_transformation could accept additional arguments (or be replaced by one that does), which could:

  1. Select a specific time interval, including averaging and threshold checking.
  2. Update values of one or more transformations in the chain. This is mainly relevant for live-data reduction.

Neither 1.) nor 2.) is implemented right now. The initial focus will be on 1.). I would mainly like input from the reviewer on whether this new structure is adequate for this. The actual implementation of these features could be performed in follow-up work.

Depends on a release of scipp/scippnexus#243 (that is why CI is failing for now, otherwise this PR is ready for review).

Note that I ran into major (code) overhead/duplication from the current duplication (or near-duplication) of different code for different component types. Previously we had failed to find a way to generalize this. The reason was that monitors required one extra type-parameter (MyMonitor[RunType, MonitorType] vs MyDetector[RunType], MySample[RunType], ...). I believe I have now solved this via the new ComponentType. We can thus use MyComponent[Component, RunType] almost throughout, resulting in a significant deduplication. The "trick" is that Component takes general component names except for the monitors, where there are multiple named ones.

return compute_component_position(loaded)
return loaded
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the heart of the change in this PR: We are no longer computing the position directly here. This is moved into an extra step.

@@ -95,9 +91,9 @@ class TransmissionRun(Generic[ScatteringRunType]):
"""Identifier for an arbitrary monitor"""
Monitor5 = NewType('Monitor5', int)
"""Identifier for an arbitrary monitor"""
Incident = NewType('Incident', int)
IncidentMonitor = NewType('IncidentMonitor', int)
Copy link
Member Author

Choose a reason for hiding this comment

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

Added the monitor suffix here since these now show up as MyComponent[IndicidentMonitor] and it may be confusing without.

@SimonHeybrock SimonHeybrock marked this pull request as ready for review October 3, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Selected
Development

Successfully merging this pull request may close these issues.

1 participant