Skip to content

python3Packages.scipy: Disable tests on i686#277306

Closed
eliandoran wants to merge 1 commit intoNixOS:masterfrom
eliandoran:feature/numpy_i686
Closed

python3Packages.scipy: Disable tests on i686#277306
eliandoran wants to merge 1 commit intoNixOS:masterfrom
eliandoran:feature/numpy_i686

Conversation

@eliandoran
Copy link
Contributor

Description of changes

scipy fails on nixos-23.11 (i686-linux) with the following error:

[gw0] linux -- Python 3.11.6 /nix/store/i07jalkvz6ynwsck43yigmcyawnhbwl2-python3-3.11.6/bin/python3.11
lib/python3.11/site-packages/scipy/sparse/linalg/_isolve/tests/test_iterative.py:532: in test_x0_equals_Mb
    assert info == 0
E   assert -11 == 0
        A          = <10x10 sparse matrix of type '<class 'numpy.complex64'>'
	with 19 stored elements in Compressed Sparse Row format>
        b          = array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
        case       = <nonsymposdef-F>
        info       = -11
        solver     = <function bicgstab at 0xf2167208>
        sup        = <numpy.testing._private.utils.suppress_warnings object at 0xd72aa950>
        tol        = 1e-08
        x          = array([0.        +0.j, 0.49999272+0.j, 1.25007169+0.j, 2.12617093+0.j,
       3.06661642+0.j, 4.03650608+0.j, 5.01656828+0.j, 6.00407387+0.j,
       7.        +0.j, 8.        +0.j])
        x0         = 'Mb'
=========================== short test summary info ============================
FAILED lib/python3.11/site-packages/scipy/signal/tests/test_filter_design.py::TestCheby1::test_basic - AssertionError: 
FAILED lib/python3.11/site-packages/scipy/sparse/linalg/_isolve/tests/test_iterative.py::test_x0_equals_Mb[bicgstab-nonsymposdef-F] - assert -11 == 0
= 2 failed, 42282 passed, 2687 skipped, 484 xfailed, 11 xpassed in 579.05s (0:09:39) =

The errors can be tracked down to two issues in upstream, #12931 and #17912. One of them should have already been fixed by a bump of numpy (but it didn't seem to work). Disabling them on i686 allows the build to run.

The build for scipy does not work on master at the moment since it fails with:

[ 10%] Building CXX object test/CMakeFiles/test_xsimd.dir/test_api.cpp.o
In file included from /build/source/include/xsimd/types/../arch/./xsimd_generic.hpp:18,
                 from /build/source/include/xsimd/types/../arch/xsimd_isa.hpp:88,
                 from /build/source/include/xsimd/types/xsimd_batch.hpp:491,
                 from /build/source/include/xsimd/xsimd.hpp:61,
                 from /build/source/test/test_basic_math.cpp:12:
/build/source/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp: In function 'xsimd::batch<float, A> xsimd::kernel::cbrt(const xsimd::batch<float, A>&, requires_arch<xsimd::generic>)':
/build/source/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:152:45: error: 'batch_bool_cast' was not declared in this scope; did you mean 'batch_cast'?
  152 |             const batch_type cbrt2 = select(batch_bool_cast<float>(flag), CBRT2, CBRT2I);
      |                                             ^~~~~~~~~~~~~~~
      |                                             batch_cast
/build/source/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:152:61: error: expected primary-expression before 'float'
  152 |             const batch_type cbrt2 = select(batch_bool_cast<float>(flag), CBRT2, CBRT2I);
      |                                                             ^~~~~

This is an upstream bug in xsimd that was fixed in a later version (see xtensor-stack/xsimd#986). This is already done in nixpkgs in #272992, but it's not available yet in master (it's in staging). Combined with this, the scipy builds successfully on i686.

Things done

  • Built on platform(s)
    • i686-linux
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Dec 28, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Dec 28, 2023
@eliandoran eliandoran force-pushed the feature/numpy_i686 branch 3 times, most recently from a21fe4d to e0d3df4 Compare December 31, 2023 23:05
@eliandoran
Copy link
Contributor Author

@SuperSandro2000 , done. Please re-review.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 8, 2024
@delroth delroth removed the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 9, 2024
@SuperSandro2000
Copy link
Member

@ofborg build pkgsi686Linux.python3Packages.scipy

@SuperSandro2000
Copy link
Member

Fails again :/


=================================== FAILURES ===================================
_______ test_boost[<Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>] ________
[gw0] linux -- Python 3.11.7 /nix/store/g2b4np3892nwnfj2dwmvywg19p8g0jp5-python3-3.11.7/bin/python3.11
lib/python3.11/site-packages/scipy/special/tests/test_data.py:565: in test_boost
    _test_factory(test)
        test       = <Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>
lib/python3.11/site-packages/scipy/special/tests/test_data.py:613: in _test_factory
    test.check(dtype=dtype)
E   AssertionError: 
E   Max |adiff|: 5.32907e-15
E   Max |rdiff|: 5.16203e-16
E   Bad results (1 out of 252) for the following points (in output 0):
E                304.2257080078125               63.23591613769531                              0. =>             10.323591122289685 !=              10.32359112228969  (rdiff           5.16203175336414e-16)
        dtype      = <class 'numpy.float64'>
        sup        = <numpy.testing._private.utils.suppress_warnings object at 0xc470fa50>
        test       = <Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>
_ TestLevyStable.test_distribution_outside_support[pdf--1.0-points3-0.0-0.75] __
[gw61] linux -- Python 3.11.7 /nix/store/g2b4np3892nwnfj2dwmvywg19p8g0jp5-python3-3.11.7/bin/python3.11
lib/python3.11/site-packages/scipy/stats/tests/test_distributions.py:5233: in test_distribution_outside_support
    assert_almost_equal(
        alpha      = 0.75
        beta       = -1.0
        expected   = 0.0
        function   = <bound method levy_stable_gen.pdf of <scipy.stats._levy_stable.levy_stable_gen object at 0xce486f70>>
        points     = array([ 0.        ,  2.77777778,  5.55555556,  8.33333333, 11.11111111,
       13.88888889, 16.66666667, 19.44444444, 22.22222222, 25.        ])
        self       = <scipy.stats.tests.test_distributions.TestLevyStable object at 0xc6e4f890>
../g2b4np3892nwnfj2dwmvywg19p8g0jp5-python3-3.11.7/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
        args       = (array([0.25246025, 0.        , 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.        , 0.        ]),
 array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]))
        func       = <function assert_almost_equal at 0xe3584208>
        kwds       = {}
        self       = <contextlib._GeneratorContextManager object at 0xe35f6f90>
../g2b4np3892nwnfj2dwmvywg19p8g0jp5-python3-3.11.7/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
        args       = (array([0.25246025, 0.        , 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.        , 0.        ]),
 array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]),
 7,
 '')
        func       = <function assert_array_almost_equal at 0xe3584438>
        kwds       = {}
        self       = <contextlib._GeneratorContextManager object at 0xe35f6f50>
