|
[Rivet-svn] r1652 - trunk/binblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Jul 3 13:12:56 BST 2009
Author: buckley Date: Fri Jul 3 13:12:56 2009 New Revision: 1652 Log: Adding script to dump metadata to YAML, as part of the (hopefully quick) migration of metadata to data files (i.e. reduce analysis code, remove need to recompile for metadata changes to take effect, etc.) Added: trunk/bin/meta2yaml (contents, props changed) Added: trunk/bin/meta2yaml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/bin/meta2yaml Fri Jul 3 13:12:56 2009 (r1652) @@ -0,0 +1,54 @@ +#! /usr/bin/env python + +import sys, os +PROGPATH = sys.argv[0] +PROGNAME = os.path.basename(PROGPATH) + +## Change dlopen status to GLOBAL for Rivet lib +try: + import ctypes + sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) +except: + import dl + sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) + +import textwrap +import rivet +anames = rivet.AnalysisLoader.allAnalysisNames() + +for aname in anames: + ana = rivet.AnalysisLoader.getAnalysis(aname) + s = "" + s += "Name: %s\n" % ana.name() + s += "Summary: %s\n" % ana.summary() + s += "Experiment: %s\n" % ana.experiment() + s += "Collider: %s\n" % ana.collider() + s += "SpiresID: %s\n" % ana.spiresId() + s += "Status: %s\n" % ana.status() + + s += "Authors:\n" + for a in ana.authors(): + s += " - %s\n" % a + + s += "References:\n" + for r in ana.references(): + s += " - %s\n" % r + + if ana.runInfo(): + s += "RunInfo:\n" + #lines = textwrap.wrap(ana.runInfo()) + lines = ana.runInfo().splitlines() + for l in lines: + s += " %s\n" % l + + s += "Description:\n" + lines = textwrap.wrap(ana.description()) + for l in lines: + s += " %s\n" % l + + + #print s + #print "\n\n-----------------------------\n\n" + f = open("%s.info.yaml" % aname, "w") + f.write(s) + f.close()
More information about the Rivet-svn mailing list |