[Numpy-discussion] numpy.test error: test_hdquantiles

Joshua Lippai discerptor@gmail....
Sun May 25 16:35:01 CDT 2008


I seem to be getting a few errors and failures with the current numpy
SVN (1.2.0.dev5236). I get this output with numpy.test(1,10):

ERROR: Ticket #396
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/tests/test_regression.py",
line 602, in check_poly1d_nan_roots
    self.failUnlessRaises(np.linalg.LinAlgError,getattr,p,"r")
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 320, in failUnlessRaises
    callableObj(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 661, in __getattr__
    return roots(self.coeffs)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 124, in roots
    roots = _eigvals(A)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 40, in _eigvals
    return eigvals(arg)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/linalg/decomp.py",
line 478, in eigvals
    return eig(a,b=b,left=0,right=0,overwrite_a=overwrite_a)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/linalg/decomp.py",
line 150, in eig
    a1 = asarray_chkfinite(a)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/function_base.py",
line 527, in asarray_chkfinite
    raise ValueError, "array must not contain infs or NaNs"
ValueError: array must not contain infs or NaNs

======================================================================
ERROR: Ticket #396
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/tests/test_regression.py",
line 602, in check_poly1d_nan_roots
    self.failUnlessRaises(np.linalg.LinAlgError,getattr,p,"r")
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/unittest.py",
line 320, in failUnlessRaises
    callableObj(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 661, in __getattr__
    return roots(self.coeffs)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 124, in roots
    roots = _eigvals(A)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py",
line 37, in _eigvals
    return eigvals(arg)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/linalg/decomp.py",
line 478, in eigvals
    return eig(a,b=b,left=0,right=0,overwrite_a=overwrite_a)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/linalg/decomp.py",
line 150, in eig
    a1 = asarray_chkfinite(a)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/function_base.py",
line 527, in asarray_chkfinite
    raise ValueError, "array must not contain infs or NaNs"
ValueError: array must not contain infs or NaNs

======================================================================
ERROR: test_hdquantiles (numpy.ma.tests.test_morestats.TestQuantiles)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/tests/test_morestats.py",
line 97, in test_hdquantiles
    hdq = hdquantiles_sd(data,[0.25, 0.5, 0.75])
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/morestats.py",
line 168, in hdquantiles_sd
    result = _hdsd_1D(data.compressed(), p)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/morestats.py",
line 144, in _hdsd_1D
    xsorted = numpy.sort(data.compressed())
AttributeError: 'numpy.ndarray' object has no attribute 'compressed'

======================================================================
FAIL: Tests the Marits-Jarrett estimator
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/tests/test_morestats.py",
line 36, in test_mjci
    assert_almost_equal(mjci(data),[55.76819,45.84028,198.8788],5)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 134, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 227, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 193, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 33.3333333333%)
 x: array([  55.76818915,   45.84027529,  198.8787528 ])
 y: array([  55.76819,   45.84028,  198.8788 ])

======================================================================
FAIL: Test quantiles 1D - w/ mask.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/tests/test_mstats.py",
line 61, in test_1d_mask
    [24.833333, 50.0, 75.166666])
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 134, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 227, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/testutils.py",
line 193, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal

(mismatch 66.6666666667%)
 x: array([ 24.83333333,  50.        ,  75.16666667])
 y: array([ 24.833333,  50.      ,  75.166666])

----------------------------------------------------------------------
Ran 1301 tests in 1.501s

FAILED (failures=2, errors=3)
<unittest._TextTestResult run=1301 errors=3 failures=2>
>>> numpy.__version__
'1.2.0.dev5236'
>>> scipy.__version__
'0.7.0.dev4386'

I get that the failures are just NumPy being anal about the accuracy
and rounding habits, but the errors concern me. The first two are the
result of a ticket that's only supposed to pop up when SciPy isn't
installed (which it is, and I even imported it before running the
test). I assume those will go away by some strange voodoo magic on
their own eventually because this has happened to me before with that
particular ticket. The third error concerns me, though. Is anyone else
getting an error with test_hdquantiles?


More information about the Numpy-discussion mailing list