@@ -264,9 +264,10 @@ def plot_model_comparison(result, sort=False, colors=None,
264
264
models = [models [i ] for i in idx ]
265
265
if not ('descend' in sort .lower () or
266
266
'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 + '.' )
270
271
271
272
# run tests
272
273
if any ([test_pair_comparisons ,
@@ -290,9 +291,10 @@ def plot_model_comparison(result, sort=False, colors=None,
290
291
elif 'nili' in test_pair_comparisons .lower ():
291
292
h_pair_tests = 0.4
292
293
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 + '.' )
296
298
ax = plt .axes ((l , b , w , h * (1 - h_pair_tests )))
297
299
axbar = plt .axes ((l , b + h * (1 - h_pair_tests ), w ,
298
300
h * h_pair_tests * 0.7 ))
@@ -360,7 +362,7 @@ def plot_model_comparison(result, sort=False, colors=None,
360
362
marker = 10 , markersize = half_sym_size ,
361
363
linewidth = 0 )
362
364
else :
363
- raise Exception (
365
+ raise ValueError (
364
366
'plot_model_comparison: Argument test_above_0' +
365
367
' is incorrectly defined as ' + test_above_0 + '.' )
366
368
@@ -397,7 +399,7 @@ def plot_model_comparison(result, sort=False, colors=None,
397
399
markerfacecolor = noise_ceil_col ,
398
400
markeredgecolor = 'none' , linewidth = 0 )
399
401
else :
400
- raise Exception (
402
+ raise ValueError (
401
403
'plot_model_comparison: Argument ' +
402
404
'test_below_noise_ceil is incorrectly defined as ' +
403
405
test_below_noise_ceil + '.' )
@@ -429,7 +431,7 @@ def plot_model_comparison(result, sort=False, colors=None,
429
431
significant = p_pairwise < crit
430
432
else :
431
433
if 'uncorrected' not in multiple_pair_testing .lower ():
432
- raise Exception (
434
+ raise ValueError (
433
435
'plot_model_comparison: Argument ' +
434
436
'multiple_pair_testing is incorrectly defined as ' +
435
437
multiple_pair_testing + '.' )
@@ -793,7 +795,11 @@ def plot_arrows(axbar, significant):
793
795
k += 1
794
796
axbar .plot ((i , j ), (k , k ), 'k-' , linewidth = 2 )
795
797
occupied [k - 1 , i * 3 + 2 :j * 3 + 1 ] = 1
796
- h = occupied .sum (axis = 1 ).nonzero ()[0 ].max ()+ 1
798
+ h = occupied .sum (axis = 1 )
799
+ if np .any (h > 0 ):
800
+ h = h .nonzero ()[0 ].max ()+ 1
801
+ else :
802
+ h = 1
797
803
axbar .set_ylim ((0 , max (expected_n_lines , h )))
798
804
799
805
@@ -905,7 +911,7 @@ def _get_model_comp_descr(test_type, n_models, multiple_pair_testing, alpha,
905
911
' model-pair comparisons)' )
906
912
else :
907
913
if 'uncorrected' not in multiple_pair_testing .lower ():
908
- raise Exception (
914
+ raise ValueError (
909
915
'plot_model_comparison: Argument ' +
910
916
'multiple_pair_testing is incorrectly defined as ' +
911
917
multiple_pair_testing + '.' )
0 commit comments