Universite-Gustave-Eiffel / I-Simpa

An Open Source software for 3D sound propagation modelling
https://i-simpa.univ-gustave-eiffel.fr/
GNU General Public License v3.0
227 stars 56 forks source link

LookupError: No spectrum for the given name exists (Water). Try one of: [] #343

Closed tuttoweb closed 1 year ago

tuttoweb commented 1 year ago

Hi all,

I am having this error while running some code. In particular, the line raising this exception is: muscle_dictionary[Tags.MOLECULE_COMPOSITION] = sp.TISSUE_LIBRARY.muscle()

My looking at the stack trace (see below)

Traceback (most recent call last):                                                             
  File "<stdin>", line 1, in <module>                                                          
  File "/opt/conda/lib/python3.8/site-packages/simpa-0.8.6-py3.8.egg/simpa/utils/libraries/tis 
sue_library.py", line 63, in muscle                                                            
    custom_water = MOLECULE_LIBRARY.water(water_volume_fraction)                               
  File "/opt/conda/lib/python3.8/site-packages/simpa-0.8.6-py3.8.egg/simpa/utils/libraries/mol 
ecule_library.py", line 209, in water                                                          
    absorption_spectrum=().get_spectrum_by_name("Water"),             
  File "/opt/conda/lib/python3.8/site-packages/simpa-0.8.6-py3.8.egg/simpa/utils/libraries/spe 
ctrum_library.py", line 107, in get_spectrum_by_name                                           
    raise LookupError(f"No spectrum for the given name exists ({spectrum_name}). Try one of: { 
self.get_spectra_names()}")                                                                    
LookupError: No spectrum for the given name exists (Water). Try one of: []   

it appears the problem is in this AbsorptionSpectrumLibrary class. I can easily replicate the error by doing:

>>> from simpa.utils.libraries.spectrum_library import AbsorptionSpectrumLibrary               
>>> a = ()                                                            
>>>a.get_spectrum_by_name("Water")                                                            
Traceback (most recent call last):                                                             
  File "<stdin>", line 1, in <module>                                                          
  File "/opt/conda/lib/python3.8/site-packages/simpa-0.8.6-py3.8.egg/simpa/utils/libraries/spe 
ctrum_library.py", line 107, in get_spectrum_by_name                                           
    raise LookupError(f"No spectrum for the given name exists ({spectrum_name}). Try one of: { 
self.get_spectra_names()}")                                                                    
LookupError: No spectrum for the given name exists (Water). Try one of: []  

The class AbsorptionSpectrumLibrary seems looking for specific .npz files I dont have apparently.

This PDF https://i-simpa-wiki.readthedocs.io/_/downloads/fr/latest/pdf/ has this link https://i-simpa-wiki.readthedocs.io/_/downloads/fr/latest/pdf/using_spectrum.html at page 74, but it's dead.

Can anyone advise on what to do?

Thank you very much

nicolas-f commented 1 year ago

Hello,

I think you are not in the right place.

Maybe you should use the library repository:

https://github.com/IMSY-DKFZ/simpa

best regards

tuttoweb commented 1 year ago

Hello,

I think you are not in the right place.

Maybe you should use the library repository:

https://github.com/IMSY-DKFZ/simpa

best regards

Installing simpa from github works. Thanks. The issue was I had installed it via pip, which doesn't contain those files. Maybe you should either specify this in the README or update the wheel file(s).

Cheers vg