Skip to content

Commit

Permalink
Oak warnings (#257)
Browse files Browse the repository at this point in the history
* date_range freq values

* warning conversion of 1-item array to item

* replace H with h

---------

Co-authored-by: Ilya Sytchev <[email protected]>
  • Loading branch information
GeorgeEfstathiadis and hackdna authored Oct 25, 2024
1 parent cd8cdbb commit 62ed567
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions forest/oak/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def run_hourly(
cadence_temp = cadence_bout[t_hours_pd == t_unique]
cadence_temp = cadence_temp[cadence_temp > 0]
# store hourly metrics
if math.isnan(steps_hourly[ind_to_store]):
if math.isnan(steps_hourly[ind_to_store].item()):
steps_hourly[ind_to_store] = int(np.sum(cadence_temp))
walkingtime_hourly[ind_to_store] = len(cadence_temp)
else:
Expand Down Expand Up @@ -613,11 +613,11 @@ def run(study_folder: str, output_folder: str, tz_str: Optional[str] = None,
frequency == Frequency.HOURLY_AND_DAILY
or frequency == Frequency.HOURLY
):
freq = 'H'
freq = 'h'
elif frequency == Frequency.MINUTE:
freq = 'T'
freq = 'min'
else:
freq = str(frequency.value/60) + 'H'
freq = str(frequency.value/60) + 'h'

days_hourly = pd.date_range(date_start, date_end+timedelta(days=1),
freq=freq)[:-1]
Expand Down
2 changes: 1 addition & 1 deletion forest/oak/tests/test_run_hourly.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def sample_run_input(signal_bout):
t_ind_pydate = pd.date_range(
start='2020-02-24 00:00:00',
end='2020-02-25 23:00:00',
freq='H',
freq='h',
tz='US/Eastern'
).to_pydatetime()
cadence_bout = np.array(
Expand Down

0 comments on commit 62ed567

Please sign in to comment.