8000 FIX: Add unitless comparison operators to Quantity class · matplotlib/matplotlib@f716ea3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f716ea3

Browse files
committed
FIX: Add unitless comparison operators to Quantity class
1 parent 4e8972d commit f716ea3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/tests/test_image.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,11 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
11831183
unit = f"{u0}*{u1}"
11841184
elif ufunc == np.divide:
11851185
unit = f"{u0}/({u1})"
1186+
elif ufunc in (np.greater, np.greater_equal,
1187+
np.equal, np.not_equal,
1188+
np.less, np.less_equal):
1189+
# Comparisons produce unitless booleans for output
1190+
unit = None
11861191
else:
11871192
return NotImplemented
11881193
out_arr = func(i0.view(np.ndarray), i1.view(np.ndarray), **kwargs)

0 commit comments

Comments
 (0)
0