|
[Rivet-svn] r3465 - trunk/binblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSun Oct 30 21:47:15 GMT 2011
Author: holsch Date: Sun Oct 30 21:47:15 2011 New Revision: 3465 Log: Make the -m CL option also accept observable text files as argument Modified: trunk/bin/compare-histos Modified: trunk/bin/compare-histos ============================================================================== --- trunk/bin/compare-histos Thu Oct 27 22:52:39 2011 (r3464) +++ trunk/bin/compare-histos Sun Oct 30 21:47:15 2011 (r3465) @@ -152,7 +152,8 @@ # default=None, help="specify a file containing a list of histograms to plot, in the format " # "/ANALYSIS_ID/histoname, one per line, e.g. '/DELPHI_1996_S3430090/d01-x01-y01'.") selgroup.add_option("-m", "--match", action="append", - help="Only write out histograms whose $path/$name string matches these regexes", + help="Only write out histograms whose $path/$name string matches these regexes. The argument " + "may also be a text file.", dest="PATHPATTERNS") selgroup.add_option("-M", "--unmatch", action="append", help="Exclude histograms whose $path/$name string matches these regexes", @@ -209,6 +210,14 @@ import re if opts.PATHPATTERNS is None: opts.PATHPATTERNS = [] + # See if a pattern option is an observable file and append its contents to + # the pattern list + import os + for m in opts.PATHPATTERNS: + if os.path.exists(m): + f=open(m, "r") + opts.PATHPATTERNS.extend([line.strip() for line in f if not line.startswith("#")]) + f.close() opts.PATHPATTERNS = [re.compile(r) for r in opts.PATHPATTERNS] if opts.PATHUNPATTERNS is None: opts.PATHUNPATTERNS = []
More information about the Rivet-svn mailing list |