Skip to content

Commit

Permalink
fix: don't read average value of rotation params, only read first
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Aug 20, 2024
1 parent 342f89f commit b3978f8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/ess/amor/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,13 @@ def load_amor_ch_frequency(ch: RawChopper[RunType]) -> ChopperFrequency[RunType]
def load_amor_sample_rotation(fp: Filename[RunType]) -> SampleRotation[RunType]:
(mu,) = load_nx(fp, "NXentry/NXinstrument/master_parameters/mu")
# For some reason this is length 1 and not scalar sometimes
if mu["value"].coords["average_value"].dims != ():
mu = mu["value"].coords["average_value"].values[0]
else:
mu = mu["value"].coords["average_value"].value
return sc.scalar(mu, unit="deg")
return sc.scalar(mu['value'].data['dim_1', 0]['time', 0].value, unit='deg')


def load_amor_detector_rotation(fp: Filename[RunType]) -> DetectorRotation[RunType]:
(nu,) = load_nx(fp, "NXentry/NXinstrument/master_parameters/nu")
# For some reason this is length 1 and not scalar sometimes
if nu["value"].coords["average_value"].dims != ():
nu = nu["value"].coords["average_value"].values[0]
else:
nu = nu["value"].coords["average_value"].value
return sc.scalar(nu, unit="deg")
return sc.scalar(nu['value'].data['dim_1', 0]['time', 0].value, unit='deg')


providers = (
Expand Down

0 comments on commit b3978f8

Please sign in to comment.