numpy.asscalar is deprecated in newer versions of numpy
cpraveen opened this issue · comments
Praveen C commented
This is used in three places in freegs/equilibium.py file.
https://numpy.org/doc/1.21/reference/generated/numpy.asscalar.html
Ben Dudson commented
Thanks @cpraveen ! The notice says to replace asscalar(a)
with a.item()
but that only works if a
is an ndarray
, not if it's already a scalar. Something like:
try:
a = a.item()
except AttributeError:
a = float(a)
might perhaps work, to make sure that a
is a scalar and not a 1-element array?
Praveen C commented
I change to
if len(result) == 1:
return result[0]
and the code runs.
Peter Hill commented
Fixed in #76