Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7877700
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
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
Details
Attached
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)
Attached To
rYODAHG yodahg
Event Timeline
Log In to Comment