../g2b4np3892nwnfj2dwmvywg19p8g0jp5-python3-3.11.7/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Arrays are not almost equal to 7 decimals
E   
E   Mismatched elements: 1 / 10 (10%)
E   Max absolute difference: 0.25246025
E   Max relative difference: inf
E    x: array([0.2524602, 0.       , 0.       , 0.       , 0.       , 0.       ,
E          0.       , 0.       , 0.       , 0.       ])
E    y: array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
        args       = (<function assert_array_almost_equal.<locals>.compare at 0xd09f1a28>,
 array([0.25246025, 0.        , 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.        , 0.        ]),
 array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]))
        func       = <function assert_array_compare at 0xe3584348>
        kwds       = {'err_msg': '',
 'header': 'Arrays are not almost equal to 7 decimals',
 'precision': 7,
 'verbose': True}
        self       = <contextlib._GeneratorContextManager object at 0xe35f6f70>
=========================== short test summary info ============================
FAILED lib/python3.11/site-packages/scipy/special/tests/test_data.py::test_boost[<Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>] - AssertionError: 
FAILED lib/python3.11/site-packages/scipy/stats/tests/test_distributions.py::TestLevyStable::test_distribution_outside_support[pdf--1.0-points3-0.0-0.75] - AssertionError: 
= 2 failed, 39625 passed, 2253 skipped, 481 xfailed, 10 xpassed in 521.59s (0:08:41) =
error: builder for '/nix/store/xyigsd9bsx7zl0ds6njbl77313mia0hm-python3.11-scipy-1.11.4.drv' failed with exit code 1;

@doronbehar
Copy link
Contributor

Hey, let's revise this in scipy's update to staging what do you think? Here's a PR:

#282506

@doronbehar
Copy link
Contributor

On staging, with scipy 1.12.0:

