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

Bug in make_local_connectivity_ones.py #7

Open
xychen-ION opened this issue Feb 20, 2017 · 5 comments
Open

Bug in make_local_connectivity_ones.py #7

xychen-ION opened this issue Feb 20, 2017 · 5 comments

Comments

@xychen-ION
Copy link

I have installed numpy, scipy and nibabel with python version 2.7 and I am trying to test the code on the test data. But I meet an error when I run make_local_connectivity_ones. The error shows below:

"
sparse_w=append(sparse_w,R[nzndx],1)
Traceback (most recent call last):

File "", line 1, in
sparse_w=append(sparse_w,R[nzndx],1)

File "/home/fbip018/anaconda3/envs/cxy_image_3/lib/python2.7/site-packages/numpy/lib/function_base.py", line 5003, in append
return concatenate((arr, values), axis=axis)

IndexError: axis 1 out of bounds [0, 1)
"

This error happens in line 155 in make_local_connectivity_ones.py which is the code "sparse_w=append(sparse_w,R[nzndx],1)". I don't know how to deal with it and I am sure the numpy is installed.

Thank you

@mehrshadg
Copy link

append function in older versions of scipy (I suspect this package is written with older versions of scipy) ignored the wrong dimension passed as the third argument and when I read the code for make_local_connectivity_ones the matrix dimension is wrong. So, I think if you pass zero as the third argument the code must work: sparse_w=append(sparse_w,R[nzndx],0)

@xychen-ION
Copy link
Author

Thanks mehrshadg!
Yes, I have tried it and it works. But I am not sure if it is exactly what author means. Because the code in line 153 is "sparse_i=append(sparse_i,ondx1d[nzndx]-1,0)", it makes no sense that the mistake you said could happen.
I also found more bugs when I tried other function with test data and no function can pass. Can you have all function passed?
I have the same suspect that this package is written with older versions of scipy. I have tried an older version of scipy (0.16.1) but it still can not work.

@kelmok
Copy link

kelmok commented Jul 15, 2019

Hi @mehrshadg @xychen-ION @ccraddock,

I got the same issue running the code (scipy 1.2.1, numpy 1.16.4, python 2.7).

   if not os.path.isfile('rm_ones_connectivity.npy'): make_local_connectivity_ones(maskname, 'rm_ones_connectivity.npy')
  File "make_local_connectivity_ones.py", line 155, in make_local_connectivity_ones
    sparse_i=append(sparse_i,(ondx1d[nzndx-1]-1),0)
  File "..anaconda3/envs/example_env2/lib/python2.7/site-packages/numpy/lib/function_base.py", line 4694, in append
    return concatenate((arr, values), axis=axis)
AxisError: axis 1 is out of bounds for array of dimension 1

does anyone have an update, or know which numpy/scipy version is compatible?

Thanks

@caludia96
Copy link

I am getting the same AxisError. Please let me know of any updates.
@ccraddock @kelmok

@AlexLZM
Copy link

AlexLZM commented Apr 30, 2021

Same error here. I changed 1 to 0 as @mehrshadg said and I have to change 'dtype' of variable 'a' to 'int' in binfile_parcellation.py to run all the scripts.

But unfortunately, all spatial correlation or time correlation output seems wrong.
Tested with COBRE data subject 40046, n_cluster = 50.
image

But random clustering works fine.
image

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

No branches or pull requests

5 participants