From 239bb536c8a41af10974a7d87a1e7eb50dadc23c Mon Sep 17 00:00:00 2001 From: Pedro Sotorrio Date: Wed, 23 Aug 2023 14:47:38 -0700 Subject: [PATCH] handle possibility best indices and best_optval are None to avoid en error --- foqus_lib/gui/sdoe/sdoeSetupFrame.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/foqus_lib/gui/sdoe/sdoeSetupFrame.py b/foqus_lib/gui/sdoe/sdoeSetupFrame.py index afdc1d8c0..0379f1feb 100644 --- a/foqus_lib/gui/sdoe/sdoeSetupFrame.py +++ b/foqus_lib/gui/sdoe/sdoeSetupFrame.py @@ -2576,11 +2576,17 @@ def runOdoe(self): ) time_list.append(time.time() - t0) self.resultMessage += "Results for Run #%d:\n" % (nr + 1) - self.resultMessage += "Best Design(s): %s\n" % best_indices - self.resultMessage += "Best %s-Optimality Value: %f\n\n" % ( - optCriterion, - best_optval, - ) + if best_indices is not None: + self.resultMessage += "Best Design(s): %s\n" % best_indices + else: + self.resultMessage += "Best Design(s): Not Found\n" + if best_optval is not None: + self.resultMessage += "Best %s-Optimality Value: %f\n\n" % ( + optCriterion, + best_optval, + ) + else: + self.resultMessage += "Best %s-Optimality Value: Not Found\n\n" # Save results to text file resultsFile = os.path.join(outdir, "odoe_results.txt")