Page MenuHomeHEPForge

No OneTemporary

diff --git a/bin/prof2-lsipol b/bin/prof2-ls
copy from bin/prof2-lsipol
copy to bin/prof2-ls
--- a/bin/prof2-lsipol
+++ b/bin/prof2-ls
@@ -1,59 +1,61 @@
#! /usr/bin/env python
"""\
%prog <ipolfile>
List the interpolations stored in <ipolfile>. Useful for writing a default weights file.
"""
import optparse, os, sys
op = optparse.OptionParser(usage=__doc__)
-op.add_option("--wfile", dest="WFILE", default=None, help="Path to a weight file to write to")
+op.add_option("-w", dest="WFILE", default=False, action="store_true", help="Output for suitable for weightfile")
op.add_option("-v", "--debug", dest="DEBUG", action="store_true", default=False, help="Turn on some debug messages")
op.add_option("-q", "--quiet", dest="QUIET", action="store_true", default=False, help="Turn off messages")
opts, args = op.parse_args()
## Get mandatory arguments
if len(args) < 1:
print "Argument missing... exiting\n\n"
op.print_usage()
sys.exit(1)
IFILE = args[0]
## Load Professor and show the standard banner
import professor2 as prof
-if not opts.QUIET:
- print prof.logo
-
## Read persisted interpolations to re-create the ipol Histos
META, IHISTOS = prof.read_ipolhistos(IFILE)
maxlen = max(len(h) for h in IHISTOS.keys())
hfmt = "{0:%ds}" % maxlen
-## Print!
-if not opts.QUIET:
+
+
+
+## Democratic weights file to std out
+if opts.WFILE:
+ curr = ""
+ for path, h in sorted(IHISTOS.iteritems()):
+ new = path.split("/")[1]
+ if curr != new:
+ curr = new
+ s = hfmt.format(path)
+ s += " 1.0 # {n:d} bins from {xmin:g} to {xmax:g}".format(n=len(h), xmin=h.bins[0].xmin, xmax=h.bins[-1].xmax)
+ print s
+
+else:
+ ## Print!
if opts.DEBUG:
print "Metadata:"
for k, v in sorted(META.iteritems()):
print " ", k, "=", v
print "\n"
- print "Histos:"
- for path, h in sorted(IHISTOS.iteritems()):
- print " ", hfmt.format(path) #+ " " + ...
+ else:
+ print "\nObjects:"
+ for path, h in sorted(IHISTOS.iteritems()):
+ print " ", hfmt.format(path) #+ " " + ...
-
-## Write!
-if opts.WFILE:
- with open(opts.WFILE, "w") as f:
- curr = ""
- for path, h in sorted(IHISTOS.iteritems()):
- new = path.split("/")[1]
- if curr != new:
- f.write("\n")
- curr = new
- s = hfmt.format(path)
- s += " 1.0 # {n:d} bins from {xmin:g} to {xmax:g}".format(n=len(h), xmin=h.bins[0].xmin, xmax=h.bins[-1].xmax)
- f.write(s + "\n")
+ print "\nRanges of parameters:"
+ for num, p in enumerate(META["ParamNames"].split()):
+ print " %s\t%s\t%s"%(META["MinParamVals"].split()[num], META["MaxParamVals"].split()[num], p)

File Metadata

Mime Type
text/x-diff
Expires
Sat, May 3, 6:25 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4983016
Default Alt Text
(2 KB)

Event Timeline