[SciPy-User] Bottleneck 0.3 - some tests Fail

Hanno Klemm klemm at phys.ethz.ch
Mon Jan 24 10:42:09 EST 2011


I was indeed using scipy 0.8.0. However, upgrading to the most recent EPD
distribution made the error go away. Apparently there are some minute
changes between EPD-6.3-1 and EPD-6.3-2 that solved the problem.


On Fri, Jan 21, 2011, Keith Goodman <kwgoodman at gmail.com> said:

> On Fri, Jan 21, 2011 at 7:22 AM, Hanno Klemm <klemm at phys.ethz.ch> wrote:
>>
>> Keith,
>>
>> thanks for the new release. When I build bottleneck 0.3.0 two of the tests
>> fail. Are you aware of that,or is that a problem with my build?
>>
>> I attached a text file of the session.
> 
> Thank you for the report!
> 
> I don't see any failures. Anyone else?
> 
> Some background on the failing unit test:
> 
> Currently only 1d, 2d, and 3d input arrays with data type (dtype)
> int32, int64, float32, and float64 are accelerated. All other
> ndim/dtype combinations result in calls to slower, unaccelerated
> functions. The tests that are failing on your system use a 4d input
> array so it calls the slow version of moving_nanmax and moving_max,
> which uses scipy.ndimage.maximum_filter1d.
> 
> So my first thought is to blame scipy ;) What version of scipy are you
> using? I see you are using numpy 1.4.0 so you are probably using scipy
> 0.7. Would using scipy 0.8 solve it?
> 
> Here's the function (bottleneck/slow/move.py):
> 
> def move_max_filter(arr, window, axis=-1):
>     "Moving window maximium implemented with a filter."
>     if axis == None:
>         raise ValueError, "An `axis` value of None is not supported."
>     if window < 1:
>         raise ValueError, "`window` must be at least 1."
>     if window > arr.shape[axis]:
>         raise ValueError, "`window` is too long."
>     y = arr.astype(float)
>     x0 = (window - 1) // 2
>     maximum_filter1d(y, window, axis=axis, mode='constant', cval=np.nan,
>                      origin=x0, output=y)
> 
> 
>> Regards,
>> Hanno
>>
>>
>>
>> On Thu, Jan 20, 2011, Keith Goodman <kwgoodman at gmail.com> said:
>>
>>> Bottleneck is a collection of fast NumPy array functions written in
>>> Cython. It contains functions like median, nanmedian, nanargmax,
>>> move_mean.
>>>
>>> The third release of Bottleneck is twice as fast for small input
>>> arrays and contains 10 new functions.
>>>
>>> Faster:
>>> - All functions are faster (less overhead in selector functions)
>>>
>>> New functions:
>>> - nansum()
>>> - move_sum()
>>> - move_nansum()
>>> - move_mean()
>>> - move_std()
>>> - move_nanstd()
>>> - move_min()
>>> - move_nanmin()
>>> - move_max()
>>> - move_nanmax()
>>>
>>> Enhancements:
>>> - You can now specify the dtype and axis to use in the benchmark timings
>>> - Improved documentation and more unit tests
>>>
>>> Breaks from 0.2.0:
>>> - Moving window functions now default to axis=-1 instead of axis=0
>>> - Low-level moving window selector functions no longer take window as input
>>>
>>> Bug fix:
>>> - int input array resulted in call to slow, non-cython version of move_nanmean
>>>
>>> download
>>>    http://pypi.python.org/pypi/Bottleneck
>>> docs
>>>    http://berkeleyanalytics.com/bottleneck
>>> code
>>>    http://github.com/kwgoodman/bottleneck
>>> mailing list
>>>    http://groups.google.com/group/bottle-neck
>>> mailing list 2
>>>    http://mail.scipy.org/mailman/listinfo/scipy-user
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>>
>>
>> --
>> Hanno Klemm
>> klemm at phys.ethz.ch
>>
>>
>>
>> Python 2.6.6 |EPD 6.3-1 (64-bit)| (r266:84292, Sep 18 2010, 08:39:12)
>> [GCC 3.4.6] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import bottleneck as bn
>>>>> bn.__version__
>> '0.3.0'
>>>>> import numpy as np
>>>>> bn.test()
>> Running unit tests for bottleneck
>> NumPy version 1.4.0
>> NumPy is installed in /scratch/epd-6.3/lib/python2.6/site-packages/numpy
>> Python version 2.6.6 |EPD 6.3-1 (64-bit)| (r266:84292, Sep 18 2010,
>> 08:39:12) [GCC 3.4.6]
>> nose version 0.11.4
>> .........................................F.F
>> ======================================================================
>> FAIL: Test move_max.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>  File "/scratch/epd-6.3/lib/python2.6/site-packages/nose/case.py", line
>> 186, in runTest
>>    self.test(*self.arg)
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/bottleneck/tests/move_test.py",
>> line 58, in unit_maker
>>    err_msg)
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/numpy/testing/utils.py",
>> line 765, in assert_array_almost_equal
>>    header='Arrays are not almost equal')
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/numpy/testing/utils.py",
>> line 587, in assert_array_compare
>>    raise AssertionError(msg)
>> AssertionError:
>> Arrays are not almost equal
>>
>> func move_max | window 2 | input a96 (int32) | shape (1, 2, 3, 4) | axis
>> -2
>>
>> Input array:
>> [[[[ 0  1  2  3]
>>   [ 4  5  6  7]
>>   [ 8  9 10 11]]
>>
>>  [[12 13 14 15]
>>   [16 17 18 19]
>>   [20 21 22 23]]]]
>>
>> (x and y nan location mismatch [[[[False False False False]
>>   [False False False False]
>>   [False False False False]]
>>
>>  [[False False False False]
>>   [False False False False]
>>   [False False False False]]]], [[[[ True  True  True  True]
>>   [False False False False]
>>   [False False False False]]
>>
>>  [[ True  True  True  True]
>>   [False False False False]
>>   [False False False False]]]] mismatch)
>>  x: array([[[[  0.,   1.,   2.,   3.],
>>         [  4.,   5.,   6.,   7.],
>>         [  8.,   9.,  10.,  11.]],...
>>  y: array([[[[ NaN,  NaN,  NaN,  NaN],
>>         [  4.,   5.,   6.,   7.],
>>         [  8.,   9.,  10.,  11.]],...
>>
>> ======================================================================
>> FAIL: Test move_nanmax.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>  File "/scratch/epd-6.3/lib/python2.6/site-packages/nose/case.py", line
>> 186, in runTest
>>    self.test(*self.arg)
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/bottleneck/tests/move_test.py",
>> line 58, in unit_maker
>>    err_msg)
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/numpy/testing/utils.py",
>> line 765, in assert_array_almost_equal
>>    header='Arrays are not almost equal')
>>  File
>> "/scratch/epd-6.3/lib/python2.6/site-packages/numpy/testing/utils.py",
>> line 587, in assert_array_compare
>>    raise AssertionError(msg)
>> AssertionError:
>> Arrays are not almost equal
>>
>> func move_nanmax | window 2 | input a96 (int32) | shape (1, 2, 3, 4) |
>> axis -2
>>
>> Input array:
>> [[[[ 0  1  2  3]
>>   [ 4  5  6  7]
>>   [ 8  9 10 11]]
>>
>>  [[12 13 14 15]
>>   [16 17 18 19]
>>   [20 21 22 23]]]]
>>
>> (x and y nan location mismatch [[[[False False False False]
>>   [False False False False]
>>   [False False False False]]
>>
>>  [[False False False False]
>>   [False False False False]
>>   [False False False False]]]], [[[[ True  True  True  True]
>>   [False False False False]
>>   [False False False False]]
>>
>>  [[ True  True  True  True]
>>   [False False False False]
>>   [False False False False]]]] mismatch)
>>  x: array([[[[  0.,   1.,   2.,   3.],
>>         [  4.,   5.,   6.,   7.],
>>         [  8.,   9.,  10.,  11.]],...
>>  y: array([[[[ NaN,  NaN,  NaN,  NaN],
>>         [  4.,   5.,   6.,   7.],
>>         [  8.,   9.,  10.,  11.]],...
>>
>> ----------------------------------------------------------------------
>> Ran 44 tests in 31.774s
>>
>> FAILED (failures=2)
>> <nose.result.TextTestResult run=44 errors=0 failures=2>
>>>>>
>>
>>
>>
> 
> 

-- 
Hanno Klemm
klemm at phys.ethz.ch





More information about the SciPy-User mailing list