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

Ravel multi index #55

Merged
merged 6 commits into from
Aug 15, 2012
Merged

Ravel multi index #55

merged 6 commits into from
Aug 15, 2012

Conversation

MrBago
Copy link
Contributor

@MrBago MrBago commented Aug 9, 2012

This should make travis a little more happy. btw, do you guys know what version of numpy travis is using to test dipy?

Bago

@travisbot
Copy link

This pull request fails (merged 001a6d49 into 73e8e16).

@travisbot
Copy link

This pull request fails (merged b634807 into 73e8e16).

@arokem
Copy link
Contributor

arokem commented Aug 9, 2012

I am guessing this is what we get: http://packages.debian.org/stable/python-numpy

since the .travis.yml file goes and apt-get's numpy for the environment it builds and runs the tests on

@@ -46,6 +46,25 @@
eye, mgrid, sqrt, zeros, linalg, diag, dot
from dipy.io.bvectxt import ornt_mapping

def _rmi(index, dims):
"""An alternate implementation of numpy.ravel_multi_index for older
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could copy over the docstring examples from numpy here, so they get tested.

@stefanv
Copy link
Contributor

stefanv commented Aug 10, 2012

Sorry, I'm a bit late to the party--can you explain to me why we need unravel_multi_index in the first place?

@MrBago
Copy link
Contributor Author

MrBago commented Aug 10, 2012

We want to use fiber tracking to create a connectivity matrix. The fiber
tracking streamlines each have a start and an end. I want to be able to go
from the integer arrays start and end to a matrix. The simplest
implementation would probably be:

matrix = zeros(shape)
for i in xrange(len(start)):
matrix[start[i], end[i]] += 1
return out

For performance reasons I've implemented it as:

x = np.ravel_multi_index([start, end], shape)
matrix = np.bincount(x, minlength=np.prod(shape))
matrix.shape = shape
return matrix

Is that clear?

Bago

On Thu, Aug 9, 2012 at 8:36 PM, Stefan van der Walt <
notifications@github.com> wrote:

Sorry, I'm a bit late to the party--can you explain to me why we need
unravel_multi_index in the first place?


Reply to this email directly or view it on GitHubhttps://github.com//pull/55#issuecomment-7633479.

stefanv added a commit that referenced this pull request Aug 15, 2012
BF - Implement backward compatible ravel_multi_index.
@stefanv stefanv merged commit 3c5ef29 into dipy:master Aug 15, 2012
@travisbot
Copy link

This pull request fails (merged 8c8adaa into 73e8e16).

BramshQamar pushed a commit to BramshQamar/dipy that referenced this pull request May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants