Skip to content

Commit cf9cfcc

Browse files
committed
fix: don't read average value of rotation params, only read first
1 parent 126a0f6 commit cf9cfcc

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/ess/amor/load.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,18 @@ def load_amor_ch_frequency(ch: RawChopper[RunType]) -> ChopperFrequency[RunType]
141141

142142
def load_amor_sample_rotation(fp: Filename[RunType]) -> SampleRotation[RunType]:
143143
(mu,) = load_nx(fp, "NXentry/NXinstrument/master_parameters/mu")
144-
# For some reason this is length 1 and not scalar sometimes
145-
if mu["value"].coords["average_value"].dims != ():
146-
mu = mu["value"].coords["average_value"].values[0]
147-
else:
148-
mu = mu["value"].coords["average_value"].value
149-
return sc.scalar(mu, unit="deg")
144+
# Jochens Amor code reads the first value of this log
145+
# see https://github.com/jochenstahn/amor/blob/140e3192ddb7e7f28acee87e2acaee65ce1332aa/libeos/file_reader.py#L272 # noqa: E501
146+
# might have to change if this field ever becomes truly time-dependent
147+
return sc.scalar(mu['value'].data['dim_1', 0]['time', 0].value, unit='deg')
150148

151149

152150
def load_amor_detector_rotation(fp: Filename[RunType]) -> DetectorRotation[RunType]:
153151
(nu,) = load_nx(fp, "NXentry/NXinstrument/master_parameters/nu")
154-
# For some reason this is length 1 and not scalar sometimes
155-
if nu["value"].coords["average_value"].dims != ():
156-
nu = nu["value"].coords["average_value"].values[0]
157-
else:
158-
nu = nu["value"].coords["average_value"].value
159-
return sc.scalar(nu, unit="deg")
152+
# Jochens Amor code reads the first value of this log
153+
# see https://github.com/jochenstahn/amor/blob/140e3192ddb7e7f28acee87e2acaee65ce1332aa/libeos/file_reader.py#L272 # noqa: E501
154+
# might have to change if this field ever becomes truly time-dependent
155+
return sc.scalar(nu['value'].data['dim_1', 0]['time', 0].value, unit='deg')
160156

161157

162158
providers = (

0 commit comments

Comments
 (0)