pmelchior / scarlet

hyperspectral galaxy modeling and deblending
MIT License
49 stars 22 forks source link

Bug in notebook wavelet_model.ipynb - unsupported operand type(s) for @ #271

Closed rsav closed 2 months ago

rsav commented 2 years ago

When running the notebook wavelet_model.ipynb, I get this error in the very last cell when computing the scalar product:

TypeError: unsupported operand type(s) for @: 'TabulatedSpectrum' and 'TabulatedSpectrum'

The offending line is:

C[j] = spectrum @ spectrum_ / np.sqrt(spectrum @ spectrum) / np.sqrt(spectrum_ @ spectrum_)

Workaround: use spectrum.getmodel() and spectrum.getmodel() instead of spectrum and spectrum

pmelchior commented 2 years ago

Thanks for reporting. I confirm the bug, this is a leftover from a conversion of spectrum as a direct Parameter to it being a Model that has a parameter. The former one behaves like an array, so @ works, while the latter one doesn't.

The solution is to update the docs.