Auerilas / ecopy

Python tools for ecological data analyses
64 stars 27 forks source link

Issues with cca in both python 2.x and 3.x. #14

Closed jason-tilley closed 5 years ago

jason-tilley commented 6 years ago

I just installed ecopy and was working through the example provided at ReadTheDocs....

import ecopy as ep

varespec = ep.load_data('varespec')
varechem = ep.load_data('varechem')

cca_fit = ep.cca(varespec, varechem)

However, I end up with an IndexError...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ecopy/matrix_comp/cca.py", line 144, in __init__
    self.U = self.U[:,self.evals>tolerance]
IndexError: boolean index did not match indexed array along dimension 1; dimension is 44 but corresponding boolean dimension is 14

Any idea on what I'm doing wrong?

jason-tilley commented 6 years ago

It appears the offending line is:

self.U = self.U[:,self.evals>tolerance

maurobio commented 5 years ago

This problem is caused by Numpy versions higher than 1.12. From 1.13 arrays of different sizes can no longer be used in boolean comparisions. See here: https://stackoverflow.com/questions/45207650/indexerror-boolean-index-did-not-match-indexed-array-along-dimension-0.

Auerilas commented 5 years ago

@ForTozs are you still having this issue? I'm just back to getting going on this. I believe @maurobio fixed the problem, as it seems to work for me now.

maurobio commented 5 years ago

I confirm this issue has been fixed. cca() now works fine with all versions of NumPy in both Python 2.x and 3.x.

Em Sex, 5 de abr de 2019 13:06, Auerilas notifications@github.com escreveu:

@ForTozs https://github.com/ForTozs are you still having this issue? I'm just back to getting going on this. I believe @maurobio https://github.com/maurobio fixed the problem, as it seems to work for me now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Auerilas/ecopy/issues/14#issuecomment-480331822, or mute the thread https://github.com/notifications/unsubscribe-auth/AB7ACXGGwlLOpHLW2TLzViB8x8VxJzH-ks5vd3RugaJpZM4Q7e08 .