Skip to content

Commit

Permalink
add len
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Feb 20, 2024
1 parent 8ec00d3 commit 45035ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions psp/models/recent_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,14 @@ def _get_features(self, x: X, is_training: bool) -> Features:
# make sure recent power values is the right length
if not hasattr(self, "_n_recent_power_values"):
self._n_recent_power_values = 0
if recent_power_values < self._n_recent_power_values:
if len(recent_power_values) < self._n_recent_power_values:
recent_power_values = np.pad(
recent_power_values,
(0, self._n_recent_power_values - len(recent_power_values)),
"constant",
constant_values=np.nan,
)
elif recent_power_values > self._n_recent_power_values:
elif len(recent_power_values) > self._n_recent_power_values:
recent_power_values = recent_power_values[-self._n_recent_power_values :]

if self._normalize_features:
Expand Down

0 comments on commit 45035ac

Please sign in to comment.