Skip to content

Commit 78d6835

Browse files
committed
remove duplicate warning message
1 parent 2e35af3 commit 78d6835

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

waveform_editor/tendencies/repeat.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ def __init__(self, **kwargs):
4242
)
4343
self.annotations.add(self.line_number, error_msg)
4444

45-
if self.duration < self.waveform.tendencies[-1].end:
46-
error_msg = (
47-
"The repeated tendency has not completed a single repetition.\n"
48-
"Perhaps increase the duration of the repeated tendency?\n"
49-
)
50-
self.annotations.add(self.line_number, error_msg, is_warning=True)
51-
5245
# Link the last tendency to the first tendency in the repeated waveform
5346
# We must lock the start to 0, otherwise it will take the start value of the
5447
# previous tendency.
@@ -83,13 +76,14 @@ def _set_period(self):
8376
else:
8477
self.period = self.waveform.tendencies[-1].end
8578

86-
if has_freq_param and self.period > self.duration:
79+
length = self.waveform.calc_length()
80+
scaling_factor = self.period / length
81+
if self.duration < length * scaling_factor:
8782
error_msg = (
88-
"The period of repeated tendency must be shorter than its duration. "
89-
"\nThe frequency or period will be ignored\n"
83+
"The repeated tendency has not completed a single repetition.\n"
84+
"Perhaps increase the duration of the repeated tendency?\n"
9085
)
9186
self.annotations.add(self.line_number, error_msg, is_warning=True)
92-
self.period = self.waveform.tendencies[-1].end
9387

9488
def get_value(
9589
self, time: Optional[np.ndarray] = None

0 commit comments

Comments
 (0)