Skip to content
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

New warnings with `PRE=1` #1565

Closed
arokem opened this issue Jun 14, 2018 · 8 comments

Comments

@arokem
Copy link
Member

commented Jun 14, 2018

See: https://travis-ci.org/nipy/dipy/jobs/391291194

We are getting a lot (!) of these:

home/travis/build/nipy/dipy/venv/lib/python3.5/site-packages/scipy/fftpack/basic.py:160: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  z[index] = x

This could be numpy 1.15, or a new version of scipy?

Looks like maybe it's coming out of imaffine?

@skoudoro

This comment has been minimized.

Copy link
Member

commented Jun 14, 2018

Even if I find them strange because they work with a short example, I use the opportunity to add all errors we get on pre:

======================================================================
ERROR: dipy.align.tests.test_parzenhist.test_parzen_joint_histogram
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/align/tests/test_parzenhist.py", line 136, in test_parzen_joint_histogram
    P.setup(static, moving, static_mask, moving_mask)
  File "dipy/align/parzenhist.pyx", line 105, in dipy.align.parzenhist.ParzenJointHistogram.setup
    self.smin = np.min(static[smask != 0])
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: dipy.align.tests.test_parzenhist.test_parzen_densities
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/align/tests/test_parzenhist.py", line 193, in test_parzen_densities
    parzen_hist.setup(static, moving)
  File "dipy/align/parzenhist.pyx", line 105, in dipy.align.parzenhist.ParzenJointHistogram.setup
    self.smin = np.min(static[smask != 0])
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: dipy.align.tests.test_parzenhist.test_joint_pdf_gradients_dense
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/align/tests/test_parzenhist.py", line 353, in test_joint_pdf_gradients_dense
    parzen_hist.setup(static, moving, smask, mmask)
  File "dipy/align/parzenhist.pyx", line 105, in dipy.align.parzenhist.ParzenJointHistogram.setup
    self.smin = np.min(static[smask != 0])
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: dipy.align.tests.test_parzenhist.test_joint_pdf_gradients_sparse
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/align/tests/test_parzenhist.py", line 437, in test_joint_pdf_gradients_sparse
    parzen_hist.setup(static, moving, smask, mmask)
  File "dipy/align/parzenhist.pyx", line 105, in dipy.align.parzenhist.ParzenJointHistogram.setup
    self.smin = np.min(static[smask != 0])
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: dipy.align.tests.test_parzenhist.test_exceptions
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/align/tests/test_parzenhist.py", line 619, in test_exceptions
    theta, transform, s, m, p, g)
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 1235, in assert_raises
    return _d.assertRaises(*args,**kwargs)
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/unittest/case.py", line 733, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/unittest/case.py", line 178, in handle
    callable_obj(*args, **kwargs)
  File "dipy/align/parzenhist.pyx", line 388, in dipy.align.parzenhist.ParzenJointHistogram.update_gradient_sparse
    if (self.joint_grad is None) or (self.joint_grad.shape[2] != n):
AttributeError: 'ParzenJointHistogram' object has no attribute 'joint_grad'

