Skip to content

Commit c3e74fb

Browse files
committed
Merge & add conditions for raising ValueErrors for season_length and duration
1 parent 1470c17 commit c3e74fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pymc_extras/statespace/models/structural/components/seasonality.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ def __init__(
239239
if observed_state_names is None:
240240
observed_state_names = ["data"]
241241

242-
if season_length <= 1:
243-
raise ValueError(f"season_length must be greater than 1, got {season_length}")
242+
if season_length <= 1 or not isinstance(duration, int):
243+
raise ValueError(
244+
f"season_length must be an integer greater than 1, got {season_length}"
245+
)
246+
if duration <= 0 or not isinstance(duration, int):
247+
raise ValueError(f"duration must be a positive integer, got {duration}")
244248
if name is None:
245249
name = f"Seasonal[s={season_length}, d={duration}]"
246250
if state_names is None:

0 commit comments

Comments
 (0)