Skip to content

Fix false dependency of OutputCalibrationData on CorrectedDetector#250

Open
SimonHeybrock wants to merge 2 commits intomainfrom
fix/output-calibration-false-dependency
Open

Fix false dependency of OutputCalibrationData on CorrectedDetector#250
SimonHeybrock wants to merge 2 commits intomainfrom
fix/output-calibration-false-dependency

Conversation

@SimonHeybrock
Copy link
Member

Summary

  • assemble_output_calibration only uses Ltotal and two_theta — purely geometric quantities derived from detector pixel positions — yet it depended on CorrectedDetector[SampleRun], pulling in the full event processing chain
  • This blocked computing OutputCalibrationData in streaming contexts (esslivedata) where event data is unavailable during finalization
  • Introduces DetectorTwoTheta sciline node type (mirroring the existing DetectorLtotal from ess.reduce) with a provider computing it from EmptyDetector + beamline geometry
  • Changes assemble_output_calibration to depend on DetectorLtotal[SampleRun] and DetectorTwoTheta[SampleRun] instead

Motivation

See #249. In ess.reduce.streaming.StreamProcessor, OutputCalibrationData ended up in the dynamic subgraph because CorrectedDetector depends on NeXusData. This prevented computing IntensityTof during finalization. The fix breaks this false dependency so OutputCalibrationData can be computed from static geometry alone.

Whether DetectorTwoTheta should be moved to ess.reduce (next to DetectorLtotal) is tracked in scipp/ess#168.

Closes #249

🤖 Generated with Claude Code

…ctor

assemble_output_calibration only uses Ltotal and two_theta, which are
purely geometric quantities derived from detector pixel positions.
By depending on CorrectedDetector[SampleRun], it unnecessarily pulled
in the full event processing chain, blocking use in streaming contexts
where event data is not available during finalization.

Introduce DetectorTwoTheta sciline node type (mirroring the existing
DetectorLtotal from ess.reduce) and a provider that computes it from
EmptyDetector + beamline geometry. Change assemble_output_calibration
to depend on DetectorLtotal[SampleRun] and DetectorTwoTheta[SampleRun]
instead.

Closes #249

Prompt: Please use a new branch and address #249. We concluded that
using EmptyDetector should work, but hopefully tests will tell (check
we have tests that are sensitive to this).

Follow-up: Find out how the ess.reduce GenericTofWorkflow handles
Ltotal. Is it already a node in the graph, or is it always embedded as
a coord? If a node, we should consider doing the same for two_theta.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
'source_position': lambda: source_position,
'sample_position': lambda: sample_position,
'gravity': lambda: gravity,
}
Copy link
Member

Choose a reason for hiding this comment

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

Please change this to use ElasticCoordTransformGraph instead of constructing a custom graph so that we have a single customisation point.

two_theta: DetectorTwoTheta[SampleRun],
) -> OutputCalibrationData:
"""Construct output calibration data from average pixel positions."""
# Use nanmean because pixels without events have position=NaN.
Copy link
Member

Choose a reason for hiding this comment

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

Please restore the comment.

- Use ElasticCoordTransformGraph in detector_two_theta instead of
  constructing a custom graph, providing a single customization point
- Restore nanmean comment in assemble_output_calibration

Prompt: We need to address review comments on PR #250.
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.

assemble_output_calibration has false dependency on CorrectedDetector (breaks streaming)

2 participants