当前位置: 首页>>代码示例>>Python>>正文


Python Graph.show方法代码示例

本文整理汇总了Python中graphs.Graph.show方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.show方法的具体用法?Python Graph.show怎么用?Python Graph.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在graphs.Graph的用法示例。


在下文中一共展示了Graph.show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeResults

# 需要导入模块: from graphs import Graph [as 别名]
# 或者: from graphs.Graph import show [as 别名]

#.........这里部分代码省略.........
        mts = {}
        msteps = {}
        mdevs = {}
        stepByStep = {}
        try:
            fn = "checks/%s.pdf" % checkName
            pdf = PdfPages(fn)
            for name, method in methods.iteritems():
                avgs = {}
                rdiffs = {}
                adiffs = {}
                devs = {}
                ts = {}
                stepStats = {}
                steps = {"total": None}
                for target, tsteps in method["real_steps"].iteritems():
                    st = zip(*map(lambda x: (2 * x[0], x[1]), tsteps))
                    step_time = np.array((0,) + st[1])
                    step_values = np.array((0,) + st[0])
                    steps[target] = (step_time, step_values)
                    steps["total"] = (
                        (step_time, np.add(steps["total"][1], step_values))
                        if steps["total"] is not None
                        else (step_time, step_values)
                    )

                stepStats["baseline"] = {}
                for pair in method["pairs"]:
                    avg = map(lambda measure: measure.rttavg, pair.measures)
                    adiff = map(lambda measure: pair.subtrackBaseline(measure).rttavg - 2 * measure.step, pair.measures)
                    rdiff = map(
                        lambda measure: abs(pair.subtrackBaseline(measure).rttavg) / (2 * measure.step + 1),
                        pair.measures,
                    )
                    dev = map(lambda measure: measure.rttdev, pair.measures)
                    for measure in pair.baselineMeasures:
                        if not mboxes["baselineMeasures"].has_key(name):
                            mboxes["baselineMeasures"][name] = []
                        mboxes["baselineMeasures"][name].append(measure.rttavg)
                        if not stepStats["baseline"].has_key(pair.getPair()):
                            stepStats["baseline"][pair.getPair()] = []
                        stepStats["baseline"][pair.getPair()].append(
                            (measure.timestamp, measure.rttavg, measure.rttdev)
                        )

                    for measure in pair.measures:
                        if not mboxes.has_key(measure.step):
                            mboxes[measure.step] = {}
                        if not mboxes[measure.step].has_key(name):
                            mboxes[measure.step][name] = []
                        # mboxes[measure.step][name].append(measure.rttavg)
                        mboxes[measure.step][name].append(pair.subtrackBaseline(measure).rttavg)

                        if not stepStats.has_key(measure.step):
                            stepStats[measure.step] = {}
                        if not stepStats[measure.step].has_key(pair.getPair()):
                            stepStats[measure.step][pair.getPair()] = []
                        stepStats[measure.step][pair.getPair()].append(
                            (measure.timestamp, measure.rttavg, measure.rttdev)
                        )

                    if not mboxes["baseline"].has_key(pair.getPair()):
                        mboxes["baseline"][pair.getPair()] = {}
                    mboxes["baseline"][pair.getPair()][name] = (pair.baseline.rttavg, pair.baseline.rttdev)

                    t = map(lambda measure: measure.timestamp, pair.measures)
                    avgs[pair.getPair()] = np.array(avg)
                    rdiffs[pair.getPair()] = np.log10(np.array(rdiff))
                    # rdiffs[pair.getPair()] = np.array(rdiff)
                    adiffs[pair.getPair()] = np.array(adiff)
                    devs[pair.getPair()] = np.array(dev)
                    ts[pair.getPair()] = np.array(t)

                # save results
                mavgs[name] = avgs
                mrdiffs[name] = rdiffs
                madiffs[name] = adiffs
                mdevs[name] = devs
                msteps[name] = steps
                mts[name] = ts
                stepByStep[name] = stepStats

            cls.drawMethodsSummary(nmethods, madiffs, mavgs, mdevs, methods, mrdiffs, msteps, mts, pdf)

            # plot detailed data for each step (and each method)
            cls.drawStepByStep(methods, nSteps, nmethods, pdf, stepByStep)

            # draw methods and step summaries
            cls.drawBoxPlots(mboxes, methods, nmethods, pdf)

            d = pdf.infodict()
            d["Title"] = "Delays measurement"
            d["Author"] = u"Francois Espinet"
            d["Subject"] = "Delay measurement"
            d["Keywords"] = "measurement delays"
            d["ModDate"] = datetime.datetime.today()
        finally:
            pdf.close()
            info("Saved graphics to %s\n" % fn)
        Graph.show()
开发者ID:wicaksana,项目名称:mininet-NetProbes,代码行数:104,代码来源:check.py


注:本文中的graphs.Graph.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。