Fix VisibleDeprecation warning by converting float indexes in int
As reported in Issue #2 (closed), VisibleDeprecationWarning is raised when indexing array with a non-integer value.
This is solved in two differents ways:
- when indexing by
X/2
, changing to X//2 (for any X) - when indexing by
np.func(X/2)
, changing toint(np.func(X/2))
(with func beingfloor
orceil
])
Another issue has been found and solved, when reshaping array with non-integer values. this is solved by replacing
new_shape = np.ones((len(cphase.shape), ))
by
new_shape = np.ones((len(cphase.shape), ), dtype=int)
Finally, gcd
is now imported from math
instead of fractions
(DeprecationWarning)
Merge request reports
Activity
Well I was working on the exact same modifications this morning to solve issue #2 (closed) and ended up using the same solutions as you did (using //, int and dtype=int where appropriate).
As I have found a few more files that need modifications than you, I propose to reject your merge request, but I will take care that my commit include all your modifications.
Also the modification that you propose concerning gcd import is not good, as gcd is only available in the fraction module in the older versions of Python (including 2.7), and we want to keep the compatibility of ltfatpy with these older versions. So we will need to handle the import in a more general way to keep the backward compatibility.
By Florent Jaillet on 2016-08-02T11:44:09 (imported from GitLab project)
mentioned in issue #2 (closed)
By Florent Jaillet on 2016-08-02T12:28:00 (imported from GitLab project)