Skip to content

Commit 5e283ca

Browse files
committed
ValueErrors instead of general Exceptions
1 parent b78f5ad commit 5e283ca

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/rsatoolbox/vis/model_plot.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,10 @@ def plot_model_comparison(result, sort=False, colors=None,
264264
models = [models[i] for i in idx]
265265
if not ('descend' in sort.lower() or
266266
'ascend' in sort.lower()):
267-
raise Exception('plot_model_comparison: Argument ' +
268-
'sort is incorrectly defined as '
269-
+ sort + '.')
267+
raise ValueError(
268+
'plot_model_comparison: Argument ' +
269+
'sort is incorrectly defined as ' +
270+
sort + '.')
270271

271272
# run tests
272273
if any([test_pair_comparisons,
@@ -290,9 +291,10 @@ def plot_model_comparison(result, sort=False, colors=None,
290291
elif 'nili' in test_pair_comparisons.lower():
291292
h_pair_tests = 0.4
292293
else:
293-
raise Exception('plot_model_comparison: Argument ' +
294-
'test_pair_comparisons is incorrectly defined as '
295-
+ test_pair_comparisons + '.')
294+
raise ValueError(
295+
'plot_model_comparison: Argument ' +
296+
'test_pair_comparisons is incorrectly defined as ' +
297+
test_pair_comparisons + '.')
296298
ax = plt.axes((l, b, w, h*(1-h_pair_tests)))
297299
axbar = plt.axes((l, b + h * (1 - h_pair_tests), w,
298300
h * h_pair_tests * 0.7))
@@ -359,7 +361,7 @@ def plot_model_comparison(result, sort=False, colors=None,
359361
marker=10, markersize=half_sym_size,
360362
linewidth=0)
361363
else:
362-
raise Exception(
364+
raise ValueError(
363365
'plot_model_comparison: Argument test_above_0' +
364366
' is incorrectly defined as ' + test_above_0 + '.')
365367

@@ -396,7 +398,7 @@ def plot_model_comparison(result, sort=False, colors=None,
396398
markerfacecolor=noise_ceil_col,
397399
markeredgecolor='none', linewidth=0)
398400
else:
399-
raise Exception(
401+
raise ValueError(
400402
'plot_model_comparison: Argument ' +
401403
'test_below_noise_ceil is incorrectly defined as ' +
402404
test_below_noise_ceil + '.')
@@ -908,7 +910,7 @@ def _get_model_comp_descr(test_type, n_models, multiple_pair_testing, alpha,
908910
' model-pair comparisons)')
909911
else:
910912
if 'uncorrected' not in multiple_pair_testing.lower():
911-
raise Exception(
913+
raise ValueError(
912914
'plot_model_comparison: Argument ' +
913915
'multiple_pair_testing is incorrectly defined as ' +
914916
multiple_pair_testing + '.')

0 commit comments

Comments
 (0)