[7.0.0rc1] One TestFittable1DModels.test_fitter1D test fails on i386 · Issue #17362 · astropy/astropy · GitHub
Skip to content

[7.0.0rc1] One TestFittable1DModels.test_fitter1D test fails on i386 #17362

Description

@olebole

Description

One of the TestFittable1DModels.test_fitter1D tests fail when building for the Debians i386 platform. It is to note that the other 32-bit platforms pass, so the problem is probably not 32-bit specific, but rather some instability due to different floating point accuracy on i386.

_ TestFittable1DModels.test_fitter1D[TRFLSQFitter-BrokenPowerLaw1D-test_parameters22] _

self = <astropy.modeling.tests.test_models.TestFittable1DModels object at 0xea0769f0>
model_class = <class 'astropy.modeling.powerlaws.BrokenPowerLaw1D'>
Name: BrokenPowerLaw1D
N_inputs: 1
N_outputs: 1
Fittable parameters: ('amplitude', 'x_break', 'alpha_1', 'alpha_2')
test_parameters = {'constraints': {'fixed': {'x_break': True}}, 'log_fit': True, 'parameters': [1, 1, 2, 3], 'x_lim': [0.1, 100], ...}
fitter = <astropy.modeling.fitting.TRFLSQFitter object at 0xe3f80ff0>

    @pytest.mark.skipif(not HAS_SCIPY, reason="requires scipy")
    @pytest.mark.parametrize("fitter", fitters)
    def test_fitter1D(self, model_class, test_parameters, fitter):
        […]

        # Only check parameters that were free in the fit
        params = [getattr(new_model, name) for name in new_model.param_names]
        fixed = [param.fixed for param in params]
        expected = np.array([val for val, fixed in zip(parameters, fixed) if not fixed])
        fitted = np.array([param.value for param in params if not param.fixed])
>       assert_allclose(fitted, expected, atol=self.fit_error)

astropy/modeling/tests/test_models.py:563: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0xe43447a8>, array([1.01891127, 5.74160458, 3.0054199 ]), array([1, 2, 3]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0.11', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=0.11
E           
E           Mismatched elements: 1 / 3 (33.3%)
E           Max absolute difference: 3.74160458
E           Max relative difference: 1.87080229
E            x: array([1.018911, 5.741605, 3.00542 ])
E            y: array([1, 2, 3])

/usr/lib/python3.12/contextlib.py:81: AssertionError

Full build log

Expected behavior

Test should pass. However I am not sure whether this is just a problem of the test of an instability of the fitter.

How to Reproduce

Run the tests on Debian/sid, i386, with all packages installed as Debian packages

Versions

Python 3.12.7

Numpy: 1.26.4
Scipy: 1.13.1
Matplotlib: 3.8.3
h5py: 3.11.0
Pandas: not available
PyERFA: 2.0.1.4
Cython: 3.0.11
Scikit-image: 0.24.0
asdf-astropy: not available

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions