Skip to content

Commit

Permalink
Merge pull request #38 from scipp/fix-chopper-check
Browse files Browse the repository at this point in the history
fix: don't assume log has value field
  • Loading branch information
jokasimr authored Oct 28, 2024
2 parents d642376 + 63a94c7 commit 7cfa07c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/chexus/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,15 @@ def validate(self, node: Dataset | Group) -> Violation | None:
import scipp as sc

rotation_speed = node.children.get("rotation_speed")
if "NXlog" == rotation_speed.attrs.get("NX_class"):
unit = rotation_speed.children.get("value").attrs.get("units")
else:
if (
"NXlog" == rotation_speed.attrs.get("NX_class")
and "value" in rotation_speed.children
):
unit = rotation_speed.children["value"].attrs.get("units")
elif "NXlog" != rotation_speed.attrs.get("NX_class"):
unit = rotation_speed.attrs.get("units")
else:
return
try:
sc.scalar(1, unit=unit).to(unit="Hz")
except sc.UnitError:
Expand Down

0 comments on commit 7cfa07c

Please sign in to comment.