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

Updates for upcoming numpy 1.11 release #858

Merged
merged 5 commits into from Feb 9, 2016

Conversation

Projects
None yet
2 participants
@arokem
Member

arokem commented Feb 3, 2016

Is coming down the pipes quick.

Bringing with it the following errors:

======================================================================
ERROR: dipy.reconst.tests.test_shm.test_SphHarmFit
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/reconst/tests/test_shm.py", line 281, in test_SphHarmFit
    slice = fit[..., 0]
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/reconst/shm.py", line 577, in __getitem__
    new_coef = self._shm_coef[coef_index]
IndexError: an index can only have a single ellipsis ('...')

======================================================================
ERROR: This tests that the Local Tracker behaves as expected for the
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/local/tests/test_local_tracking.py", line 92, in test_stop_conditions
    bad_affine = np.eye(3.)
  File "/usr/lib/python2.7/dist-packages/numpy/lib/twodim_base.py", line 233, in eye
    m = zeros((N, M), dtype=dtype)
TypeError: 'float' object cannot be interpreted as an index

======================================================================
ERROR: dipy.tracking.tests.test_markov.test_ProbabilisticOdfWeightedTracker
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/tests/test_markov.py", line 285, in test_ProbabilisticOdfWeightedTracker
    for streamline in pwt:
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/utils.py", line 898, in move_streamlines
    for sl in streamlines:
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/markov.py", line 220, in _generate_streamlines
    directions = self._next_step(s, prev_step=None)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/markov.py", line 391, in _next_step
    return self._get_directions(fit)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/markov.py", line 31, in __call__
    discrete_odf = fit.odf(self.sphere)
  File "/build/dipy-0.10.1/debian/tmp/usr/lib/python2.7/dist-packages/dipy/tracking/tests/test_markov.py", line 256, in odf
    return odf_list[self.n]
TypeError: only integer scalar arrays can be converted to a scalar index

For now, this PR fixes the second of these.

arokem added some commits Feb 3, 2016

BF: "only integer scalar arrays can be converted to a scalar index"
Before the fix, this used to be a 1-element array, which cause the above
error to be thrown on line 297 below.
BF: Enforce integer division in setting number of sh coefficients.
This raises an error on future numpy, because this is otherwise a float
and is used to index.
@arokem

This comment has been minimized.

Member

arokem commented Feb 3, 2016

Still remaining:


======================================================================
ERROR: This tests that the Local Tracker behaves as expected for the
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/arokem/source/dipy/dipy/tracking/local/tests/test_local_tracking.py", line 81, in test_stop_conditions
    sl = next(streamlines_not_all)
  File "/Users/arokem/source/dipy/dipy/tracking/utils.py", line 916, in move_streamlines
    for sl in streamlines:
  File "/Users/arokem/source/dipy/dipy/tracking/local/localtracking.py", line 108, in _generate_streamlines
    directions = dg.initial_direction(s)
  File "/Users/arokem/source/dipy/dipy/tracking/local/tests/test_local_tracking.py", line 45, in initial_direction
    tissue[p[0], p[1], p[2]] == TissueTypes.INVALIDPOINT):
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

----------------------------------------------------------------------
Ran 4 tests in 651.014s

BF: Two more errors related to numpy 1.11 upcoming.
1. Using integer indices instead of floats
2. Related: input to np.eye needs to be integer.
@arokem

This comment has been minimized.

Member

arokem commented Feb 3, 2016

OK - I think we're all set now. This is ready for a review.

@arokem arokem changed the title from WIP: Numpy 1.11 to Updates for upcoming numpy 1.11 release Feb 3, 2016

Garyfallidis added a commit that referenced this pull request Feb 9, 2016

Merge pull request #858 from arokem/fixes-for-np-1.11
Updates for upcoming numpy 1.11 release

@Garyfallidis Garyfallidis merged commit f1ea967 into nipy:master Feb 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment