lfl_freq_corr = lfl_freq.corr()
    directory.save("lfl_freq_corr", lfl_freq_corr)
    print "lfl_freq_corr: %s" % str(lfl_freq_corr.shape)


def main():
    import optparse

    parser = optparse.OptionParser("python %s [options]" % sys.argv[0])
    parser.add_option("-i", "--path", dest="path", default=None, help="Saved log file directory")
    parser.add_option(
        "-n", "--number-entries", dest="n_entries", type="int", default=-1, help="Number of log entries to process"
    )
    options, args = parser.parse_args()

    if not options.path:
        print "    Usage: %s" % parser.usage
        print __doc__
        print "    --help for more information"
        exit()

    directory = ObjectDirectory(options.path)
    print directory

    preprocess(directory, n_entries)


if __name__ == "__main__":
    versions()
    main()
Esempio n. 2
0
def summary(fileName="", uhtrs=[], runs=[""], pad=lambda x: 1,
            berMin=1.863e-13, berMax=1.0,
            ctp7=False, begin=False, end=False):

    assert fileName
    assert berMin
    assert runs

    if ctp7:
        xMin = -0.5
        xMax = 0.5
        samplePoint = None
        berMax = 1.0
    else:
        xMin = 0.0
        xMax = 1.0
        samplePoint = 0.598

    grs = common.graphs(uhtrs=uhtrs,
                        runs=runs,
                        xMin=xMin,
                        xMax=xMax,
                        ctp7=ctp7)
    c = r.TCanvas()
    c.Divide(2, 2)

    if begin:
        c.cd(0)
        c.Print(fileName+"[")

    h = r.TH2D("h", ";Horizontal Offset (UI); BER", 1, xMin, xMax, 1, berMin, berMax)
    h.SetStats(False)

    keep = []
    drawn = {1: False,
             2: False,
             3: False,
             4: False
             }

    line = r.TLine()
    line.SetLineStyle(2)

    for (uhtr, gtx100, gtx4, run), g in sorted(grs.iteritems()):
        iPad = pad(uhtr)
        c.cd(iPad)
        if not drawn[iPad]:
            h2 = h.DrawClone()
            title = "uHTR%d - CTP7" % uhtr if ctp7 else "%s, optical loop-back" % common.versions(uhtr)
            h2.SetTitle("%s, 6.4 Gbps" % title)
            keep.append(h2)

            drawn[iPad] = True
            if ctp7:
                leg = r.TLegend(0.44, 0.85, 0.64, 0.15)
            else:
                leg = r.TLegend(0.14, 0.80, 0.44, 0.15)
            leg.SetBorderSize(0)
            leg.SetFillStyle(0)
            if ctp7:
                leg.SetHeader("CTP7 GTH")
            keep.append(leg)
            if samplePoint is not None:
                line.DrawLine(samplePoint, berMin, samplePoint, berMax)
                leg.AddEntry(line, "IBERT sampling point", "l")
            leg.Draw("same")

        offset = 113 if ctp7 else 112
        iColor = 1 + gtx4 + 4*(gtx100 - offset)
        color = r.TColor.GetColorPalette(2 * iColor)

        g.SetLineStyle(1 + ((iColor-1) % 3))
        g.SetLineColor(color)
        g.SetMarkerColor(color)
        g.Draw("lsame")
        
        r.gPad.SetLogy()
        r.gPad.SetTickx()
        r.gPad.SetTicky()
        
        name = "_".join(g.GetName().split("_")[1:3])
        if run == "_1":
            name += " (100s)"
        elif not ctp7:
            name += " (1s)"
        leg.AddEntry(g, name, "l")

        nFibers = leg.GetNRows() - 2
        if nFibers == 24:
            leg.SetHeader("%d" % nFibers)
        else:
            leg.SetHeader("#color[2]{%d}" % nFibers)

    c.cd(0)
    c.Print(fileName)

    if end:
        c.cd(0)
        c.Print(fileName+"]")