Parcourir la source

separates hist normalization from scaling and makes stats off by default

Caleb Fangmeier il y a 7 ans
Parent
commit
432ec42e27
2 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 6 3
      filval/histogram_utils.py
  2. 1 1
      filval/plotter.py

+ 6 - 3
filval/histogram_utils.py

@@ -91,12 +91,15 @@ def hist_integral(hist, times_bin_width=True):
     else:
         return sum(values)
 
-
-def hist_normalize(hist, norm = 1):
+def hist_scale(hist, scale):
     values, errors, edges = hist
-    scale = norm/np.sum(values)
     return values*scale, errors*scale, edges
 
+def hist_normalize(hist, norm = 1):
+    scale = norm/np.sum(hist[0])
+    return hist_scale(hist, scale)
+
+
 
 def hist_mean(hist):
     xs = hist_bin_centers(hist)

+ 1 - 1
filval/plotter.py

@@ -234,7 +234,7 @@ def add_decorations(axes, luminosity, energy):
 
 def hist_plot(h, *args, norm=None, include_errors=False,
               log=False, xlim=None, ylim=None, fit=None,
-              grid=False, stats=True, **kwargs):
+              grid=False, stats=False, **kwargs):
     """ Plots a 1D ROOT histogram object using matplotlib """
     from inspect import signature
     if norm: