From 6825ac2877635bb055de46c7115ed8ab471560ad Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 24 Jul 2019 14:31:54 +0200 Subject: Improve debugging --- lib/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/utils.py') diff --git a/lib/utils.py b/lib/utils.py index effbd46..f31aa8e 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -195,11 +195,15 @@ def _corr_by_param(by_name, state_or_trans, attribute, param_index): param_values = np.array(list((map(lambda x: x[param_index], by_name[state_or_trans]['param'])))) try: return np.corrcoef(by_name[state_or_trans][attribute], param_values)[0, 1] - except FloatingPointError as fpe: + except FloatingPointError: # Typically happens when all parameter values are identical. # Building a correlation coefficient is pointless in this case # -> assume no correlation return 0. + except ValueError: + print('[!] Exception in _corr_by_param(by_name, state_or_trans={}, attribute={}, param_index={})'.format(state_or_trans, attribute, param_index)) + print('[!] while executing np.corrcoef(by_name[{}][{}]={}, {}))'.format(state_or_trans, attribute, by_name[state_or_trans][attribute], param_values)) + raise else: return 0. -- cgit v1.2.3