Skip to content

Commit

Permalink
Give the ValueErrors raised by the euclidean generator messages so th…
Browse files Browse the repository at this point in the history
…ere's better indication what's going wrong (#396)
  • Loading branch information
chrisib authored Jan 8, 2025
1 parent 6eb6a68 commit 8924ba2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions software/firmware/experimental/euclid.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ def generate_euclidean_pattern(steps, pulses, rot=0):
steps = int(steps)
pulses = int(pulses)
rot = int(rot)
if pulses > steps or pulses < 0:
raise ValueError
if rot > steps or steps < 0:
raise ValueError
if pulses > steps:
raise ValueError("Pulses cannot be greater than steps")
if pulses < 0:
raise ValueError("Pulses must be positive")
if rot > steps:
raise ValueError("Rotation cannot be greater than steps")
if steps < 0:
raise ValueError("Steps must be positive")
if steps == 0:
return []
if pulses == 0:
Expand Down

0 comments on commit 8924ba2

Please sign in to comment.