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

BF: Fix NumPy warning when creating arrays from ragged sequences #2140

Conversation

jhlegarreta
Copy link
Contributor

Fix NumPy warning when creating arrays from ragged sequences in streamline test.

Fixes

VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
(which is a list-or-tuple of lists-or-tuples-or ndarrays with different
lengths or shapes) is deprecated. If you meant to do this, you must specify
'dtype=object' when creating the ndarray
orig_streamlines_world = list(np.subtract(new_streamlines_world, disps))

triggered in
https://travis-ci.org/github/dipy/dipy/jobs/676101427#L5569
and
https://travis-ci.org/github/dipy/dipy/jobs/676764173#L5561

for example.

Rationale:
https://numpy.org/neps/nep-0034-infer-dtype-is-object.html

@jhlegarreta
Copy link
Contributor Author

I left this behind in PR #2133. I am sorry. I think this PR fixes the remaining warnings of that kind.

@skoudoro skoudoro added this to the 1.2 milestone Apr 22, 2020
@codecov
Copy link

codecov bot commented Apr 22, 2020

Codecov Report

Merging #2140 into master will increase coverage by 0.00%.
The diff coverage is 95.31%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2140   +/-   ##
=======================================
  Coverage   91.20%   91.21%           
=======================================
  Files         251      251           
  Lines       32214    32229   +15     
  Branches     3401     3403    +2     
=======================================
+ Hits        29382    29397   +15     
  Misses       2091     2091           
  Partials      741      741           
Impacted Files Coverage Δ
dipy/align/imwarp.py 98.39% <ø> (ø)
dipy/align/scalespace.py 92.64% <ø> (ø)
dipy/io/stateful_tractogram.py 68.85% <50.00%> (ø)
dipy/core/gradients.py 90.47% <88.88%> (+0.04%) ⬆️
dipy/nn/model.py 92.59% <93.75%> (ø)
dipy/nn/tests/test_tf.py 88.46% <93.75%> (ø)
dipy/core/tests/test_gradients.py 98.76% <100.00%> (ø)
dipy/direction/peaks.py 83.41% <100.00%> (ø)
...ection/tests/test_closest_peak_direction_getter.py 100.00% <100.00%> (ø)
dipy/io/tests/test_stateful_tractogram.py 92.42% <100.00%> (ø)
... and 15 more

Fix NumPy warning when creating arrays from ragged sequences in streamline test.

Fixes

```
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
(which is a list-or-tuple of lists-or-tuples-or ndarrays with different
lengths or shapes) is deprecated. If you meant to do this, you must specify
'dtype=object' when creating the ndarray
orig_streamlines_world = list(np.subtract(new_streamlines_world, disps))
```

triggered in
https://travis-ci.org/github/dipy/dipy/jobs/676101427#L5569
and
https://travis-ci.org/github/dipy/dipy/jobs/676764173#L5561

for example.

Rationale:
https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
@jhlegarreta jhlegarreta force-pushed the FixStreamlineTestRaggedSequenceGenerationWarning branch from d5de655 to 58c0caa Compare April 22, 2020 20:39
@skoudoro
Copy link
Member

LGTM, Thank you @jhlegarreta, merging!

@skoudoro skoudoro merged commit 8af9eab into dipy:master Apr 23, 2020
@jhlegarreta jhlegarreta deleted the FixStreamlineTestRaggedSequenceGenerationWarning branch April 23, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants