2012-02-11 7 views
6

scipy.test()を使用してnoseパッケージを使用してscipyをテストすると、すべてのバニラパッケージがインストールされたUbuntu 12.04でテストが失敗します。心配する必要はありますか?はいの場合、どうすればこの問題を解決できますか?SciPyをテストする際のエラー

In [8]: scipy.test() 
Running unit tests for scipy 
NumPy version 1.5.1 
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy 
SciPy version 0.9.0 
SciPy is installed in /usr/lib/python2.7/dist-packages/scipy 
Python version 2.7.2+ (default, Jan 21 2012, 23:31:34) [GCC 4.6.2] 
nose version 1.1.2 

[................] 

====================================================================== 
FAIL: test_io.test_imread 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest 
    self.test(*self.arg) 
    File "/usr/lib/python2.7/dist-packages/numpy/testing/decorators.py", line 146, in skipper_func 
    return f(*args, **kwargs) 
    File "/usr/lib/python2.7/dist-packages/scipy/ndimage/tests/test_io.py", line 16, in test_imread 
    assert_array_equal(img.shape, (300, 420, 3)) 
    File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 686, in assert_array_equal 
    verbose=verbose, header='Arrays are not equal') 
    File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 579, in assert_array_compare 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not equal 

(shapes (2,), (3,) mismatch) 
x: array([300, 420]) 
y: array([300, 420, 3]) 

---------------------------------------------------------------------- 
Ran 3780 tests in 32.328s 

FAILED (KNOWNFAIL=11, SKIP=20, failures=1) 

答えて

11

あなたは/usr/lib/python2.7/dist-packages/scipy/ndimage/tests/test_io.py内で見てみる場合は、表示されるはずです。

def test_imread(): 
    lp = os.path.join(os.path.dirname(__file__), 'dots.png') 
    img = ndi.imread(lp) 
    assert_array_equal(img.shape, (300, 420, 3)) 

    img = ndi.imread(lp, flatten=True) 
    assert_array_equal(img.shape, (300, 420)) 

このテストでは、flatten=Trueは、1ビットのグレースケール画像にRGB画像を変換した場合にテストをしているようです。私のUbuntu 11.10システムで

が、しかし、dots.pngはすでに1ビットの画像ファイルである:私はRGBA画像上のテストを(手動で)実行する場合

% file /usr/share/pyshared/scipy/ndimage/tests/dots.png 
/usr/share/pyshared/scipy/ndimage/tests/dots.png: PNG image data, 420 x 300, 1-bit colormap, non-interlaced 

、テストは動作します:

In [18]: z = ndi.imread('image.png') 

In [20]: z.shape 
Out[20]: (250, 250, 4) 

In [24]: w = ndi.imread('image.png', flatten = True) 

In [25]: w.shape 
Out[25]: (250, 250) 

は、だから私は、ここに真剣に何か問題があるRGB画像の代わりにグレースケール一つとなっているはず出荷されただけで、おそらくdots.pngファイルはないと思います。

+0

優れた答えです。また、エラーメッセージが表示されますか? – Ingo

+1

はい、Ubuntu 11.10で同じエラーが発生します。 – unutbu

関連する問題