From 313f8474b22b557bd7706e72e0c59ff27673480e Mon Sep 17 00:00:00 2001 From: mdtanker Date: Tue, 19 Nov 2024 10:13:10 -0500 Subject: [PATCH] fix: exception for trail worsening warning --- src/invert4geom/optimization.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/invert4geom/optimization.py b/src/invert4geom/optimization.py index fac752d..d90d479 100644 --- a/src/invert4geom/optimization.py +++ b/src/invert4geom/optimization.py @@ -546,13 +546,16 @@ def _warn_limits_better_than_trial_multi_params( # if study direction is maximize if study.direction == optuna.study.StudyDirection.MAXIMIZE: # if current trial is worse than either limit, log a warning - if trial.values[0] < min(scores): - log.info( - msg, - trial.number, - trial.params, - trial.values[0], - ) + try: + if trial.values[0] < min(scores): + log.info( + msg, + trial.number, + trial.params, + trial.values[0], + ) + except TypeError: + pass else: pass