Skip to content

Commit d49edb3

Browse files
authored
Merge pull request #295 from fooof-tools/stepper
[MNT] - Update parameter Stepper object
2 parents 9415bee + 3c48a54 commit d49edb3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

fooof/sim/params.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,16 @@ def _check_values(start, stop, step):
146146
If the given values for defining the iteration range are inconsistent.
147147
"""
148148

149-
if any(ii < 0 for ii in [start, stop, step]):
150-
raise ValueError("Inputs 'start', 'stop', and 'step' should all be positive values.")
149+
if any(ii < 0 for ii in [start, stop]):
150+
raise ValueError("Inputs 'start' and 'stop' should be positive values.")
151151

152-
if not start < stop:
153-
raise ValueError("Input 'start' should be less than 'stop'.")
152+
if (stop - start) * step < 0:
153+
raise ValueError("The sign of input 'step' does not align with 'start' / 'stop' values.")
154154

155-
if not step < (stop - start):
155+
if start == stop:
156+
raise ValueError("Input 'start' and 'stop' must be different values.")
157+
158+
if not abs(step) < abs(stop - start):
156159
raise ValueError("Input 'step' is too large given values for 'start' and 'stop'.")
157160

158161

0 commit comments

Comments
 (0)