Skip to content

Commit 3cd6f3f

Browse files
committed
remove value_error param
1 parent 6afaa4d commit 3cd6f3f

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

waveform_editor/tendencies/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ class BaseTendency(param.Parameterized):
7979
default=None,
8080
doc="Error that occurred when processing user inputs.",
8181
)
82-
value_error = param.ClassSelector(
83-
class_=Exception,
84-
default=None,
85-
doc="Error that occurred when processing user inputs.",
86-
)
8782

8883
def __init__(self, **kwargs):
8984
self.annotations = Annotations()
@@ -258,7 +253,7 @@ def _setup_param(self, kwargs):
258253

259254
self.annotations.add(
260255
self.line_number,
261-
f"{cleaned_error_msg}\nThis keyword argument is ignored.",
256+
f"{cleaned_error_msg}\nThis keyword is ignored.",
262257
is_warning=True,
263258
)
264259
# Ignore keyword argument with ValueError

waveform_editor/tendencies/linear.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,12 @@ def _calc_values(self):
122122

123123
try:
124124
values = solve_with_constraints(inputs, constraint_matrix)
125-
self.value_error = None
126125
except InconsistentInputsError:
127-
self.value_error = ValueError(
128-
"Inputs are inconsistent: from + duration * rate != end"
126+
error_msg = (
127+
"Inputs are inconsistent: from + duration * rate != end\n"
128+
"The 'from', 'to', and 'rate' values are set to 0.\n"
129129
)
130+
self.annotations.add(self.line_number, error_msg, is_warning=True)
130131
values = (0.0, 0.0, 0.0)
131132

132133
# Update state and cast to bool, as param does not like numpy booleans

waveform_editor/tendencies/periodic/periodic_base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,18 @@ def __init__(self, **kwargs):
6464
)
6565
def _calc_values(self):
6666
"""Update all derived values in a single function"""
67-
self.value_error = None # clear value error
6867

6968
# Determine frequency
7069
frequency = 1.0
7170
if self.user_frequency is not None:
7271
if self.user_period is not None and not np.isclose(
7372
self.user_frequency, 1 / self.user_period
7473
):
75-
self.value_error = ValueError(
76-
"The frequency and period do not match! (freq != 1 / period)."
74+
error_msg = (
75+
"The frequency and period do not match! (freq != 1 / period).\n"
76+
"The period will be ignored and only the frequency is used.\n"
7777
)
78+
self.annotations.add(self.line_number, error_msg, is_warning=True)
7879
frequency = self.user_frequency
7980
elif self.user_period is not None:
8081
frequency = 1 / self.user_period
@@ -106,9 +107,11 @@ def _calc_values(self):
106107
inputs[1] = 0.0
107108

108109
if num_inputs > 2:
109-
self.value_error = ValueError(
110-
"Too many inputs: expected two out of {base, amplitude, min and max}."
110+
error_msg = (
111+
"Too many inputs: expected two out of {base, amplitude, min and max}.\n"
112+
"The 'base', 'amplitude', 'min', and 'max' are set to 0.\n"
111113
)
114+
self.annotations.add(self.line_number, error_msg, is_warning=True)
112115
values = (0.0, 0.0, 0.0, 0.0)
113116
else:
114117
values = solve_with_constraints(inputs, constraint_matrix)

waveform_editor/tendencies/repeat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ def __init__(self, **kwargs):
1818

1919
for item in waveform_dict:
2020
if item.get("type") == "piecewise":
21-
self.value_error = ValueError(
21+
error_msg = (
2222
"Piecewise tendencies are currently not supported inside of a "
2323
"repeated tendency."
2424
)
25+
self.annotations.add(self.line_number, error_msg)
2526

2627
from waveform_editor.waveform import Waveform
2728

@@ -30,9 +31,8 @@ def __init__(self, **kwargs):
3031
return
3132

3233
if self.waveform.tendencies[0].start != 0:
33-
self.value_error = ValueError(
34-
"The starting point of the first repeated tendency is not set to 0."
35-
)
34+
error_msg = "The starting point of the first repeated must be set to 0."
35+
self.annotations.add(self.line_number, error_msg)
3636

3737
# Link the last tendency to the first tendency in the repeated waveform
3838
# We must lock the start to 0, otherwise it will take the start value of the

0 commit comments

Comments
 (0)