Spaces:
Sleeping
Sleeping
jerome-white
commited on
Commit
•
39f7fd8
1
Parent(s):
8292a15
Better error handling
Browse files- hdinterval.py +3 -1
hdinterval.py
CHANGED
@@ -65,6 +65,8 @@ class HDInterval:
|
|
65 |
return self._at(target, tolerance, ci, jump)
|
66 |
|
67 |
def at(self, target, tolerance=1e-3):
|
|
|
|
|
68 |
while tolerance < 1:
|
69 |
try:
|
70 |
return self._at(target, tolerance, 1, 1)
|
@@ -72,4 +74,4 @@ class HDInterval:
|
|
72 |
tolerance *= 10
|
73 |
warnings.warn(f'Tolerance reduced: {tolerance}')
|
74 |
|
75 |
-
raise OverflowError()
|
|
|
65 |
return self._at(target, tolerance, ci, jump)
|
66 |
|
67 |
def at(self, target, tolerance=1e-3):
|
68 |
+
assert tolerance > 0
|
69 |
+
|
70 |
while tolerance < 1:
|
71 |
try:
|
72 |
return self._at(target, tolerance, 1, 1)
|
|
|
74 |
tolerance *= 10
|
75 |
warnings.warn(f'Tolerance reduced: {tolerance}')
|
76 |
|
77 |
+
raise OverflowError('Unable to converge')
|