Skip to content

Commit c56ce9c

Browse files
authored
Merge pull request #184 from pfizer-opensource/development
Version 0.17.2
2 parents a2b2764 + 49ea129 commit c56ce9c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project(
22
'scikit-digital-health',
33
'c',
4-
version: '0.17.1',
4+
version: '0.17.2',
55
license: 'MIT',
66
meson_version: '>=1.1',
77
)

src/skdh/io/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,18 @@ def trim_data(self, start_key, end_key, tz_name, predict_kw, *, time, **data):
163163
)
164164

165165
ts_trim_start = (
166-
time[0] - 1
166+
time[0] + 0.001
167167
if trim_start is None
168168
else self._to_timestamp(trim_start, tz_name)
169169
)
170170
ts_trim_end = (
171-
time[-1] + 1 if trim_end is None else self._to_timestamp(trim_end, tz_name)
171+
time[-1] - 0.001 if trim_end is None else self._to_timestamp(trim_end, tz_name)
172172
)
173173

174-
idx = nonzero((time >= ts_trim_start) & (time <= ts_trim_end))[0]
175-
176-
i1 = idx[0]
177-
i2 = idx[-1]
174+
# write it so that if there is any time weirdness, get the data from the "middle",
175+
# ie the last index before the start time, and the first index after the end time.
176+
i1 = nonzero(time <= ts_trim_start)[0][-1]
177+
i2 = nonzero(time >= ts_trim_end)[0][0]
178178

179179
res = {self._time: time[i1:i2]}
180180
res.update({k: v[i1:i2] for k, v in data.items()})

0 commit comments

Comments
 (0)