Skip to content

Commit

Permalink
fixed issue with calculating logging window compliance for control gr…
Browse files Browse the repository at this point in the history
…oups. semi-bandaid fix
  • Loading branch information
tktran11 committed Apr 2, 2024
1 parent a426d1c commit 48f61ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions treets/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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])
Expand Down

0 comments on commit 48f61ed

Please sign in to comment.