From c39a1a781b37f9d249c8dd533b6a150acebc650e Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Tue, 2 Jul 2019 10:07:20 +0100 Subject: added print of reached tolerance --- Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py | 5 ++++- Wrappers/Python/test/test_algorithms.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Wrappers') diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py b/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py index 5a8341e..d3aea8e 100755 --- a/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py +++ b/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py @@ -115,6 +115,9 @@ class CGLS(Algorithm): if flag: self.update_objective() - print (self.verbose_output()) + if self.iteration > self._iteration[-1]: + print (self.verbose_output()) + print('Tolerance is reached: {}'.format(self.tolerance)) + return flag diff --git a/Wrappers/Python/test/test_algorithms.py b/Wrappers/Python/test/test_algorithms.py index 3bb3d57..4bcc95a 100755 --- a/Wrappers/Python/test/test_algorithms.py +++ b/Wrappers/Python/test/test_algorithms.py @@ -72,7 +72,7 @@ class TestAlgorithms(unittest.TestCase): identity = Identity(ig) alg = CGLS(x_init=x_init, operator=identity, data=b) - alg.max_iteration = 1 + alg.max_iteration = 200 alg.run(20, verbose=True) self.assertNumpyArrayAlmostEqual(alg.x.as_array(), b.as_array()) -- cgit v1.2.3