Skip to content

Commit c7f2c9f

Browse files
author
David Butterworth
committed
SampleTimeGenerator() can only generate a monotonically-increasing sequence so do some checks on the input.
1 parent 2027dfb commit c7f2c9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/prpy/util.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,11 @@ def SampleTimeGenerator(start, end, step=1):
10431043
10441044
@returns generator: A sequence of float values.
10451045
"""
1046+
if end <= start:
1047+
raise ValueError("The 'end' value must be greater than "\
1048+
"the 'start' value.")
1049+
if not (step > 0):
1050+
raise ValueError("The 'step' value must be positive.")
10461051
t = start
10471052
prev_t = 0.0
10481053
while t <= numpy.floor(end):

0 commit comments

Comments
 (0)