[yoda-svn] yoda: 2 new changesets

YODA Mercurial yoda at projects.hepforge.org
Fri Jun 29 16:15:02 BST 2018


details:   https://yoda.hepforge.org/hg/yoda/rev/d8f15d2ac23a
branches:  release-1-7
changeset: 1467:d8f15d2ac23a
user:      Christian Gutschow <chris.g at cern.ch>
date:      Fri Jun 29 16:03:51 2018 +0100
description:
issue warning when attempting to normalise empty histogram rather than throwing and error

details:   https://yoda.hepforge.org/hg/yoda/rev/4e55536f638c
branches:  release-1-7
changeset: 1468:4e55536f638c
user:      Christian Gutschow <chris.g at cern.ch>
date:      Fri Jun 29 16:04:42 2018 +0100
description:
issue warning when attempting to normalise empty histogram rather than throwing and error

diffs (truncated from 2291 to 50 lines):

--- a/ChangeLog	Wed May 16 15:05:44 2018 +0100
+++ b/ChangeLog	Fri Jun 29 16:04:42 2018 +0100
@@ -1,3 +1,10 @@
+2018-06-01  Louie Corpe  <lcorpe at cern.ch>
+
+	* Point1,2,3D now support multiple error sources for the highest dimension.
+	
+	* Scatter1,2,3D now read in/out with additional columns for the extra error
+	sources, with a variations() method to check with sources are available
+
 2018-05-02  Andy Buckley  <andy.buckley at cern.ch>
 
 	* StringUtils.h: Replace std::ptr_fun (removed in C++17) with a lambda function. Thanks to Stefan Richter.
--- a/bin/yodamerge	Wed May 16 15:05:44 2018 +0100
+++ b/bin/yodamerge	Fri Jun 29 16:04:42 2018 +0100
@@ -246,21 +246,32 @@
                 sys.stderr.write(msg + "\n")
                 npoints = len(ao_out.points)
                 for i in range(npoints):
-                    val_i = ep_i = em_i = scalesum = 0.0
+                    val_i = scalesum = 0.0
+                    ep_i = {} # will hold the values of the multiple error sources 
+                    em_i = {} # will hold the values of the multiple error sources 
                     for ao in aos:
                         scale = float(ao.annotation("yodamerge_scale"))
+                        variations=ao.variations()
                         scalesum += scale
                         val_i += scale * ao.points[i].val(dim)
-                        ep_i += (scale * ao.points[i].errs(dim)[0])**2
-                        em_i += (scale * ao.points[i].errs(dim)[1])**2
-                    ep_i = math.sqrt(ep_i)
-                    em_i = math.sqrt(em_i)
+                        for var in variations:
+                          if not var in ep_i.keys(): 
+                            ep_i[var]=0.
+                            em_i[var]=0.
+                          ep_i[var] += (scale * ao.points[i].errs(dim,var)[0])**2
+                          em_i[var] += (scale * ao.points[i].errs(dim,var)[1])**2
+                    for var in ep_i.keys(): 
+                      ep_i[var] = math.sqrt(ep_i[var])
+                      em_i[var] = math.sqrt(em_i[var])
                     if SND_MODE == "assume_mean":
                         val_i /= scalesum
-                        ep_i  /= scalesum
-                        em_i  /= scalesum
+                        for var in ep_i.keys(): 
+                          ep_i[var]  /= scalesum
+                          em_i[var]  /= scalesum
                     setattr(ao_out.points[i],'%s' % axis[dim], val_i)
-                    setattr(ao_out.points[i],'%sErrs' % axis[dim], (ep_i, em_i))


More information about the yoda-svn mailing list