From 541e1ef4de8ad41815dc4902775f96ad39cb9392 Mon Sep 17 00:00:00 2001
From: Jack Christopher Hutchinson Rolph <jack.rolph@desy.de>
Date: Sun, 14 Nov 2021 10:22:11 +0100
Subject: [PATCH] Update PeakOTron.py

---
 PeakOTron.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/PeakOTron.py b/PeakOTron.py
index fd576cb..bec81f1 100644
--- a/PeakOTron.py
+++ b/PeakOTron.py
@@ -1216,7 +1216,7 @@ class PeakOTron:
         
     
   
-    def PlotSummary(self, display=True, save_directory=None):
+    def PlotSummary(self, save_directory=None):
     
             fig = plt.figure(figsize=(20,40))
             gs = gridspec.GridSpec(4, 2)
@@ -1402,6 +1402,16 @@ class PeakOTron:
                                        prominence=prominence
                                       )
             
+            
+        limit_s = pedestal_s - 0.5*est_gain
+        limit = pedestal - 0.5*est_gain*self.scaler.scale_[0]
+        cond_limit_s = (x_kde_s[peaks]>limit_s)
+        if(sum(cond_limit_s)<3):
+            if(self._verbose):
+                print("No peaks observed above pedestal - gain/2. Continuing without thresholding...")
+        else:
+            peaks = peaks[cond_limit_s]
+                
                 
   
         
-- 
GitLab