spectralpython / spectral

Python module for hyperspectral image processing
MIT License
563 stars 138 forks source link

module numpy has no attribute 'inv' #145

Closed Russjas closed 1 year ago

Russjas commented 1 year ago

` 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

tboggs commented 1 year ago

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
Russjas commented 1 year ago

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