Skip to content

Commit

Permalink
Merge pull request #81 from scipp/add-more-run-types
Browse files Browse the repository at this point in the history
Minor fixes needed for ESSdiffraction
  • Loading branch information
SimonHeybrock authored Aug 26, 2024
2 parents 4f3f73d + 3e78391 commit f8f0a41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/ess/reduce/nexus/generic_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
"""
SampleRun = NewType('SampleRun', int)
"""Sample run."""
VanadiumRun = NewType('VanadiumRun', int)
"""Vanadium run."""

ScatteringRunType = TypeVar(
'ScatteringRunType',
SampleRun,
BackgroundRun,
SampleRun,
VanadiumRun,
)


Expand All @@ -48,6 +51,7 @@ class TransmissionRun(Generic[ScatteringRunType]):
# Note that mypy does not seem to like this nesting, may need to find a workaround
TransmissionRun[SampleRun],
TransmissionRun[BackgroundRun],
VanadiumRun,
)
"""TypeVar used for specifying BackgroundRun, EmptyBeamRun or SampleRun"""

Expand Down
4 changes: 2 additions & 2 deletions src/ess/reduce/nexus/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def get_calibrated_detector(
# the detector array from the raw loader NeXus group, to prevent a source of bugs.
return AnyRunCalibratedDetector(
da.assign_coords(
position=da.coords['position'] + offset,
position=da.coords['position'] + offset.to(unit=da.coords['position'].unit),
source_position=source_position,
sample_position=sample_position,
gravity=gravity,
Expand Down Expand Up @@ -389,7 +389,7 @@ def get_calibrated_monitor(
"""
return AnyRunAnyCalibratedMonitor(
nexus.extract_monitor_data(monitor).assign_coords(
position=monitor['position'] + offset,
position=monitor['position'] + offset.to(unit=monitor['position'].unit),
source_position=source_position,
)
)
Expand Down

0 comments on commit f8f0a41

Please sign in to comment.