11import numpy as np
22
3- from .real_intervals import Interval , ARITHMETICS
3+ from .real_intervals import Interval , ARITHMETICS , INTERVAL_CLASSES
44from .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