Skip to content

Commit

Permalink
Merge pull request #176 from pfizer-opensource/development
Browse files Browse the repository at this point in the history
Version 0.16.12
  • Loading branch information
LukasAdamowicz authored Oct 4, 2024
2 parents db78d43 + c9e0e32 commit 76b9fda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'scikit-digital-health',
'c',
version: '0.16.11',
version: '0.16.12',
license: 'MIT',
meson_version: '>=1.1',
)
Expand Down
18 changes: 10 additions & 8 deletions src/skdh/activity/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,23 @@ def _setup_plotting(self, save_name): # pragma: no cover
def _update_date_results(
self, results, time, day_n, day_start_idx, day_stop_idx, day_start_hour
):
# add 15 seconds to make sure any rounding effects for the hour don't adversely
# effect the result of the comparison
start_dt = self.convert_timestamps(time[day_start_idx])
# get the start time, but round to the nearest minute - could do second
# but going larger just to be completely sure.
start_dt = self.convert_timestamps(time[day_start_idx]).round("min")

window_start_dt = start_dt + Timedelta(15, unit="s")
if start_dt.hour < day_start_hour:
window_start_dt -= Timedelta(1, unit="day")
# subtracting a day handles cases where the recording starts well into a day, in which case
# the date should be the previous day, when the window WOULD have started had their been
# more data
window_start_dt = start_dt - Timedelta(1, unit='day') if (start_dt.hour < day_start_hour) else start_dt

results["Date"][day_n] = window_start_dt.strftime("%Y-%m-%d")
results["Day Start Timestamp"][day_n] = start_dt.strftime(
"%Y-%m-%d %H:%M:%S.%f"
"%Y-%m-%d %H:%M:%S"
)
# round end time as well
results["Day End Timestamp"][day_n] = self.convert_timestamps(
time[day_stop_idx]
).strftime("%Y-%m-%d %H:%M:%S.%f")
).round("min").strftime("%Y-%m-%d %H:%M:%S")
results["Weekday"][day_n] = window_start_dt.strftime("%A")
results["Day N"][day_n] = day_n + 1
results["N hours"][day_n] = around(
Expand Down

0 comments on commit 76b9fda

Please sign in to comment.