From 974a9fcae4413b3e8e10877a23497f9500fc5978 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 20 Mar 2013 10:39:20 +0100 Subject: [PATCH] Improving user messages for adjoint and gradient checkers --- src/daComposant/daAlgorithms/AdjointTest.py | 9 ++++++--- src/daComposant/daAlgorithms/GradientTest.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/daComposant/daAlgorithms/AdjointTest.py b/src/daComposant/daAlgorithms/AdjointTest.py index 7276b7b..a7e8033 100644 --- a/src/daComposant/daAlgorithms/AdjointTest.py +++ b/src/daComposant/daAlgorithms/AdjointTest.py @@ -129,9 +129,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): else: __doc__ = "" # - msgs = " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" - msgs += " " + self._parameters["ResultTitle"] + "\n" - msgs += " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + if len(self._parameters["ResultTitle"]) > 0: + msgs = " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + msgs += " " + self._parameters["ResultTitle"] + "\n" + msgs += " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + else: + msgs = "" msgs += __doc__ # msg = " i Alpha ||X|| ||Y|| ||dX|| R(Alpha) " diff --git a/src/daComposant/daAlgorithms/GradientTest.py b/src/daComposant/daAlgorithms/GradientTest.py index aa547a7..36bce3f 100644 --- a/src/daComposant/daAlgorithms/GradientTest.py +++ b/src/daComposant/daAlgorithms/GradientTest.py @@ -159,9 +159,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): else: __doc__ = "" # - msgs = " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" - msgs += " " + self._parameters["ResultTitle"] + "\n" - msgs += " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + if len(self._parameters["ResultTitle"]) > 0: + msgs = " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + msgs += " " + self._parameters["ResultTitle"] + "\n" + msgs += " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n" + else: + msgs = "" msgs += __doc__ # msg = " i Alpha ||X|| ||F(X)|| ||F(X+dX)|| ||dX|| ||F(X+dX)-F(X)|| ||F(X+dX)-F(X)||/||dX|| R(Alpha) " -- 2.39.2