Skip to content

Commit

Permalink
FIX: Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Jun 12, 2024
1 parent d52cc5a commit eb29943
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion nitime/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions nitime/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb29943

Please sign in to comment.