scipy-i686-linux> =================================== FAILURES ===================================
scipy-i686-linux> ____________________________ TestCheby1.test_basic _____________________________
scipy-i686-linux> [gw0] linux -- Python 3.10.13 /nix/store/r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/bin/python3.10
scipy-i686-linux>
scipy-i686-linux> self = <scipy.signal.tests.test_filter_design.TestCheby1 object at 0xcb725e80>
scipy-i686-linux>
scipy-i686-linux>     def test_basic(self):
scipy-i686-linux>         for N in range(25):
scipy-i686-linux>             wn = 0.01
scipy-i686-linux>             z, p, k = cheby1(N, 1, wn, 'low', analog=True, output='zpk')
scipy-i686-linux>             assert_array_almost_equal([], z)
scipy-i686-linux>             assert_(len(p) == N)
scipy-i686-linux>             assert_(all(np.real(p) <= 0))  # No poles in right half of S-plane
scipy-i686-linux>
scipy-i686-linux>         for N in range(25):
scipy-i686-linux>             wn = 0.01
scipy-i686-linux>             z, p, k = cheby1(N, 1, wn, 'high', analog=False, output='zpk')
scipy-i686-linux>             assert_array_equal(np.ones(N), z)  # All zeros exactly at DC
scipy-i686-linux>             assert_(all(np.abs(p) <= 1))  # No poles outside unit circle
scipy-i686-linux>
scipy-i686-linux>         # Same test as TestNormalize
scipy-i686-linux>         b, a = cheby1(8, 0.5, 0.048)
scipy-i686-linux>         assert_array_almost_equal(b, [
scipy-i686-linux>                              2.150733144728282e-11, 1.720586515782626e-10,
scipy-i686-linux>                              6.022052805239190e-10, 1.204410561047838e-09,
scipy-i686-linux>                              1.505513201309798e-09, 1.204410561047838e-09,
scipy-i686-linux>                              6.022052805239190e-10, 1.720586515782626e-10,
scipy-i686-linux>                              2.150733144728282e-11], decimal=14)
scipy-i686-linux> >       assert_array_almost_equal(a, [
scipy-i686-linux>                              1.000000000000000e+00, -7.782402035027959e+00,
scipy-i686-linux>                              2.654354569747454e+01, -5.182182531666387e+01,
scipy-i686-linux>                              6.334127355102684e+01, -4.963358186631157e+01,
scipy-i686-linux>                              2.434862182949389e+01, -6.836925348604676e+00,
scipy-i686-linux>                              8.412934944449140e-01], decimal=14)
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/signal/tests/test_filter_design.py:2732:
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux> ../r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/lib/python3.10/contextlib.py:79: in inner
scipy-i686-linux>     return func(*args, **kwds)
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux>
scipy-i686-linux> args = (<function assert_array_almost_equal.<locals>.compare at 0xa72762b0>, array([  1.        ,  -7.78240204,  26.5435457 ,...129349]), [1.0, -7.782402035027959, 26.54354569747454, -51.82182531666387, 63.34127355102684, -49.63358186631157, ...])
scipy-i686-linux> kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 14 decimals', 'precision': 14, 'verbose': True}
scipy-i686-linux>
scipy-i686-linux>     @wraps(func)
scipy-i686-linux>     def inner(*args, **kwds):
scipy-i686-linux>         with self._recreate_cm():
scipy-i686-linux> >           return func(*args, **kwds)
scipy-i686-linux> E           AssertionError:
scipy-i686-linux> E           Arrays are not almost equal to 14 decimals
scipy-i686-linux> E
scipy-i686-linux> E           Mismatched elements: 1 / 9 (11.1%)
scipy-i686-linux> E           Max absolute difference: 2.13162821e-14
scipy-i686-linux> E           Max relative difference: 3.36530683e-16
scipy-i686-linux> E            x: array([  1.              ,  -7.78240203502796,  26.54354569747454,
scipy-i686-linux> E                  -51.82182531666388,  63.34127355102686, -49.63358186631158,
scipy-i686-linux> E                   24.3486218294939 ,  -6.83692534860468,   0.84129349444491])
scipy-i686-linux> E            y: array([  1.              ,  -7.78240203502796,  26.54354569747454,
scipy-i686-linux> E                  -51.82182531666387,  63.34127355102684, -49.63358186631157,
scipy-i686-linux> E                   24.34862182949389,  -6.83692534860468,   0.84129349444491])
scipy-i686-linux>
scipy-i686-linux> ../r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/lib/python3.10/contextlib.py:79: AssertionError
scipy-i686-linux> _______ test_boost[<Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>] ________
scipy-i686-linux> [gw0] linux -- Python 3.10.13 /nix/store/r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/bin/python3.10
scipy-i686-linux>
scipy-i686-linux> test = <Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>
scipy-i686-linux>
scipy-i686-linux>     @pytest.mark.parametrize('test', BOOST_TESTS, ids=repr)
scipy-i686-linux>     def test_boost(test):
scipy-i686-linux>         # Filter deprecation warnings of any deprecated functions.
scipy-i686-linux>         if test.func in [btdtr, btdtri, btdtri_comp]:
scipy-i686-linux>             with pytest.deprecated_call():
scipy-i686-linux>                 _test_factory(test)
scipy-i686-linux>         else:
scipy-i686-linux> >           _test_factory(test)
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/special/tests/test_data.py:665:
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux>
scipy-i686-linux> test = <Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>
scipy-i686-linux> dtype = <class 'numpy.float64'>
scipy-i686-linux>
scipy-i686-linux>     def _test_factory(test, dtype=np.float64):
scipy-i686-linux>         """Boost test"""
scipy-i686-linux>         with suppress_warnings() as sup:
scipy-i686-linux>             sup.filter(IntegrationWarning, "The occurrence of roundoff error is detected")
scipy-i686-linux>             with np.errstate(all='ignore'):
scipy-i686-linux> >               test.check(dtype=dtype)
scipy-i686-linux> E               AssertionError:
scipy-i686-linux> E               Max |adiff|: 5.32907e-15
scipy-i686-linux> E               Max |rdiff|: 5.16203e-16
scipy-i686-linux> E               Bad results (1 out of 252) for the following points (in output 0):
scipy-i686-linux> E                            304.2257080078125               63.23591613769531                              0. =>             10.323591122289685 !=              10.32359112228969  (rdiff           5.16203175336414e-16)
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/special/tests/test_data.py:717: AssertionError
scipy-i686-linux> __ TestLevyStable.test_pdf_nolan_samples[pct_range1-alpha_range1-beta_range1] __
scipy-i686-linux> [gw0] linux -- Python 3.10.13 /nix/store/r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/bin/python3.10
scipy-i686-linux>
scipy-i686-linux> self = <scipy.stats.tests.test_distributions.TestLevyStable object at 0xc4eccdf0>
scipy-i686-linux> nolan_pdf_sample_data = rec.array([(-5.54809272e+19, 1.79355106e-23, 0.1, -1., 0.01),
scipy-i686-linux>            (-1.93540945e-07, 2.45039317e+04, 0.1, -1., 0...-02, 2. ,  1., 0.95)],
scipy-i686-linux>           dtype=[('x', '<f8'), ('p', '<f8'), ('alpha', '<f8'), ('beta', '<f8'), ('pct', '<f8')])
scipy-i686-linux> pct_range = [0.01, 0.05, 0.5, 0.95, 0.99], alpha_range = [0.1, 0.5, 1, 1.5, 2]
scipy-i686-linux> beta_range = [-0.9, -0.5, 0, 0.3, 0.6, 1]
scipy-i686-linux>
scipy-i686-linux>     @pytest.mark.parametrize(
scipy-i686-linux>         "pct_range,alpha_range,beta_range", [
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .5, .99],
scipy-i686-linux>                 [.1, 1, 2],
scipy-i686-linux>                 [-1, 0, .8],
scipy-i686-linux>             ),
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .05, .5, .95, .99],
scipy-i686-linux>                 [.1, .5, 1, 1.5, 2],
scipy-i686-linux>                 [-.9, -.5, 0, .3, .6, 1],
scipy-i686-linux>                 marks=pytest.mark.slow
scipy-i686-linux>             ),
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .05, .1, .25, .35, .5, .65, .75, .9, .95, .99],
scipy-i686-linux>                 np.linspace(0.1, 2, 20),
scipy-i686-linux>                 np.linspace(-1, 1, 21),
scipy-i686-linux>                 marks=pytest.mark.xslow,
scipy-i686-linux>             ),
scipy-i686-linux>         ]
scipy-i686-linux>     )
scipy-i686-linux>     def test_pdf_nolan_samples(
scipy-i686-linux>             self, nolan_pdf_sample_data, pct_range, alpha_range, beta_range
scipy-i686-linux>     ):
scipy-i686-linux>         """Test pdf values against Nolan's stablec.exe output"""
scipy-i686-linux>         data = nolan_pdf_sample_data
scipy-i686-linux>
scipy-i686-linux>         # some tests break on linux 32 bit
scipy-i686-linux>         uname = platform.uname()
scipy-i686-linux>         is_linux_32 = uname.system == 'Linux' and uname.machine == 'i686'
scipy-i686-linux>         platform_desc = "/".join(
scipy-i686-linux>             [uname.system, uname.machine, uname.processor])
scipy-i686-linux>
scipy-i686-linux>         # fmt: off
scipy-i686-linux>         # There are a number of cases which fail on some but not all platforms.
scipy-i686-linux>         # These are excluded by the filters below. TODO: Rewrite tests so that
scipy-i686-linux>         # the now filtered out test cases are still run but marked in pytest as
scipy-i686-linux>         # expected to fail.
scipy-i686-linux>         tests = [
scipy-i686-linux>             [
scipy-i686-linux>                 'dni', 1e-7, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     ~(
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['beta'] == 0) &
scipy-i686-linux>                             (r['pct'] == 0.5)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['beta'] >= 0.9) &
scipy-i686-linux>                             (r['alpha'] >= 1.6) &
scipy-i686-linux>                             (r['pct'] == 0.5)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] <= 0.4) &
scipy-i686-linux>                             np.isin(r['pct'], [.01, .99])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] <= 0.3) &
scipy-i686-linux>                             np.isin(r['pct'], [.05, .95])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] <= 0.2) &
scipy-i686-linux>                             np.isin(r['pct'], [.1, .9])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.1) &
scipy-i686-linux>                             np.isin(r['pct'], [.25, .75]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [.5, .6, .7])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.1) &
scipy-i686-linux>                             np.isin(r['pct'], [.5]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [.1])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.1) &
scipy-i686-linux>                             np.isin(r['pct'], [.35, .65]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [-.4, -.3, .3, .4, .5])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.2) &
scipy-i686-linux>                             (r['beta'] == 0.5) &
scipy-i686-linux>                             (r['pct'] == 0.25)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.2) &
scipy-i686-linux>                             (r['beta'] == -0.3) &
scipy-i686-linux>                             (r['pct'] == 0.65)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 0.2) &
scipy-i686-linux>                             (r['beta'] == 0.3) &
scipy-i686-linux>                             (r['pct'] == 0.35)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 1.) &
scipy-i686-linux>                             np.isin(r['pct'], [.5]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [.1, .2, .3, .4])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 1.) &
scipy-i686-linux>                             np.isin(r['pct'], [.35, .65]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [.8, .9, 1.])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 1.) &
scipy-i686-linux>                             np.isin(r['pct'], [.01, .99]) &
scipy-i686-linux>                             np.isin(np.abs(r['beta']), [-.1, .1])
scipy-i686-linux>                         ) |
scipy-i686-linux>                         # various points ok but too sparse to list
scipy-i686-linux>                         (r['alpha'] >= 1.1)
scipy-i686-linux>                     )
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # piecewise generally good accuracy
scipy-i686-linux>             [
scipy-i686-linux>                 'piecewise', 1e-11, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 0.2) &
scipy-i686-linux>                     (r['alpha'] != 1.)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # for alpha = 1. for linux 32 bit optimize.bisect
scipy-i686-linux>             # has some issues for .01 and .99 percentile
scipy-i686-linux>             [
scipy-i686-linux>                 'piecewise', 1e-11, lambda r: (
scipy-i686-linux>                     (r['alpha'] == 1.) &
scipy-i686-linux>                     (not is_linux_32) &
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     (1. in alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # for small alpha very slightly reduced accuracy
scipy-i686-linux>             [
scipy-i686-linux>                 'piecewise', 2.5e-10, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] <= 0.2)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # fft accuracy reduces as alpha decreases
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-5, lambda r: (
scipy-i686-linux>                     (r['alpha'] >= 1.9) &
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range)
scipy-i686-linux>                 ),
scipy-i686-linux>             ],
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-6, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 1) &
scipy-i686-linux>                     (r['alpha'] < 1.9)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # fft relative errors for alpha < 1, will raise if enabled
scipy-i686-linux>             # ['fft-simpson', 1e-4, lambda r: r['alpha'] == 0.9],
scipy-i686-linux>             # ['fft-simpson', 1e-3, lambda r: r['alpha'] == 0.8],
scipy-i686-linux>             # ['fft-simpson', 1e-2, lambda r: r['alpha'] == 0.7],
scipy-i686-linux>             # ['fft-simpson', 1e-1, lambda r: r['alpha'] == 0.6],
scipy-i686-linux>         ]
scipy-i686-linux>         # fmt: on
scipy-i686-linux>         for ix, (default_method, rtol,
scipy-i686-linux>                  filter_func) in enumerate(tests):
scipy-i686-linux>             stats.levy_stable.pdf_default_method = default_method
scipy-i686-linux>             subdata = data[filter_func(data)
scipy-i686-linux>                            ] if filter_func is not None else data
scipy-i686-linux>             with suppress_warnings() as sup:
scipy-i686-linux>                 # occurs in FFT methods only
scipy-i686-linux>                 sup.record(
scipy-i686-linux>                     RuntimeWarning,
scipy-i686-linux>                     "Density calculations experimental for FFT method.*"
scipy-i686-linux>                 )
scipy-i686-linux> >               p = stats.levy_stable.pdf(
scipy-i686-linux>                     subdata['x'],
scipy-i686-linux>                     subdata['alpha'],
scipy-i686-linux>                     subdata['beta'],
scipy-i686-linux>                     scale=1,
scipy-i686-linux>                     loc=0
scipy-i686-linux>                 )
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/tests/test_distributions.py:5269:
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:870: in pdf
scipy-i686-linux>     return super().pdf(x, *args, **kwds)
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_distn_infrastructure.py:1995: in pdf
scipy-i686-linux>     place(output, cond, self._pdf(*goodargs) / scale)
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:945: in _pdf
scipy-i686-linux>     [
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:946: in <listcomp>
scipy-i686-linux>     pdf_single_value_method(
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:178: in _pdf_single_value_piecewise_Z1
scipy-i686-linux>     return _pdf_single_value_piecewise_Z0(x0, alpha, beta, **kwds)
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:218: in _pdf_single_value_piecewise_Z0
scipy-i686-linux>     return _pdf_single_value_piecewise_post_rounding_Z0(
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:246: in _pdf_single_value_piecewise_post_rounding_Z0
scipy-i686-linux>     return _pdf_single_value_piecewise_post_rounding_Z0(
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_levy_stable/__init__.py:267: in _pdf_single_value_piecewise_post_rounding_Z0
scipy-i686-linux>     peak = optimize.bisect(
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux>
scipy-i686-linux> f = <function _wrap_nan_raise.<locals>.f_raise at 0xa003b898>
scipy-i686-linux> a = -0.5235987755982989, b = 1.5707963267948966, args = (), xtol = 1.2e-14
scipy-i686-linux> rtol = 8.881784197001252e-16, maxiter = 100, full_output = False, disp = True
scipy-i686-linux>
scipy-i686-linux>     def bisect(f, a, b, args=(),
scipy-i686-linux>                xtol=_xtol, rtol=_rtol, maxiter=_iter,
scipy-i686-linux>                full_output=False, disp=True):
scipy-i686-linux>         """
scipy-i686-linux>         Find root of a function within an interval using bisection.
scipy-i686-linux>
scipy-i686-linux>         Basic bisection routine to find a root of the function `f` between the
scipy-i686-linux>         arguments `a` and `b`. `f(a)` and `f(b)` cannot have the same signs.
scipy-i686-linux>         Slow but sure.
scipy-i686-linux>
scipy-i686-linux>         Parameters
scipy-i686-linux>         ----------
scipy-i686-linux>         f : function
scipy-i686-linux>             Python function returning a number.  `f` must be continuous, and
scipy-i686-linux>             f(a) and f(b) must have opposite signs.
scipy-i686-linux>         a : scalar
scipy-i686-linux>             One end of the bracketing interval [a,b].
scipy-i686-linux>         b : scalar
scipy-i686-linux>             The other end of the bracketing interval [a,b].
scipy-i686-linux>         xtol : number, optional
scipy-i686-linux>             The computed root ``x0`` will satisfy ``np.allclose(x, x0,
scipy-i686-linux>             atol=xtol, rtol=rtol)``, where ``x`` is the exact root. The
scipy-i686-linux>             parameter must be positive.
scipy-i686-linux>         rtol : number, optional
scipy-i686-linux>             The computed root ``x0`` will satisfy ``np.allclose(x, x0,
scipy-i686-linux>             atol=xtol, rtol=rtol)``, where ``x`` is the exact root. The
scipy-i686-linux>             parameter cannot be smaller than its default value of
scipy-i686-linux>             ``4*np.finfo(float).eps``.
scipy-i686-linux>         maxiter : int, optional
scipy-i686-linux>             If convergence is not achieved in `maxiter` iterations, an error is
scipy-i686-linux>             raised. Must be >= 0.
scipy-i686-linux>         args : tuple, optional
scipy-i686-linux>             Containing extra arguments for the function `f`.
scipy-i686-linux>             `f` is called by ``apply(f, (x)+args)``.
scipy-i686-linux>         full_output : bool, optional
scipy-i686-linux>             If `full_output` is False, the root is returned. If `full_output` is
scipy-i686-linux>             True, the return value is ``(x, r)``, where x is the root, and r is
scipy-i686-linux>             a `RootResults` object.
scipy-i686-linux>         disp : bool, optional
scipy-i686-linux>             If True, raise RuntimeError if the algorithm didn't converge.
scipy-i686-linux>             Otherwise, the convergence status is recorded in a `RootResults`
scipy-i686-linux>             return object.
scipy-i686-linux>
scipy-i686-linux>         Returns
scipy-i686-linux>         -------
scipy-i686-linux>         root : float
scipy-i686-linux>             Root of `f` between `a` and `b`.
scipy-i686-linux>         r : `RootResults` (present if ``full_output = True``)
scipy-i686-linux>             Object containing information about the convergence. In particular,
scipy-i686-linux>             ``r.converged`` is True if the routine converged.
scipy-i686-linux>
scipy-i686-linux>         Examples
scipy-i686-linux>         --------
scipy-i686-linux>
scipy-i686-linux>         >>> def f(x):
scipy-i686-linux>         ...     return (x**2 - 1)
scipy-i686-linux>
scipy-i686-linux>         >>> from scipy import optimize
scipy-i686-linux>
scipy-i686-linux>         >>> root = optimize.bisect(f, 0, 2)
scipy-i686-linux>         >>> root
scipy-i686-linux>         1.0
scipy-i686-linux>
scipy-i686-linux>         >>> root = optimize.bisect(f, -2, 0)
scipy-i686-linux>         >>> root
scipy-i686-linux>         -1.0
scipy-i686-linux>
scipy-i686-linux>         See Also
scipy-i686-linux>         --------
scipy-i686-linux>         brentq, brenth, bisect, newton
scipy-i686-linux>         fixed_point : scalar fixed-point finder
scipy-i686-linux>         fsolve : n-dimensional root-finding
scipy-i686-linux>
scipy-i686-linux>         """
scipy-i686-linux>         if not isinstance(args, tuple):
scipy-i686-linux>             args = (args,)
scipy-i686-linux>         maxiter = operator.index(maxiter)
scipy-i686-linux>         if xtol <= 0:
scipy-i686-linux>             raise ValueError("xtol too small (%g <= 0)" % xtol)
scipy-i686-linux>         if rtol < _rtol:
scipy-i686-linux>             raise ValueError(f"rtol too small ({rtol:g} < {_rtol:g})")
scipy-i686-linux>         f = _wrap_nan_raise(f)
scipy-i686-linux> >       r = _zeros._bisect(f, a, b, xtol, rtol, maxiter, args, full_output, disp)
scipy-i686-linux> E       ValueError: f(a) and f(b) must have different signs
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/optimize/_zeros_py.py:580: ValueError
scipy-i686-linux> __ TestLevyStable.test_cdf_nolan_samples[pct_range1-alpha_range1-beta_range1] __
scipy-i686-linux> [gw0] linux -- Python 3.10.13 /nix/store/r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/bin/python3.10
scipy-i686-linux>
scipy-i686-linux> self = <scipy.stats.tests.test_distributions.TestLevyStable object at 0xc4d9f040>
scipy-i686-linux> nolan_cdf_sample_data = rec.array([(-5.54809272e+19, 0.01, 0.1, -1., 0.01),
scipy-i686-linux>            (-1.93540945e-07, 0.99, 0.1, -1., 0.99),
scipy-i686-linux>            (-5....95, 2. ,  1., 0.95)],
scipy-i686-linux>           dtype=[('x', '<f8'), ('p', '<f8'), ('alpha', '<f8'), ('beta', '<f8'), ('pct', '<f8')])
scipy-i686-linux> pct_range = [0.01, 0.05, 0.5, 0.95, 0.99], alpha_range = [0.1, 0.5, 1, 1.5, 2]
scipy-i686-linux> beta_range = [-0.9, -0.5, 0, 0.3, 0.6, 1]
scipy-i686-linux>
scipy-i686-linux>     @pytest.mark.parametrize(
scipy-i686-linux>         "pct_range,alpha_range,beta_range", [
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .5, .99],
scipy-i686-linux>                 [.1, 1, 2],
scipy-i686-linux>                 [-1, 0, .8],
scipy-i686-linux>             ),
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .05, .5, .95, .99],
scipy-i686-linux>                 [.1, .5, 1, 1.5, 2],
scipy-i686-linux>                 [-.9, -.5, 0, .3, .6, 1],
scipy-i686-linux>                 marks=pytest.mark.slow
scipy-i686-linux>             ),
scipy-i686-linux>             pytest.param(
scipy-i686-linux>                 [.01, .05, .1, .25, .35, .5, .65, .75, .9, .95, .99],
scipy-i686-linux>                 np.linspace(0.1, 2, 20),
scipy-i686-linux>                 np.linspace(-1, 1, 21),
scipy-i686-linux>                 marks=pytest.mark.xslow,
scipy-i686-linux>             ),
scipy-i686-linux>         ]
scipy-i686-linux>     )
scipy-i686-linux>     def test_cdf_nolan_samples(
scipy-i686-linux>             self, nolan_cdf_sample_data, pct_range, alpha_range, beta_range
scipy-i686-linux>     ):
scipy-i686-linux>         """ Test cdf values against Nolan's stablec.exe output."""
scipy-i686-linux>         data = nolan_cdf_sample_data
scipy-i686-linux>         tests = [
scipy-i686-linux>             # piecewise generally good accuracy
scipy-i686-linux>             [
scipy-i686-linux>                 'piecewise', 2e-12, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     ~(
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 1.) &
scipy-i686-linux>                             np.isin(r['beta'], [-0.3, -0.2, -0.1]) &
scipy-i686-linux>                             (r['pct'] == 0.01)
scipy-i686-linux>                         ) |
scipy-i686-linux>                         (
scipy-i686-linux>                             (r['alpha'] == 1.) &
scipy-i686-linux>                             np.isin(r['beta'], [0.1, 0.2, 0.3]) &
scipy-i686-linux>                             (r['pct'] == 0.99)
scipy-i686-linux>                         )
scipy-i686-linux>                     )
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # for some points with alpha=1, Nolan's STABLE clearly
scipy-i686-linux>             # loses accuracy
scipy-i686-linux>             [
scipy-i686-linux>                 'piecewise', 5e-2, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (
scipy-i686-linux>                         (r['alpha'] == 1.) &
scipy-i686-linux>                         np.isin(r['beta'], [-0.3, -0.2, -0.1]) &
scipy-i686-linux>                         (r['pct'] == 0.01)
scipy-i686-linux>                     ) |
scipy-i686-linux>                     (
scipy-i686-linux>                         (r['alpha'] == 1.) &
scipy-i686-linux>                         np.isin(r['beta'], [0.1, 0.2, 0.3]) &
scipy-i686-linux>                         (r['pct'] == 0.99)
scipy-i686-linux>                     )
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             # fft accuracy poor, very poor alpha < 1
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-5, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 1.7)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-4, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 1.5) &
scipy-i686-linux>                     (r['alpha'] <= 1.7)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-3, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 1.3) &
scipy-i686-linux>                     (r['alpha'] <= 1.5)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>             [
scipy-i686-linux>                 'fft-simpson', 1e-2, lambda r: (
scipy-i686-linux>                     np.isin(r['pct'], pct_range) &
scipy-i686-linux>                     np.isin(r['alpha'], alpha_range) &
scipy-i686-linux>                     np.isin(r['beta'], beta_range) &
scipy-i686-linux>                     (r['alpha'] > 1.0) &
scipy-i686-linux>                     (r['alpha'] <= 1.3)
scipy-i686-linux>                 )
scipy-i686-linux>             ],
scipy-i686-linux>         ]
scipy-i686-linux>         for ix, (default_method, rtol,
scipy-i686-linux>                  filter_func) in enumerate(tests):
scipy-i686-linux>             stats.levy_stable.cdf_default_method = default_method
scipy-i686-linux>             subdata = data[filter_func(data)
scipy-i686-linux>                            ] if filter_func is not None else data
scipy-i686-linux>             with suppress_warnings() as sup:
scipy-i686-linux>                 sup.record(
scipy-i686-linux>                     RuntimeWarning,
scipy-i686-linux>                     'Cumulative density calculations experimental for FFT'
scipy-i686-linux>                     + ' method. Use piecewise method instead.*'
scipy-i686-linux>                 )
scipy-i686-linux>                 p = stats.levy_stable.cdf(
scipy-i686-linux>                     subdata['x'],
scipy-i686-linux>                     subdata['alpha'],
scipy-i686-linux>                     subdata['beta'],
scipy-i686-linux>                     scale=1,
scipy-i686-linux>                     loc=0
scipy-i686-linux>                 )
scipy-i686-linux>                 with np.errstate(over="ignore"):
scipy-i686-linux>                     subdata2 = rec_append_fields(
scipy-i686-linux>                         subdata,
scipy-i686-linux>                         ['calc', 'abserr', 'relerr'],
scipy-i686-linux>                         [
scipy-i686-linux>                             p,
scipy-i686-linux>                             np.abs(p - subdata['p']),
scipy-i686-linux>                             np.abs(p - subdata['p']) / np.abs(subdata['p'])
scipy-i686-linux>                         ]
scipy-i686-linux>                     )
scipy-i686-linux>                 failures = subdata2[
scipy-i686-linux>                   (subdata2['relerr'] >= rtol) |
scipy-i686-linux>                   np.isnan(p)
scipy-i686-linux>                 ]
scipy-i686-linux>                 message = (f"cdf test {ix} failed with method '{default_method}'\n"
scipy-i686-linux>                            f"{failures.dtype.names}\n{failures}")
scipy-i686-linux> >               assert_allclose(
scipy-i686-linux>                     p,
scipy-i686-linux>                     subdata['p'],
scipy-i686-linux>                     rtol,
scipy-i686-linux>                     err_msg=message,
scipy-i686-linux>                     verbose=False
scipy-i686-linux>                 )
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/tests/test_distributions.py:5439:
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux>
scipy-i686-linux> args = (<function assert_allclose.<locals>.compare at 0x9f7a94a8>, array([0.01, 0.99, 0.01, 0.99, 0.01, 0.99, 0.01, 0.99, 0.0...,
scipy-i686-linux>        0.01, 0.99, 0.5 , 0.5 , 0.5 , 0.5 , 0.5 , 0.05, 0.95, 0.05, 0.95,
scipy-i686-linux>        0.05, 0.95, 0.05, 0.95, 0.05, 0.95]))
scipy-i686-linux> kwds = {'equal_nan': True, 'err_msg': "cdf test 0 failed with method 'piecewise'\n('x', 'p', 'alpha', 'beta', 'pct', 'calc', ...0.01, 0.01, 1.35997463e-12, 1.35997463e-10)]", 'header': 'Not equal to tolerance rtol=2e-12, atol=0', 'verbose': False}
scipy-i686-linux>
scipy-i686-linux>     @wraps(func)
scipy-i686-linux>     def inner(*args, **kwds):
scipy-i686-linux>         with self._recreate_cm():
scipy-i686-linux> >           return func(*args, **kwds)
scipy-i686-linux> E           AssertionError:
scipy-i686-linux> E           Not equal to tolerance rtol=2e-12, atol=0
scipy-i686-linux> E           cdf test 0 failed with method 'piecewise'
scipy-i686-linux> E           ('x', 'p', 'alpha', 'beta', 'pct', 'calc', 'abserr', 'relerr')
scipy-i686-linux> E           [(-2.21525105e-09, 0.95, 0.1, -0.9, 0.95, 0.95, 1.29455335e-11, 1.36268774e-11)
scipy-i686-linux> E            ( 1.93540944e-07, 0.01, 0.1,  1. , 0.01, 0.01, 1.35997463e-12, 1.35997463e-10)]
scipy-i686-linux> E           Mismatched elements: 2 / 149 (1.34%)
scipy-i686-linux> E           Max absolute difference: 1.29455335e-11
scipy-i686-linux> E           Max relative difference: 1.35997463e-10
scipy-i686-linux>
scipy-i686-linux> ../r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/lib/python3.10/contextlib.py:79: AssertionError
scipy-i686-linux> ________________________ TestKSTwoSamples.test_gh12218 _________________________
scipy-i686-linux> [gw0] linux -- Python 3.10.13 /nix/store/r9i738zjq1glb7i74prkyv22qdxlkg82-python3-3.10.13/bin/python3.10
scipy-i686-linux>
scipy-i686-linux> self = <scipy.stats.tests.test_stats.TestKSTwoSamples object at 0xc419f370>
scipy-i686-linux>
scipy-i686-linux>     @pytest.mark.slow
scipy-i686-linux>     def test_gh12218(self):
scipy-i686-linux>         """Ensure gh-12218 is fixed."""
scipy-i686-linux>         # gh-1228 triggered a TypeError calculating sqrt(n1*n2*(n1+n2)).
scipy-i686-linux>         # n1, n2 both large integers, the product exceeded 2^64
scipy-i686-linux>         np.random.seed(12345678)
scipy-i686-linux>         n1 = 2097152  # 2*^21
scipy-i686-linux>         rvs1 = stats.uniform.rvs(size=n1, loc=0., scale=1)
scipy-i686-linux>         rvs2 = rvs1 + 1  # Exact value of rvs2 doesn't matter.
scipy-i686-linux> >       stats.ks_2samp(rvs1, rvs2, alternative='greater', mode='asymp')
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/tests/test_stats.py:4400:
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_axis_nan_policy.py:531: in axis_nan_policy_wrapper
scipy-i686-linux>     res = hypotest_fun_out(*samples, **kwds)
scipy-i686-linux> lib/python3.10/site-packages/scipy/_lib/_util.py:779: in wrapper
scipy-i686-linux>     return fun(*args, **kwargs)
scipy-i686-linux> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scipy-i686-linux>
scipy-i686-linux> data1 = array([1.31659993e-06, 1.38255591e-06, 1.56707242e-06, ...,
scipy-i686-linux>        9.99997863e-01, 9.99998846e-01, 9.99999093e-01])
scipy-i686-linux> data2 = array([1.00000132, 1.00000138, 1.00000157, ..., 1.99999786, 1.99999885,
scipy-i686-linux>        1.99999909])
scipy-i686-linux> alternative = 'greater', method = 'asymp'
scipy-i686-linux>
scipy-i686-linux>     @_axis_nan_policy_factory(_tuple_to_KstestResult, n_samples=2, n_outputs=4,
scipy-i686-linux>                               result_to_tuple=_KstestResult_to_tuple)
scipy-i686-linux>     @_rename_parameter("mode", "method")
scipy-i686-linux>     def ks_2samp(data1, data2, alternative='two-sided', method='auto'):
scipy-i686-linux>         """
scipy-i686-linux>         Performs the two-sample Kolmogorov-Smirnov test for goodness of fit.
scipy-i686-linux>
scipy-i686-linux>         This test compares the underlying continuous distributions F(x) and G(x)
scipy-i686-linux>         of two independent samples.  See Notes for a description of the available
scipy-i686-linux>         null and alternative hypotheses.
scipy-i686-linux>
scipy-i686-linux>         Parameters
scipy-i686-linux>         ----------
scipy-i686-linux>         data1, data2 : array_like, 1-Dimensional
scipy-i686-linux>             Two arrays of sample observations assumed to be drawn from a continuous
scipy-i686-linux>             distribution, sample sizes can be different.
scipy-i686-linux>         alternative : {'two-sided', 'less', 'greater'}, optional
scipy-i686-linux>             Defines the null and alternative hypotheses. Default is 'two-sided'.
scipy-i686-linux>             Please see explanations in the Notes below.
scipy-i686-linux>         method : {'auto', 'exact', 'asymp'}, optional
scipy-i686-linux>             Defines the method used for calculating the p-value.
scipy-i686-linux>             The following options are available (default is 'auto'):
scipy-i686-linux>
scipy-i686-linux>               * 'auto' : use 'exact' for small size arrays, 'asymp' for large
scipy-i686-linux>               * 'exact' : use exact distribution of test statistic
scipy-i686-linux>               * 'asymp' : use asymptotic distribution of test statistic
scipy-i686-linux>
scipy-i686-linux>         Returns
scipy-i686-linux>         -------
scipy-i686-linux>         res: KstestResult
scipy-i686-linux>             An object containing attributes:
scipy-i686-linux>
scipy-i686-linux>             statistic : float
scipy-i686-linux>                 KS test statistic.
scipy-i686-linux>             pvalue : float
scipy-i686-linux>                 One-tailed or two-tailed p-value.
scipy-i686-linux>             statistic_location : float
scipy-i686-linux>                 Value from `data1` or `data2` corresponding with the KS statistic;
scipy-i686-linux>                 i.e., the distance between the empirical distribution functions is
scipy-i686-linux>                 measured at this observation.
scipy-i686-linux>             statistic_sign : int
scipy-i686-linux>                 +1 if the empirical distribution function of `data1` exceeds
scipy-i686-linux>                 the empirical distribution function of `data2` at
scipy-i686-linux>                 `statistic_location`, otherwise -1.
scipy-i686-linux>
scipy-i686-linux>         See Also
scipy-i686-linux>         --------
scipy-i686-linux>         kstest, ks_1samp, epps_singleton_2samp, anderson_ksamp
scipy-i686-linux>
scipy-i686-linux>         Notes
scipy-i686-linux>         -----
scipy-i686-linux>         There are three options for the null and corresponding alternative
scipy-i686-linux>         hypothesis that can be selected using the `alternative` parameter.
scipy-i686-linux>
scipy-i686-linux>         - `less`: The null hypothesis is that F(x) >= G(x) for all x; the
scipy-i686-linux>           alternative is that F(x) < G(x) for at least one x. The statistic
scipy-i686-linux>           is the magnitude of the minimum (most negative) difference between the
scipy-i686-linux>           empirical distribution functions of the samples.
scipy-i686-linux>
scipy-i686-linux>         - `greater`: The null hypothesis is that F(x) <= G(x) for all x; the
scipy-i686-linux>           alternative is that F(x) > G(x) for at least one x. The statistic
scipy-i686-linux>           is the maximum (most positive) difference between the empirical
scipy-i686-linux>           distribution functions of the samples.
scipy-i686-linux>
scipy-i686-linux>         - `two-sided`: The null hypothesis is that the two distributions are
scipy-i686-linux>           identical, F(x)=G(x) for all x; the alternative is that they are not
scipy-i686-linux>           identical. The statistic is the maximum absolute difference between the
scipy-i686-linux>           empirical distribution functions of the samples.
scipy-i686-linux>
scipy-i686-linux>         Note that the alternative hypotheses describe the *CDFs* of the
scipy-i686-linux>         underlying distributions, not the observed values of the data. For example,
scipy-i686-linux>         suppose x1 ~ F and x2 ~ G. If F(x) > G(x) for all x, the values in
scipy-i686-linux>         x1 tend to be less than those in x2.
scipy-i686-linux>
scipy-i686-linux>         If the KS statistic is large, then the p-value will be small, and this may
scipy-i686-linux>         be taken as evidence against the null hypothesis in favor of the
scipy-i686-linux>         alternative.
scipy-i686-linux>
scipy-i686-linux>         If ``method='exact'``, `ks_2samp` attempts to compute an exact p-value,
scipy-i686-linux>         that is, the probability under the null hypothesis of obtaining a test
scipy-i686-linux>         statistic value as extreme as the value computed from the data.
scipy-i686-linux>         If ``method='asymp'``, the asymptotic Kolmogorov-Smirnov distribution is
scipy-i686-linux>         used to compute an approximate p-value.
scipy-i686-linux>         If ``method='auto'``, an exact p-value computation is attempted if both
scipy-i686-linux>         sample sizes are less than 10000; otherwise, the asymptotic method is used.
scipy-i686-linux>         In any case, if an exact p-value calculation is attempted and fails, a
scipy-i686-linux>         warning will be emitted, and the asymptotic p-value will be returned.
scipy-i686-linux>
scipy-i686-linux>         The 'two-sided' 'exact' computation computes the complementary probability
scipy-i686-linux>         and then subtracts from 1.  As such, the minimum probability it can return
scipy-i686-linux>         is about 1e-16.  While the algorithm itself is exact, numerical
scipy-i686-linux>         errors may accumulate for large sample sizes.   It is most suited to
scipy-i686-linux>         situations in which one of the sample sizes is only a few thousand.
scipy-i686-linux>
scipy-i686-linux>         We generally follow Hodges' treatment of Drion/Gnedenko/Korolyuk [1]_.
scipy-i686-linux>
scipy-i686-linux>         References
scipy-i686-linux>         ----------
scipy-i686-linux>         .. [1] Hodges, J.L. Jr.,  "The Significance Probability of the Smirnov
scipy-i686-linux>                Two-Sample Test," Arkiv fiur Matematik, 3, No. 43 (1958), 469-486.
scipy-i686-linux>
scipy-i686-linux>         Examples
scipy-i686-linux>         --------
scipy-i686-linux>         Suppose we wish to test the null hypothesis that two samples were drawn
scipy-i686-linux>         from the same distribution.
scipy-i686-linux>         We choose a confidence level of 95%; that is, we will reject the null
scipy-i686-linux>         hypothesis in favor of the alternative if the p-value is less than 0.05.
scipy-i686-linux>
scipy-i686-linux>         If the first sample were drawn from a uniform distribution and the second
scipy-i686-linux>         were drawn from the standard normal, we would expect the null hypothesis
scipy-i686-linux>         to be rejected.
scipy-i686-linux>
scipy-i686-linux>         >>> import numpy as np
scipy-i686-linux>         >>> from scipy import stats
scipy-i686-linux>         >>> rng = np.random.default_rng()
scipy-i686-linux>         >>> sample1 = stats.uniform.rvs(size=100, random_state=rng)
scipy-i686-linux>         >>> sample2 = stats.norm.rvs(size=110, random_state=rng)
scipy-i686-linux>         >>> stats.ks_2samp(sample1, sample2)
scipy-i686-linux>         KstestResult(statistic=0.5454545454545454, pvalue=7.37417839555191e-15)
scipy-i686-linux>
scipy-i686-linux>         Indeed, the p-value is lower than our threshold of 0.05, so we reject the
scipy-i686-linux>         null hypothesis in favor of the default "two-sided" alternative: the data
scipy-i686-linux>         were *not* drawn from the same distribution.
scipy-i686-linux>
scipy-i686-linux>         When both samples are drawn from the same distribution, we expect the data
scipy-i686-linux>         to be consistent with the null hypothesis most of the time.
scipy-i686-linux>
scipy-i686-linux>         >>> sample1 = stats.norm.rvs(size=105, random_state=rng)
scipy-i686-linux>         >>> sample2 = stats.norm.rvs(size=95, random_state=rng)
scipy-i686-linux>         >>> stats.ks_2samp(sample1, sample2)
scipy-i686-linux>         KstestResult(statistic=0.10927318295739348, pvalue=0.5438289009927495)
scipy-i686-linux>
scipy-i686-linux>         As expected, the p-value of 0.54 is not below our threshold of 0.05, so
scipy-i686-linux>         we cannot reject the null hypothesis.
scipy-i686-linux>
scipy-i686-linux>         Suppose, however, that the first sample were drawn from
scipy-i686-linux>         a normal distribution shifted toward greater values. In this case,
scipy-i686-linux>         the cumulative density function (CDF) of the underlying distribution tends
scipy-i686-linux>         to be *less* than the CDF underlying the second sample. Therefore, we would
scipy-i686-linux>         expect the null hypothesis to be rejected with ``alternative='less'``:
scipy-i686-linux>
scipy-i686-linux>         >>> sample1 = stats.norm.rvs(size=105, loc=0.5, random_state=rng)
scipy-i686-linux>         >>> stats.ks_2samp(sample1, sample2, alternative='less')
scipy-i686-linux>         KstestResult(statistic=0.4055137844611529, pvalue=3.5474563068855554e-08)
scipy-i686-linux>
scipy-i686-linux>         and indeed, with p-value smaller than our threshold, we reject the null
scipy-i686-linux>         hypothesis in favor of the alternative.
scipy-i686-linux>
scipy-i686-linux>         """
scipy-i686-linux>         mode = method
scipy-i686-linux>
scipy-i686-linux>         if mode not in ['auto', 'exact', 'asymp']:
scipy-i686-linux>             raise ValueError(f'Invalid value for mode: {mode}')
scipy-i686-linux>         alternative = {'t': 'two-sided', 'g': 'greater', 'l': 'less'}.get(
scipy-i686-linux>             alternative.lower()[0], alternative)
scipy-i686-linux>         if alternative not in ['two-sided', 'less', 'greater']:
scipy-i686-linux>             raise ValueError(f'Invalid value for alternative: {alternative}')
scipy-i686-linux>         MAX_AUTO_N = 10000  # 'auto' will attempt to be exact if n1,n2 <= MAX_AUTO_N
scipy-i686-linux>         if np.ma.is_masked(data1):
scipy-i686-linux>             data1 = data1.compressed()
scipy-i686-linux>         if np.ma.is_masked(data2):
scipy-i686-linux>             data2 = data2.compressed()
scipy-i686-linux>         data1 = np.sort(data1)
scipy-i686-linux>         data2 = np.sort(data2)
scipy-i686-linux>         n1 = data1.shape[0]
scipy-i686-linux>         n2 = data2.shape[0]
scipy-i686-linux>         if min(n1, n2) == 0:
scipy-i686-linux>             raise ValueError('Data passed to ks_2samp must not be empty')
scipy-i686-linux>
scipy-i686-linux>         data_all = np.concatenate([data1, data2])
scipy-i686-linux>         # using searchsorted solves equal data problem
scipy-i686-linux>         cdf1 = np.searchsorted(data1, data_all, side='right') / n1
scipy-i686-linux>         cdf2 = np.searchsorted(data2, data_all, side='right') / n2
scipy-i686-linux> >       cddiffs = cdf1 - cdf2
scipy-i686-linux> E       numpy.core._exceptions._ArrayMemoryError: Unable to allocate 32.0 MiB for an array with shape (4194304,) and data type float64
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/_stats_py.py:8787: MemoryError
scipy-i686-linux> =============================== warnings summary ===============================
scipy-i686-linux> lib/python3.10/site-packages/scipy/conftest.py:9
scipy-i686-linux> lib/python3.10/site-packages/scipy/conftest.py:9
scipy-i686-linux>   /nix/store/rv6d7k3gbrbb63kd22sqkjsjhpcm8i6w-python3.10-scipy-1.12.0/lib/python3.10/site-packages/scipy/conftest.py:9: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47.
scipy-i686-linux>     import numpy.array_api
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/special/tests/test_basic.py::TestBessel::test_iv_cephes_vs_amos_mass_test
scipy-i686-linux>   /nix/store/rv6d7k3gbrbb63kd22sqkjsjhpcm8i6w-python3.10-scipy-1.12.0/lib/python3.10/site-packages/scipy/special/tests/test_basic.py:3230: RuntimeWarning: invalid value encountered in cast
scipy-i686-linux>     v[imsk] = v[imsk].astype(int)
scipy-i686-linux>
scipy-i686-linux> lib/python3.10/site-packages/scipy/stats/tests/test_qmc.py::TestUtils::test_geometric_discrepancy_mst_with_zero_distances
scipy-i686-linux>   /nix/store/rv6d7k3gbrbb63kd22sqkjsjhpcm8i6w-python3.10-scipy-1.12.0/lib/python3.10/site-packages/scipy/stats/tests/test_qmc.py:232: UserWarning: Sample contains duplicate points.
scipy-i686-linux>     assert_allclose(qmc.geometric_discrepancy(sample, method='mst'), 0.5)
scipy-i686-linux>
scipy-i686-linux> -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
scipy-i686-linux> =========================== short test summary info ============================
scipy-i686-linux> FAILED lib/python3.10/site-packages/scipy/signal/tests/test_filter_design.py::TestCheby1::test_basic - AssertionError:
scipy-i686-linux> FAILED lib/python3.10/site-packages/scipy/special/tests/test_data.py::test_boost[<Data for elliprg: ellint_rg_xy0_ipp-ellint_rg_xy0>] - AssertionError:
scipy-i686-linux> FAILED lib/python3.10/site-packages/scipy/stats/tests/test_distributions.py::TestLevyStable::test_pdf_nolan_samples[pct_range1-alpha_range1-beta_range1] - ValueError: f(a) and f(b) must have different signs
scipy-i686-linux> FAILED lib/python3.10/site-packages/scipy/stats/tests/test_distributions.py::TestLevyStable::test_cdf_nolan_samples[pct_range1-alpha_range1-beta_range1] - AssertionError:
scipy-i686-linux> FAILED lib/python3.10/site-packages/scipy/stats/tests/test_stats.py::TestKSTwoSamples::test_gh12218 - numpy.core._exceptions._ArrayMemoryError: Unable to allocate 32.0 MiB for a...
scipy-i686-linux> = 5 failed, 58633 passed, 2570 skipped, 650 xfailed, 16 xpassed, 4 warnings in 3837.93s (1:03:57) =

@doronbehar
Copy link
Contributor

I'm closing this as OP seems to not care about this anymore, and scipy is updated in #299864 which may change the experience regarding i686.

@doronbehar doronbehar closed this Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants