diff --git a/nitime/tests/test_timeseries.py b/nitime/tests/test_timeseries.py index 7aaeac93..80ee8a9e 100644 --- a/nitime/tests/test_timeseries.py +++ b/nitime/tests/test_timeseries.py @@ -925,7 +925,11 @@ def test_timearray_math_functions(): npt.assert_(getattr(b, f)().__class__ == ts.TimeArray) npt.assert_(getattr(b, f)().time_unit == b.time_unit) # comparison with unitless should convert to the TimeArray's units - npt.assert_(getattr(b, f)() == getattr(a, f)()) + if f == "ptp": + want = np.ptp(a) # ndarray.ptp removed in 2.0 + else: + want = getattr(a, f)() + npt.assert_(getattr(b, f)() == want) def test_timearray_var_prod(): diff --git a/nitime/timeseries.py b/nitime/timeseries.py index 4fd44a92..e36708c4 100644 --- a/nitime/timeseries.py +++ b/nitime/timeseries.py @@ -152,7 +152,7 @@ class instance, or an int64 array in the base unit of the module e_s += 'TimeArray in object, or int64 times, in %s' % base_unit raise ValueError(e_s) - time = np.array(data, copy=False) + time = np.asarray(data) else: if isinstance(data, TimeInterface): time = data.copy() @@ -309,7 +309,7 @@ def mean(self, *args, **kwargs): return ret def ptp(self, *args, **kwargs): - ret = TimeArray(np.ndarray.ptp(self, *args, **kwargs), + ret = TimeArray(np.ptp(self, *args, **kwargs), time_unit=base_unit) ret.convert_unit(self.time_unit) return ret