======================================================================
ERROR: This test the number of inital direction."
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/direction/tests/test_bootstrap_direction_getter.py", line 34, in test_bdg_initial_direction
    boot_dg = BootDirectionGetter.from_data(voxel, dti_model, 30, sh_order=6)
  File "dipy/direction/bootstrap_direction_getter.pyx", line 52, in dipy.direction.bootstrap_direction_getter.BootDirectionGetter.from_data
    boot_gen = BootPmfGen(np.asarray(data, dtype=float), model, sphere,
  File "dipy/direction/pmf.pyx", line 113, in dipy.direction.pmf.BootPmfGen.__init__
    self.dwi_mask = model.gtab.b0s_mask == 0
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: This tests the bootstrapping residual.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/direction/tests/test_bootstrap_direction_getter.py", line 119, in test_bdg_residual
    sh_order=6)
  File "dipy/direction/pmf.pyx", line 113, in dipy.direction.pmf.BootPmfGen.__init__
    self.dwi_mask = model.gtab.b0s_mask == 0
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: This tests the local model used for the bootstrapping.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/direction/tests/test_pmf.py", line 60, in test_boot_pmf
    boot_pmf_gen = BootPmfGen(data, model=tensor_model, sphere=hsph_updated)
  File "dipy/direction/pmf.pyx", line 113, in dipy.direction.pmf.BootPmfGen.__init__
    self.dwi_mask = model.gtab.b0s_mask == 0
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
======================================================================
ERROR: This tests that the cmc tissue classifier returns expected
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/tracking/local/tests/test_tissue_classifier.py", line 174, in test_cmc_tissue_classifier
    average_voxel_size=1)
  File "dipy/tracking/local/tissue_classifier.pyx", line 137, in dipy.tracking.local.tissue_classifier.ConstrainedTissueClassifier.from_pve
    include_map[(wm_map + gm_map + csf_map) == 0] = 1
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: This tests that the ParticleFilteringTracking produces
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/tracking/local/tests/test_tracking.py", line 274, in test_particle_filtering_tractography
    tc = ActTissueClassifier.from_pve(simple_wm, simple_gm, simple_csf)
  File "dipy/tracking/local/tissue_classifier.pyx", line 137, in dipy.tracking.local.tissue_classifier.ConstrainedTissueClassifier.from_pve
    include_map[(wm_map + gm_map + csf_map) == 0] = 1
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

======================================================================
ERROR: This tests that the Bootstrat Peak Direction Getter plays nice
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/koudoro/anaconda/envs/dipy-pre-env-3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/koudoro/Software/dipy/dipy/tracking/local/tests/test_tracking.py", line 492, in test_bootstap_peak_tracker
    boot_dg = BootDirectionGetter.from_data(data, csd_model, 60)
  File "dipy/direction/bootstrap_direction_getter.pyx", line 52, in dipy.direction.bootstrap_direction_getter.BootDirectionGetter.from_data
    boot_gen = BootPmfGen(np.asarray(data, dtype=float), model, sphere,
  File "dipy/direction/pmf.pyx", line 113, in dipy.direction.pmf.BootPmfGen.__init__
    self.dwi_mask = model.gtab.b0s_mask == 0
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
@skoudoro

This comment has been minimized.

Copy link
Member

commented Jun 18, 2018

After a short test, the warning comes from scipy.fftpack.fftn (Look here but it appears on many places) It seems that we can not do much. I think, we just have to warn Scipy

@arokem

This comment has been minimized.

Copy link
Member Author

commented Jun 18, 2018

I installed scipy and numpy into a new virtualenv with pip install --pre, but I can't reproduce the warning if I just do:

import numpy as np
from scipy.fftpack import fftn, fftshift, ifftshift

fftshift(np.real(fftn(ifftshift(np.random.randn(128, 128, 128)), 3 * (128, ))))

That should raise this warning, no?

@matthew-brett

This comment has been minimized.

Copy link
Member

commented Jun 18, 2018

Did you use the Rackspace URL for installs? As in:

pip install -f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com --pre -U scipy
@arokem

This comment has been minimized.

Copy link
Member Author

commented Jun 18, 2018

@arokem

This comment has been minimized.

Copy link
Member Author

commented Dec 9, 2018

Hey @skoudoro : can we close this one? I don't think we're seeing any of these anymore.

There are new errors showing up on PRE=1 (for example), but maybe they deserve their own issues?

@skoudoro

This comment has been minimized.

Copy link
Member

commented Dec 9, 2018

I don't think we're seeing any of these anymore.

As you can see here, It is still there but this warning appears only for one Numpy release (1.15).

I'm fine closing this issue, I just wonder if we should do something for that or just ignore it?

There are new errors showing up on PRE=1 (for example), but maybe they deserve their own issues?

I agree

@skoudoro

This comment has been minimized.

Copy link
Member

commented Feb 5, 2019

Closing this issue since the warning totally disappears

@skoudoro skoudoro closed this Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.