pmelchior / scarlet

hyperspectral galaxy modeling and deblending

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autograd.np has no float

herjy opened this issue · comments

X = Parameter(np.array(X, dtype=np.float), name=name, fixed=True)

In this line np references autograd.numpy, which throws an error because it doesn't have a float attribute.
Same happened in Wavelet L203, where autograd.numpy.int is called.
Instead, we should import numpy and replace np.float by numpy.float.

Does "float" or "int" work instead?

It does. It's a much better solution indeed.

https://github.com/pmelchior/scarlet/blob/master/scarlet/wavelet.py#L202

is different because it's an explicit (but somewhat improper) function, which has an autograd equivalent.

I realize now that this problem might only come from me. It comes up in another place when running the multi-resolution NB, which apparently does not happen when running the tests.

There's no such thing as a personalized code problem. The code is buggy at that line, and it's fixed in the active PR

Yes but there is such thing as version issues on a specific distribution, especially after updating a crapy product! Though my dependencies are up to date. The Multiresolution notebook won't work on my machine and returns this, which is the same problem:

~/Desktop/git_repos/scarlet/scarlet/observation.py in match(self, model_frame)
    622         )
    623 
--> 624         center_y = np.int(
    625             self._fft_shape[0] / 2.0 - (self._fft_shape[0] - model_frame.Ny) / 2.0
    626         ) + ((self._fft_shape[0] % 2) != 0) * ((model_frame.Ny % 2) == 0)

AttributeError: module 'autograd.numpy' has no attribute 'int'