spectralpython/spectral

module numpy has no attribute 'inv'

Russjas opened this issue · 2 comments

`
File "reflectance_processing.py", line 133, in
test = sp.unmix(filtered1, endmembers)

File "\miniconda3\envs\spectral_environment\lib\site-packages\spectral\algorithms\algorithms.py", line 1316, in unmix
pi = np.dot(np.inv(pi), members)

File "\miniconda3\envs\spectral_environment\lib\site-packages\numpy_init_.py", line 311, in getattr
raise AttributeError("module {!r} has no attribute "

AttributeError: module 'numpy' has no attribute 'inv'`

This may be my inexperience with all things python. and even less experience with linear algebra. Changed the line to

pi = np.dot(np.linalg.inv(pi), members)

seems to work, but I dont know what I am doing

That is a bug. I'll get it fixed shortly. In the meantime, if you don't want to have to modify module code, you can do this as a hack (prior to calling the sp functions):

np.inv = np.linalg.inv

Well, glad to know it wasnt just a case of me nit knowing what I am doing. Thanks for suggested hack