Skip to content

Commit

Permalink
fix: dtype conversion issue in detect_nonwear
Browse files Browse the repository at this point in the history
function
  • Loading branch information
chanshing committed Nov 29, 2023
1 parent 341bfca commit bc241af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/actipy/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def detect_nonwear(data, patience='90m', window='10s', stdtol=15 / 1000):
)
.set_index('start_time')
.squeeze()
# dtype defaults to int64 when series is empty, so
# astype('timedelta64[ns]') makes sure it's always a timedelta,
# otherwise comparison with Timedelta(patience) below will fail
.astype('timedelta64[ns]')
)
nonwear_segment_lengths = stationary_segment_lengths[stationary_segment_lengths > pd.Timedelta(patience)]

Expand Down

0 comments on commit bc241af

Please sign in to comment.