Example #1
0
                else:
                    figure.name = name
                figure.files.append(os.path.join(paper_path, bn))

            elif line.startswith(r'\label'):
                label = line[line.index('{')+1:line.index('}')]
                assert label.startswith('fig:')
                label = label[4:]
                assert figure.label is None
                figure.label = label

def printwrap(s):
    for line in textwrap.wrap(s):
        print line

print colors.bold('parsed abstract:')
printwrap(repr(abstract))

for a,b in syms_replaces:
    abstract = abstract.replace(a,b)

print '\n', colors.bold('revised abstract:')
printwrap(abstract)

print '\n', colors.bold('parsed figures:')
for figure in figures:
    print '\n', colors.bold('%s %s' % (figure.name, figure.label))
    printwrap(repr(figure.caption))
    for fn in figure.files:
        print '   ', fn
print
    for x in commn:
        o1, o2 = [getattr(p, x).dumpPython() for p in process1, process2]
        if o1 != o2:
            if not commn_diff:
                print colors.yellow(pair_name + ' changed these:\n')
            print colors.yellow(x)
            print 'process1.%s =' % x, o1
            print 'process2.%s =' % x, o2
            commn_diff.append(x)

    added = [n for n in names2 if n not in names1]
    deled = [n for n in names1 if n not in names2]
  
    if added:
        print colors.yellow('%s added these: %s\n' % (pair_name, ' '.join(added)))
        for x in added:
            print 'process2.%s =' % x, getattr(process2, x).dumpPython()
    if deled:
        print colors.yellow('%s deled these: %s\n' % (pair_name, ' '.join(deled)))
        for x in deled:
            print 'process1.%s =' % x, getattr(process1, x).dumpPython()

    return commn_diff or added or deled

fns = sys.argv[1:]
del sys.argv[1:]
for fn1, fn2 in zip(fns, fns[1:]):
    if compare(fn1, fn2):
        print colors.bold('------------------------------------------------------------------\n')
Example #3
0
fns = root_fns_from_argv()
ns = [os.path.basename(fn).replace('.root', '') for fn in fns]
fs = [ROOT.TFile.Open(fn) for fn in fns]
ts = [f.Get('EventIdRecorder/t') for f in fs]
drs = [draw_hist_register(t) for t in ts]
cs = [1, 2, 3, 4, 6, 7, 8, 9] + range(40, 50) + range(30, 40)
while len(cs) < len(drs):
    cs *= 2

for j in [8]:  #xrange(2,12):
    header = 'lumi%' + str(j) + ' remainders\n'
    header += '%25s %12s   ' % ('sample', 'n')
    header += ' '.join('%10i' % i for i in xrange(j))
    header += '     ratio 1st half/2nd half'
    print colors.bold(header)

    hs = []
    for i, (n, t, dr, c) in enumerate(zip(ns, ts, drs, cs)):
        h = dr.draw('lumi%' + str(j), binning='%i,0,%i' % (j, j), goff=True)
        hs.append(h)
        h.SetStats(0)
        h.SetLineWidth(2)
        h.SetLineColor(c)
        h.SetMarkerColor(c)

        bcs = [h.GetBinContent(ibin) for ibin in xrange(1, j + 1)]
        print '%25s %12i  ' % (n, h.GetEntries()),
        print ' '.join(['%10i' % bc for bc in bcs]),

        a = sum(bcs[:j / 2])
Example #4
0
from sys import argv
from collections import defaultdict
from datetime import datetime
from JMTucker.Tools import DBS, colors, Samples

at_sites = ['T3_US_FNALLPC', 'T1_US_FNAL_Disk', 'T2_DE_DESY'] # ordered by priority
at = { x:defaultdict(list) for x in at_sites }

if 'main' in argv:
    dses = ['main']
else:
    dses = ['miniaod']

for ds in dses:
    print colors.bold(ds)
    for sample in Samples.registry.all():
        if not sample.has_dataset(ds):
            continue

        sample.set_curr_dataset(ds)
        if '/None/' in sample.dataset or getattr(sample, 'is_private', False):
            continue

        try:
            sites = DBS.sites_for_dataset(sample.dataset, instance=sample.dbs_inst, json=True)
        except (RuntimeError, ValueError):
            print colors.yellow('%s %s DBS problem' % (sample.name, sample.dataset))
            continue

        if not sites:
            continue
Example #5
0
                print colors.yellow(pair_name + ' changed these:\n')
            print colors.yellow(x)
            print 'process1.%s =' % x, o1
            print 'process2.%s =' % x, o2
            commn_diff.append(x)

    added = [n for n in names2 if n not in names1]
    deled = [n for n in names1 if n not in names2]

    if added:
        print colors.yellow('%s added these: %s\n' %
                            (pair_name, ' '.join(added)))
        for x in added:
            print 'process2.%s =' % x, getattr(process2, x).dumpPython()
    if deled:
        print colors.yellow('%s deled these: %s\n' %
                            (pair_name, ' '.join(deled)))
        for x in deled:
            print 'process1.%s =' % x, getattr(process1, x).dumpPython()

    return commn_diff or added or deled


fns = sys.argv[1:]
del sys.argv[1:]
for fn1, fn2 in zip(fns, fns[1:]):
    if compare(fn1, fn2):
        print colors.bold(
            '------------------------------------------------------------------\n'
        )