From 93f7762fb23b95c0b5cef813e2d99ad221c03759 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 13 Aug 2019 16:10:06 +0200 Subject: get_fit_result: Fix debug output --- lib/dfatool.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/dfatool.py b/lib/dfatool.py index 3d8c321..a66e673 100755 --- a/lib/dfatool.py +++ b/lib/dfatool.py @@ -1062,7 +1062,7 @@ def _num_args_from_by_name(by_name): num_args[key] = len(value['args'][0]) return num_args -def get_fit_result(results, name, attribute): +def get_fit_result(results, name, attribute, verbose = False): """ Parse and sanitize fit results for state/transition/... 'name' and model attribute 'attribute'. @@ -1071,18 +1071,19 @@ def get_fit_result(results, name, attribute): :param results: fit results as returned by `paramfit.results` :param name: state/transition/... name, e.g. 'TX' :param attribute: model attribute, e.g. 'duration' + :param verbose: print debug message to stdout when deliberately not using a determined fit function """ fit_result = dict() for result in results: if result['key'][0] == name and result['key'][1] == attribute and result['result']['best'] != None: this_result = result['result'] if this_result['best_rmsd'] >= min(this_result['mean_rmsd'], this_result['median_rmsd']): - vprint(self.verbose, '[I] Not modeling {} {} as function of {}: best ({:.0f}) is worse than ref ({:.0f}, {:.0f})'.format( + vprint(verbose, '[I] Not modeling {} {} as function of {}: best ({:.0f}) is worse than ref ({:.0f}, {:.0f})'.format( name, attribute, result['key'][2], this_result['best_rmsd'], this_result['mean_rmsd'], this_result['median_rmsd'])) # See notes on depends_on_param elif this_result['best_rmsd'] >= 0.8 * min(this_result['mean_rmsd'], this_result['median_rmsd']): - vprint(self.verbose, '[I] Not modeling {} {} as function of {}: best ({:.0f}) is not much better than ({:.0f}, {:.0f})'.format( + vprint(verbose, '[I] Not modeling {} {} as function of {}: best ({:.0f}) is not much better than ({:.0f}, {:.0f})'.format( name, attribute, result['key'][2], this_result['best_rmsd'], this_result['mean_rmsd'], this_result['median_rmsd'])) else: @@ -1282,7 +1283,7 @@ class AnalyticModel: if name in self._num_args: num_args = self._num_args[name] for attribute in self.by_name[name]['attributes']: - fit_result = get_fit_result(paramfit.results, name, attribute) + fit_result = get_fit_result(paramfit.results, name, attribute, self.verbose) if len(fit_result.keys()): x = analytic.function_powerset(fit_result, self.parameters, num_args) @@ -1639,7 +1640,7 @@ class PTAModel: if arg_support_enabled and self.by_name[state_or_tran]['isa'] == 'transition': num_args = self._num_args[state_or_tran] for model_attribute in self.by_name[state_or_tran]['attributes']: - fit_results = get_fit_result(paramfit.results, state_or_tran, model_attribute) + fit_results = get_fit_result(paramfit.results, state_or_tran, model_attribute, self.verbose) if (state_or_tran, model_attribute) in self.function_override: function_str = self.function_override[(state_or_tran, model_attribute)] -- cgit v1.2.3