Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast to numpy.string_ for comparison #190

Merged
merged 2 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions format/nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def visit(self, nx_file, depends_on):
elif ttype == numpy.string_("rotation"):
if hasattr(value, "__iter__") and len(value):
value = value[0]
if units == "rad":
if numpy.string_(units) == numpy.string_("rad"):
deg = False
elif units == "deg":
elif numpy.string_(units) == numpy.string_("deg"):
deg = True
else:
raise RuntimeError("Invalid units: %s" % units)
Expand Down
1 change: 1 addition & 0 deletions newsfragments/190.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In reading NeXus files: convert unit to numpy.string_ for comparison