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


Python Graph.close_ui方法代码示例

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


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

示例1: _execute_seek

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import close_ui [as 别名]
    def _execute_seek(self, controller, pattern):
        from pychron.core.ui.gui import invoke_in_main_thread
        from pychron.graph.graph import Graph

        duration = pattern.duration
        g = Graph()
        g.edit_traits()
        g.new_plot()
        s, p = g.new_series()

        g.new_plot()
        g.new_series(type='line')

        cp = CurrentPointOverlay(component=s)
        s.overlays.append(cp)
        w = 2
        g.set_x_limits(-w, w)
        g.set_y_limits(-w, w)
        om = 60
        g.set_x_limits(max_=om, plotid=1)

        lm = self.laser_manager
        sm = lm.stage_manager

        st = time.time()

        def update_graph(zs, zz, xx, yy):
            cp.point = (xx, yy)
            g.add_datum((xx, yy), plotid=0)
            t = time.time() - st
            g.add_datum((t, zz),
                        update_y_limits=True,
                        plotid=1)

            g.add_datum((t,) * len(zs), zs,
                        update_y_limits=True,
                        plotid=1, series=1)
            g.set_x_limits(max_=max(om, t + 10), plotid=1)
            g.redraw()

        pp = os.path.join(paths.data_dir, 'seek_pattern.txt')
        with open(pp, 'w') as wfile:
            cx, cy = pattern.cx, pattern.cy
            wfile.write('{},{}\n'.format(cx, cy))
            wfile.write('#z,     x,     y,     n\n')
            gen = pattern.point_generator()
            for x, y in gen:
                if not self._alive:
                    break

                with PeriodCTX(1):
                    # x, y = gen.next()
                    # x, y = pattern.next_point
                    controller.linear_move(cx + x, cy + y, block=False, velocity=pattern.velocity)

                    mt = time.time()
                    zs = []
                    while sm.moving():
                        _, _, v = sm.get_brightness()
                        zs.append(v)

                    while 1:
                        if time.time() - mt > duration:
                            break
                        _, _, v = sm.get_brightness()
                        zs.append(v)

                    if zs:
                        n = len(zs)
                        z = sum(zs) / float(n)
                        self.debug('XY:({},{}) Z:{}, N:{}'.format(x, y, z, n))
                        pattern.set_point(z, x, y)

                        wfile.write('{:0.5f},{:0.3f},{:0.3f},{}\n'.format(z, x, y, n))

                        invoke_in_main_thread(update_graph, zs, z, x, y)
        g.close_ui()
开发者ID:OSUPychron,项目名称:pychron,代码行数:79,代码来源:pattern_executor.py


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