From 889729d2ce54d0b2a40e8ca7ec23f509106ceb83 Mon Sep 17 00:00:00 2001 From: Jack Christopher Hutchinson Rolph <jack.rolph@desy.de> Date: Mon, 1 Aug 2022 15:57:25 +0200 Subject: [PATCH] Update PeakOTron.py --- PeakOTron.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/PeakOTron.py b/PeakOTron.py index a410070..29ab033 100644 --- a/PeakOTron.py +++ b/PeakOTron.py @@ -1226,14 +1226,19 @@ class PeakOTron: if(self._verbose): print("Fitting...") - m_DRM.strategy=1 + m_DRM.strategy=2 m_DRM.errordef=m_DRM.LIKELIHOOD m_DRM.migrad(ncall = self._n_call_minuit, iterate= self._n_iterations_minuit) + ######################################################################################################## + ##Make a copy of the basic fit. + ######################################################################################################## + + + m_DRM_GP = deepcopy(m_DRM) - - + ######################################################################################################## ##Perform second fit under hypothesis there are dark counts, afterpulses. ######################################################################################################## @@ -1246,6 +1251,19 @@ class PeakOTron: m_DRM.strategy=2 m_DRM.migrad(ncall = self._n_call_minuit, iterate= self._n_iterations_minuit) + + + ######################################################################################################## + ## If the basic GP fit performs best, it means there isn't enough information between the peaks to fit dark counts/correlated noise. This fit is used + ## in preference. + ######################################################################################################## + + if(m_DRM_GP.fval < m_DRM.fval): + if(self._verbose): + print("Standard GP model fitted better than GP+DCR+AP. Implies peaks are too close to resolve inter-peak regions. DCR and pAp set to 0.") + m_DRM = m_DRM_GP + + m_DRM.hesse() self._m_DRM = m_DRM -- GitLab