From 48054eca5edac255681c9d81b8f18d0f237e5ab4 Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Mon, 26 Aug 2024 10:05:42 +0200 Subject: [PATCH 1/2] Add VanadiumRun --- src/ess/reduce/nexus/generic_types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ess/reduce/nexus/generic_types.py b/src/ess/reduce/nexus/generic_types.py index e35275f5..8dcab03e 100644 --- a/src/ess/reduce/nexus/generic_types.py +++ b/src/ess/reduce/nexus/generic_types.py @@ -23,11 +23,14 @@ """ SampleRun = NewType('SampleRun', int) """Sample run.""" +VanadiumRun = NewType('VanadiumRun', int) +"""Vanadium run.""" ScatteringRunType = TypeVar( 'ScatteringRunType', - SampleRun, BackgroundRun, + SampleRun, + VanadiumRun, ) @@ -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""" From 3e783911636a44e52a12634760f967866fcefd40 Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Mon, 26 Aug 2024 10:44:53 +0200 Subject: [PATCH 2/2] Be more flexible for position coord unit --- src/ess/reduce/nexus/workflow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ess/reduce/nexus/workflow.py b/src/ess/reduce/nexus/workflow.py index 8cca2660..92f39261 100644 --- a/src/ess/reduce/nexus/workflow.py +++ b/src/ess/reduce/nexus/workflow.py @@ -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, @@ -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, ) )