Skip to content

Commit 53298da

Browse files
committed
Account for change in scipy solver API
`tol=` -> `rtol=` in SciPy 1.12 http://docs.scipy.org/doc/scipy-1.12.0/release/1.12.0-notes.html#deprecated-features
1 parent 8c0aec6 commit 53298da

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

fipy/solvers/scipy/scipyKrylovSolver.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77

88
import os
99
import warnings
10+
import scipy
1011

1112
from .scipySolver import ScipySolver
1213
from fipy.tools import numerix
14+
from fipy.tools.version import Version, parse_version
15+
16+
scipy_has_tol = (parse_version(scipy.__version__) < Version("1.12"))
1317

1418
class ScipyKrylovSolver(ScipySolver):
1519
"""
@@ -58,12 +62,17 @@ def _solve_(self, L, x, b):
5862
self._log.debug("END precondition")
5963
self._log.debug("BEGIN solve")
6064

61-
x, info = self.solveFnc(A, b, x,
62-
tol=rtol,
65+
if scipy_has_tol:
66+
tolerance = dict(tol=rtol)
67+
else:
68+
tolerance = dict(rtol=rtol)
69+
70+
x, info = self.solveFnc(L, b, x,
6371
atol=self.absolute_tolerance,
6472
maxiter=self.iterations,
6573
M=M,
66-
callback=self._countIterations)
74+
callback=self._countIterations,
75+
**tolerance)
6776

6877
self._log.debug("END solve")
6978

0 commit comments

Comments
 (0)