@@ -15,13 +15,13 @@ class RepeatTendency(BaseTendency):
1515 default = None ,
1616 bounds = (0 , None ),
1717 inclusive_bounds = (False , True ),
18- doc = "The frequency of the tendency , as provided by the user." ,
18+ doc = "The frequency of the repeated waveform , as provided by the user." ,
1919 )
2020 user_period = param .Number (
2121 default = None ,
2222 bounds = (0 , None ),
2323 inclusive_bounds = (False , True ),
24- doc = "The period of the tendency , as provided by the user." ,
24+ doc = "The period of the repeated waveform , as provided by the user." ,
2525 )
2626
2727 def __init__ (self , ** kwargs ):
@@ -37,7 +37,9 @@ def __init__(self, **kwargs):
3737 return
3838
3939 if self .waveform .tendencies [0 ].start != 0 :
40- error_msg = "The starting point of the first repeated must be set to 0.\n "
40+ error_msg = (
41+ "The starting point of the first repeated tendency must be set to 0.\n "
42+ )
4143 self .annotations .add (self .line_number , error_msg )
4244
4345 if self .duration < self .waveform .tendencies [- 1 ].end :
@@ -54,16 +56,22 @@ def __init__(self, **kwargs):
5456 self .waveform .tendencies [0 ].set_previous_tendency (self .waveform .tendencies [- 1 ])
5557 self .waveform .tendencies [- 1 ].set_next_tendency (self .waveform .tendencies [0 ])
5658
57- self ._set_frequency ()
59+ self ._set_period ()
5860 self .values_changed = True
5961 self .annotations .add_annotations (self .waveform .annotations )
6062
61- def _set_frequency (self ):
63+ def _set_period (self ):
64+ """Sets the period of the repeated waveform. If no period or frequency are
65+ provided by the user, the period is set to the combined length of the
66+ tendencies.
67+ """
68+
6269 has_freq_param = self .user_frequency is not None or self .user_period is not None
70+
6371 start = self .waveform .tendencies [0 ].start
6472 end = self .waveform .tendencies [- 1 ].end
65-
6673 if has_freq_param and (start != 0 or end != 1 ):
74+ # NOTE:
6775 # Is this warning required? This is not strictly required. If you have a
6876 # repeated tendency consisting of two tendencies, the first of length 2, and
6977 # the second of length 1, and a period of 1. The lengths will be distributed
@@ -92,7 +100,7 @@ def _set_frequency(self):
92100
93101 if has_freq_param and self .period > self .duration :
94102 error_msg = (
95- "If the period of repeated tendency must be shorter than its duration. "
103+ "The period of repeated tendency must be shorter than its duration. "
96104 "\n The frequency or period will be ignored\n "
97105 )
98106 self .annotations .add (self .line_number , error_msg , is_warning = True )
0 commit comments