Page MenuHomeHEPForge

No OneTemporary

diff --git a/bin/yoda2yoda b/bin/yoda2yoda
new file mode 100644
--- /dev/null
+++ b/bin/yoda2yoda
@@ -0,0 +1,28 @@
+#! /usr/bin/env python
+
+"""\
+%prog yodafile [yodafile2]
+
+Convert a YODA data file to another YODA file (for convenient tidying and filtering).
+Like yodacnv, but allows output to stdout since the output format isn't auto-detected.
+"""
+
+import yoda, os, sys, optparse
+from yoda.script_helpers import parse_x2y_args, filter_aos
+
+parser = optparse.OptionParser(usage=__doc__)
+parser.add_option("-m", "--match", dest="MATCH", metavar="PATT", default=None,
+ help="Only write out histograms whose path matches this regex")
+parser.add_option("-M", "--unmatch", dest="UNMATCH", metavar="PATT", default=None,
+ help="Exclude histograms whose path matches this regex")
+
+opts, args = parser.parse_args()
+in_out = parse_x2y_args(args, ".yoda", ".yoda")
+if not in_out:
+ sys.stderr.write("You must specify the YODA input and output file names\n")
+ sys.exit(1)
+
+for i, o in in_out:
+ analysisobjects = yoda.readYODA(i)
+ filter_aos(analysisobjects, opts.MATCH, opts.UNMATCH)
+ yoda.writeYODA(analysisobjects, o)

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 4:16 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3805101
Default Alt Text
(1 KB)

Event Timeline