From 54999aa1fcaccf3b4eec98ace030b17260954e2b Mon Sep 17 00:00:00 2001 From: "hiyoneda.dlbox" Date: Sat, 2 Nov 2024 09:13:21 +0900 Subject: [PATCH] Added an option to show the delta log-likelihood --- cosipy/image_deconvolution/MAP_RichardsonLucy.py | 4 ++++ cosipy/image_deconvolution/RichardsonLucy.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cosipy/image_deconvolution/MAP_RichardsonLucy.py b/cosipy/image_deconvolution/MAP_RichardsonLucy.py index f66b25e2..f13c1ce4 100644 --- a/cosipy/image_deconvolution/MAP_RichardsonLucy.py +++ b/cosipy/image_deconvolution/MAP_RichardsonLucy.py @@ -274,6 +274,8 @@ def check_stopping_criteria(self): log_likelihood = np.sum(self.results[-1]["log-likelihood"]) log_likelihood_before = np.sum(self.results[-2]["log-likelihood"]) + + logger.debug(f'Delta log-likelihood: {log_likelihood - log_likelihood_before}') if log_likelihood - log_likelihood_before < self.stopping_criteria_threshold: return True @@ -283,6 +285,8 @@ def check_stopping_criteria(self): log_posterior = self.results[-1]["log-posterior"] log_posterior_before = self.results[-2]["log-posterior"] + logger.debug(f'Delta log-posterior: {log_posterior - log_posterior_before}') + if log_posterior - log_posterior_before < self.stopping_criteria_threshold: return True diff --git a/cosipy/image_deconvolution/RichardsonLucy.py b/cosipy/image_deconvolution/RichardsonLucy.py index 26cb1018..4300f234 100644 --- a/cosipy/image_deconvolution/RichardsonLucy.py +++ b/cosipy/image_deconvolution/RichardsonLucy.py @@ -176,6 +176,8 @@ def check_stopping_criteria(self): log_likelihood = np.sum(self.results[-1]["log-likelihood"]) log_likelihood_before = np.sum(self.results[-2]["log-likelihood"]) + + logger.debug(f'Delta log-likelihood: {log_likelihood - log_likelihood_before}') if log_likelihood - log_likelihood_before < self.stopping_criteria_threshold: return True