Closed sdasara95 closed 4 years ago
This replicates the error.
import numpy as np
a = np.float64(8)
b = np.float64(9)
np.linspace(a,b,a)
Running this gives same error:
TypeError Traceback (most recent call last)
~\Anaconda3\envs\random\lib\site-packages\numpy\core\function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
116 try:
--> 117 num = operator.index(num)
118 except TypeError:
TypeError: 'numpy.float64' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-137-d52d8440ef94> in <module>
2 a = np.float64(8)
3 b = np.float64(9)
----> 4 np.linspace(a,b,a)
<__array_function__ internals> in linspace(*args, **kwargs)
~\Anaconda3\envs\random\lib\site-packages\numpy\core\function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
117 num = operator.index(num)
118 except TypeError:
--> 119 raise TypeError(
120 "object of type {} cannot be safely interpreted as an integer."
121 .format(type(num)))
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.
It can be corrected by changing :
np.linspace(a,b,a)
to
np.linspace(a,b,int(a))
Integer type check has to be enforced for the value passed as num argument in np.linspace() https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html
This is fixed in #861 . Try this branch and see if it works for you.
Fixed by #861
I was trying to use the clog method in shape filters and ran into this problem.
This problem is due to int type not being enforced after using sigma_end - sigma_start + 1. sigma_end and sigma_start are numpy.float64 objects, hence, sigma_end-sigma_start+1 is also numpy.float64 but it has to be int
Line 73 in clog.py should be int(sigma_end-sigma_start+1))