From 48f61ed0e103ca503d7ffacc6419b5c2366ebaea Mon Sep 17 00:00:00 2001 From: Tyler Tran Date: Tue, 2 Apr 2024 13:12:34 -0700 Subject: [PATCH] fixed issue with calculating logging window compliance for control groups. semi-bandaid fix --- 00_core.ipynb | 4 ++-- treets/core.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/00_core.ipynb b/00_core.ipynb index 5956c2a..b527f27 100644 --- a/00_core.ipynb +++ b/00_core.ipynb @@ -3598,7 +3598,7 @@ " if pd.isnull(window_start):\n", " window_start = datetime.time(0,0)\n", " if pd.isnull(window_end):\n", - " window_end = datetime.time(23,59)\n", + " window_end = datetime.time(23,59,59)\n", "\n", " # helper function to determine a good logging\n", " def good_logging(local_time_series):\n", @@ -3619,7 +3619,7 @@ " window_end_daily = window_end.hour + window_end.minute / 60 + buffer_time\n", " tmp = df[df['date'] == aday]\n", " \n", - " if (window_start == datetime.time(0,0)) and (window_end == datetime.time(23,59)):\n", + " if (window_start == datetime.time(0,0)) and (window_end == datetime.time(23,59, 59)):\n", " in_window_count.append(tmp[(tmp[time_col] >= window_start_daily + h) & (tmp[time_col] <= window_end_daily + h)].shape[0])\n", " else:\n", " in_window_count.append(tmp[(tmp[time_col] >= window_start_daily) & (tmp[time_col] <= window_end_daily)].shape[0])\n", diff --git a/treets/core.py b/treets/core.py index fda0c50..54922fc 100644 --- a/treets/core.py +++ b/treets/core.py @@ -1591,7 +1591,7 @@ def good_lwa_day_counts(df: pd.DataFrame, if pd.isnull(window_start): window_start = datetime.time(0,0) if pd.isnull(window_end): - window_end = datetime.time(23,59) + window_end = datetime.time(23,59,59) # helper function to determine a good logging def good_logging(local_time_series): @@ -1612,7 +1612,7 @@ def good_logging(local_time_series): window_end_daily = window_end.hour + window_end.minute / 60 + buffer_time tmp = df[df['date'] == aday] - if (window_start == datetime.time(0,0)) and (window_end == datetime.time(23,59)): + if (window_start == datetime.time(0,0)) and (window_end == datetime.time(23,59, 59)): in_window_count.append(tmp[(tmp[time_col] >= window_start_daily + h) & (tmp[time_col] <= window_end_daily + h)].shape[0]) else: in_window_count.append(tmp[(tmp[time_col] >= window_start_daily) & (tmp[time_col] <= window_end_daily)].shape[0])