diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-07-24 14:31:54 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-07-24 14:31:54 +0200 |
commit | 6825ac2877635bb055de46c7115ed8ab471560ad (patch) | |
tree | f33648f7401b8dfd10d54c0594f1328324c8756b /lib/utils.py | |
parent | 17a92f0bac1ff80ed87b43168e25e24d59e41d39 (diff) |
Improve debugging
Diffstat (limited to 'lib/utils.py')
-rw-r--r-- | lib/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
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. |