[yoda-svn] yoda: 2 new changesets

YODA Mercurial yoda at projects.hepforge.org
Thu Jul 21 22:30:01 BST 2016


details:   https://yoda.hepforge.org/hg/yoda/rev/b1e6bd73858a
branches:  release-1-6
changeset: 1281:b1e6bd73858a
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Jul 21 21:44:18 2016 +0100
description:
Fix merging logic to handle cases where an AO only appears once

details:   https://yoda.hepforge.org/hg/yoda/rev/8447238df894
branches:  release-1-6
changeset: 1282:8447238df894
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Jul 21 22:28:14 2016 +0100
description:
Add --type-mismatch-mode flag and fallback logic to yodamerge.

diffs (truncated from 126 to 50 lines):

--- a/ChangeLog	Tue Jul 19 21:25:26 2016 +0100
+++ b/ChangeLog	Thu Jul 21 22:28:14 2016 +0100
@@ -1,3 +1,9 @@
+2016-07-21  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add --type-mismatch-mode flag and fallback logic to yodamerge.
+
+	* Fix yodamerge logic to handle cases where an AO only appears once.
+
 2016-07-19  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Deprecate flat2yoda script and add warning output to it and the AIDA conversion scripts.
--- a/bin/yodamerge	Tue Jul 19 21:25:26 2016 +0100
+++ b/bin/yodamerge	Thu Jul 21 22:28:14 2016 +0100
@@ -102,17 +102,19 @@
 import yoda, optparse, sys, math
 
 parser = optparse.OptionParser(usage=__doc__)
-parser.add_option('-o', '--output', default='-', dest='OUTPUT_FILE')
-parser.add_option('--s1dmode', default="assume_mean", dest='S1D_MODE',
+parser.add_option("-o", "--output", default="-", dest="OUTPUT_FILE")
+parser.add_option("--add", action="store_true", default=False, dest="STACK", help="force simple stacking")
+parser.add_option("--s1d-mode", "--s1dmode", default="assume_mean", dest="S1D_MODE",
                   help="choose strategy for combining Scatter1D objects: one of 'first', 'combine', 'assume_mean'")
-parser.add_option('--s2dmode', default="assume_mean", dest='S2D_MODE',
+parser.add_option("--s2d-mode", "--s2dmode", default="assume_mean", dest="S2D_MODE",
                   help="choose strategy for combining Scatter2D objects: one of 'first', 'combine', 'assume_mean'")
-parser.add_option('--s3dmode', default="assume_mean", dest='S3D_MODE',
+parser.add_option("--s3d-mode", "--s3dmode", default="assume_mean", dest="S3D_MODE",
                   help="choose strategy for combining Scatter3D objects: one of 'first', 'combine', 'assume_mean'")
-parser.add_option('--no-veto-empty', action="store_false", default=True, dest='VETO_EMPTY',
+parser.add_option("--type-mismatch-mode", default="scatter", dest="TYPE_MISMATCH_MODE",
+                  help="choose strategy for combining objects whose types mismatch: one of 'first', 'scatter'")
+parser.add_option("--no-veto-empty", action="store_false", default=True, dest="VETO_EMPTY",
                   help="disable the removal of empty (sumW=0) data objects _before_ applying merge heuristics. You probably want the default!")
-parser.add_option('--add', action="store_true", default=False, dest='STACK', help="force simple stacking")
-parser.add_option('--assume-normalized', action="store_true", default=False, dest='ASSUME_NORMALIZED',
+parser.add_option("--assume-normalized", action="store_true", default=False, dest="ASSUME_NORMALIZED",
                   help="DEPRECATED, AND DOES NOTHING. This option _used_ to bypass the detection heuristic for unnormalized histograms")
 opts, fileargs = parser.parse_args()
 
@@ -141,9 +143,27 @@
 
     ## Check that types match, and just output the first one if they don't
     if not all(type(ao) is aotype for ao in aos):
-        sys.stderr.write("WARNING: Several types of analysis object found at path %s: cannot be merged\n")
-        analysisobjects_out[p] = aos[0]
-        continue
+        msg = "WARNING: cannot merge mismatched analysis object types for path %s: " % p
+        scatter_fail = False


More information about the yoda-svn mailing list