-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Description
In the development version of Astropy the TimeDelta object does not work with np.sum() anymore. The issue was found in one of our Gammapy Travis-CI builds. I presume the issue is somehow related to #8610, but I could not find a statement whether it is intended behaviour.
Expected behavior
I would expect that the expression np.sum(time_delta) just returns the sum of the time differences
Actual behavior
The code fails with a TypeError:
TypeError: no implementation found for 'numpy.sum' on types that implement __array_function__: [<class 'astropy.time.core.TimeDelta'>]
Steps to Reproduce
The following code example reproduces the error:
from astropy.time import Time
import numpy as np
t_1 = Time(['1999-01-01T00:00:00.123456789', '2010-01-01T00:00:00'])
t_2 = Time(['1998-01-01T00:00:00.123456789', '2009-01-01T00:00:00'])
total = np.sum(t_1 - t_2)System Details
Darwin-18.7.0-x86_64-i386-64bit
Python 3.7.0 | packaged by conda-forge | (default, Nov 12 2018, 12:34:36)
[Clang 4.0.1 (tags/RELEASE_401/final)]
Numpy 1.18.1
astropy 4.2.dev267+g295c2ab4b
Scipy 1.4.1
Matplotlib 3.1.2