Skip to content

Commit 4f6e81b

Browse files
committed
hotfix utils
1 parent dce80ab commit 4f6e81b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

intvalpy/kernel/utils.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22

3-
from .real_intervals import Interval, ARITHMETICS
3+
from .real_intervals import Interval, ARITHMETICS, INTERVAL_CLASSES
44
from .preprocessing import asinterval
55

66

@@ -94,6 +94,8 @@ def _wid(x):
9494
return x
9595

9696
if hasattr(x, '__iter__'):
97+
if isinstance(x, INTERVAL_CLASSES):
98+
x = x.data
9799
return np.vectorize(_wid)(x)
98100
else:
99101
return _wid(x)
@@ -107,6 +109,8 @@ def _mid(x):
107109
return x
108110

109111
if hasattr(x, '__iter__'):
112+
if isinstance(x, INTERVAL_CLASSES):
113+
x = x.data
110114
return np.vectorize(_mid)(x)
111115
else:
112116
return _mid(x)
@@ -120,6 +124,8 @@ def _rad(x):
120124
return x
121125

122126
if hasattr(x, '__iter__'):
127+
if isinstance(x, INTERVAL_CLASSES):
128+
x = x.data
123129
return np.vectorize(_rad)(x)
124130
else:
125131
return _rad(x)
@@ -133,6 +139,8 @@ def _inf(x):
133139
return x
134140

135141
if hasattr(x, '__iter__'):
142+
if isinstance(x, INTERVAL_CLASSES):
143+
x = x.data
136144
return np.vectorize(_inf)(x)
137145
else:
138146
return _inf(x)
@@ -146,6 +154,8 @@ def _sup(x):
146154
return x
147155

148156
if hasattr(x, '__iter__'):
157+
if isinstance(x, INTERVAL_CLASSES):
158+
x = x.data
149159
return np.vectorize(_sup)(x)
150160
else:
151161
return _sup(x)
@@ -159,6 +169,8 @@ def _mag(x):
159169
return x
160170

161171
if hasattr(x, '__iter__'):
172+
if isinstance(x, INTERVAL_CLASSES):
173+
x = x.data
162174
return np.vectorize(_mag)(x)
163175
else:
164176
return _mag(x)

0 commit comments

Comments
 (0)