the docs state that np.linspace is supported by pint, thus maybe this would be nice to have someone looking into.
time = 10 * ureg.s
np.linspace(0, time, num = 50)
is fine, but
np.linspace(0, time, num = 50, retstep=True)
raises
~\site-packages\numpy\core_asarray.py:102:
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
return array(a, dtype, copy=False, order=order)
According to the inet, has to do with a change introduced in numpy 1.19 requiring explicit statment of 'dtype=object' when creating those arrays.
I guess this is a workaround, so is not too critical.
ureg = pint.UnitRegistry()
time = 10 * ureg.s
numpy.linspace(0, time, num=50)
numpy.linspace(0, time.magnitude, num=50, retstep=True)[1] * time.units
But I guess this may not be the only numpy function which does something like this.
pint: 0.17 numpy: 1.21.0 python: 3.9.1
Hi,
the docs state that np.linspace is supported by pint, thus maybe this would be nice to have someone looking into.
is fine, but
raises
According to the inet, has to do with a change introduced in numpy 1.19 requiring explicit statment of 'dtype=object' when creating those arrays.
I guess this is a workaround, so is not too critical.
But I guess this may not be the only numpy function which does something like this.