-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The test emits RuntimeWarning: Maximum number of iterations has been exceeded. Should get looked at before scipy releases for real. @WilliamJamieson , any ideas? Thanks!
Package versions:
Numpy: 1.23.0
Scipy: 1.9.0rc1
Matplotlib: 3.5.1
h5py: 3.7.0
Pandas: 1.4.3
PyERFA: 2.0.0.1
Cython: not available
Scikit-image: not available
asdf: 2.12.0
pyarrow: 8.0.0
___________________ test_fitters_interface[SimplexLSQFitter] ___________________
fitter = <astropy.modeling.fitting.SimplexLSQFitter object at 0x7f1e7b42db70>
@pytest.mark.skipif('not HAS_SCIPY')
@pytest.mark.filterwarnings('ignore:The fit may be unsuccessful')
@pytest.mark.parametrize('fitter', non_linear_fitters + fitters)
def test_fitters_interface(fitter):
"""
Test that ``**kwargs`` work with all optimizers.
This is a basic smoke test.
"""
fitter = fitter()
model = models.Gaussian1D(10, 4, .3)
x = np.arange(21)
y = model(x)
if isinstance(fitter, SimplexLSQFitter):
kwargs = {'maxiter': 77, 'verblevel': 1, 'acc': 1e-6}
else:
kwargs = {'maxiter': 77, 'verblevel': 1, 'epsilon': 1e-2, 'acc': 1e-6}
if isinstance(fitter, LevMarLSQFitter) or isinstance(fitter, _NLLSQFitter):
kwargs.pop('verblevel')
> _ = fitter(model, x, y, **kwargs)
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/astropy/modeling/tests/test_fitters.py:1025:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/astropy/modeling/fitting.py:269: in wrapper
return func(self, model, x, y, z=z, **kwargs)
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/astropy/modeling/fitting.py:1600: in __call__
fitparams, self.fit_info = self._opt_method(
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/astropy/modeling/optimizers.py:231: in __call__
fitparams, final_func_val, numiter, funcalls, exit_mode = self.opt_method(
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/scipy/optimize/_optimize.py:622: in fmin
res = _minimize_neldermead(func, x0, args, callback=callback, **opts)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = <function _wrap_scalar_function_maxfun_validation.<locals>.function_wrapper at 0x7f1e79c295a0>
x0 = array([10. , 4. , 0.3])
args = (<Gaussian1D(amplitude=9.99999979, mean=3.99999954, stddev=0.3000004)>, None, array([ 0., 1., 2., 3., 4., 5., 6...., 1.14[1821](https://github.com/astropy/astropy/runs/7051264253?check_suite_focus=true#step:6:1822)66e-291,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
0.00000000e+000]))
callback = None, maxiter = 77, maxfev = None, disp = 1, return_all = 0
initial_simplex = None, xatol = 1e-06, fatol = 0.0001, adaptive = False
bounds = None, unknown_options = {}, maxfun = inf, retall = 0, rho = 1, chi = 2
psi = 0.5, sigma = 0.5
def _minimize_neldermead(func, x0, args=(), callback=None,
maxiter=None, maxfev=None, disp=False,
return_all=False, initial_simplex=None,
xatol=1e-4, fatol=1e-4, adaptive=False, bounds=None,
**unknown_options):
...
elif iterations >= maxiter:
warnflag = 2
msg = _status_message['maxiter']
if disp:
> warnings.warn(msg, RuntimeWarning, 3)
E RuntimeWarning: Maximum number of iterations has been exceeded.
../../.tox/py310-test-alldeps-predeps/lib/python3.10/site-packages/scipy/optimize/_optimize.py:874: RuntimeWarning
Reactions are currently unavailable