New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible random failure in test_vector_fields.test_reorient_vector_field_2d #613

Closed
matthew-brett opened this Issue Mar 21, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@matthew-brett
Member

matthew-brett commented Mar 21, 2015

The build task dipy-py3.3-easy_install tests the installation of the current pypi release, so, after a release, it always tests the same code:

http://nipy.bic.berkeley.edu/builders/dipy-py3.3-easy_install

Build 163 failed with the message below, but without any known changes on the build machine. Just rebuilding again passed (build 164), suggesting that the failure may have a random component.

Failure message:

======================================================================
FAIL: dipy.align.tests.test_vector_fields.test_reorient_vector_field_2d
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 602, in chk_same_position
    assert_array_equal(x_id, y_id)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 739, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

(mismatch 100.0%)
 x: array([[[ True,  True],
        [ True,  True],
        [ True,  True],...
 y: array([[[False, False],
        [False, False],
        [False, False],...

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/buildslave/osx-10.8/dipy-py3_3-pip/build/venv/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/buildslave/osx-10.8/dipy-py3_3-pip/build/venv/lib/python3.3/site-packages/dipy/align/tests/test_vector_fields.py", line 1342, in test_reorient_vector_field_2d
    assert_array_almost_equal(d, expected)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 842, in assert_array_almost_equal
    precision=decimal)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 628, in assert_array_compare
    chk_same_position(x_isnan, y_isnan, hasval='nan')
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/testing/utils.py", line 608, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 6 decimals

x and y nan location mismatch:
 x: array([[[ nan,  nan],
        [ nan,  nan],
        [ nan,  nan],...
 y: array([[[ 2.      , -2.      ],
        [ 1.673582, -1.912665],
        [ 1.21709 , -1.622787],...

http://nipy.bic.berkeley.edu/builders/dipy-py3.3-pip/builds/168/steps/shell_4/logs/stdio

@omarocegueda

This comment has been minimized.

Contributor

omarocegueda commented Mar 21, 2015

I see! the problem is a memory access violation caused by this line:
https://github.com/nipy/dipy/blob/master/dipy/align/tests/test_vector_fields.py#L1337
the function expects a 3x3 matrix (affine transform in 2D), although it's fine if the matrix is 2x3 (the last row is unnecessary). The access violation occurs here:
https://github.com/nipy/dipy/blob/master/dipy/align/vector_fields.pyx#L50
and here:
https://github.com/nipy/dipy/blob/master/dipy/align/vector_fields.pyx#L60

The direct fix is verifying the matrix size in reorient_vector_field (raising exception if invalid), but I will also check the rest of the functions that call the matrix multiplication to make sure it won't happen again.

Thanks Matthew! =)

@matthew-brett

This comment has been minimized.

Member

matthew-brett commented Mar 21, 2015

Nice detective work - thank you.

@arokem

This comment has been minimized.

Member

arokem commented Apr 1, 2015

Closed through: #616

@arokem arokem closed this Apr 1, 2015

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