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


Python Graph.clear方法代码示例

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


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

示例1: passive_focus

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import clear [as 别名]
    def passive_focus(self, block=False, **kw):

        self._evt_autofocusing = TEvent()
        self._evt_autofocusing.clear()
#        manager = self.laser_manager
        oper = self.parameters.operator
        self.info('passive focus. operator = {}'.format(oper))

        g = self.graph
        if not g:
            g = Graph(plotcontainer_dict=dict(padding=10),
                      window_x=0.70,
                      window_y=20,
                      window_width=325,
                      window_height=325,
                      window_title='Autofocus'
                      )
            self.graph = g

        g.clear()

        g.new_plot(padding=[40, 10, 10, 40],
                   xtitle='Z (mm)',
                   ytitle='Focus Measure ({})'.format(oper)
                   )
        g.new_series()
        g.new_series()

        invoke_in_main_thread(self._open_graph)

        target = self._passive_focus
        self._passive_focus_thread = Thread(name='autofocus', target=target,
                                            args=(self._evt_autofocusing,

                                                  ),
                                            kwargs=kw
                                            )
        self._passive_focus_thread.start()
        if block:
#             while 1:
#                 if not self._passive_focus_thread.isRunning():
#                     break
#                 time.sleep(0.25)
            self._passive_focus_thread.join()
开发者ID:NMGRL,项目名称:pychron,代码行数:46,代码来源:autofocus_manager.py

示例2: _graph_hole_vs_j

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import clear [as 别名]
    def _graph_hole_vs_j(self, x, y, r, reg, refresh):

        sel = [i for i, (a, x, y, e) in enumerate(zip(*self._analyses)) if a.is_omitted()]
        g = self.graph
        if not isinstance(g, Graph):
            g = Graph(container_dict={'bgcolor': self.plotter_options.bgcolor})
            self.graph = g

        po = self.plotter_options
        is_matching = po.model_kind == 'Matching'

        ys = reg.ys
        xs = arctan2(x, y)

        yserr = reg.yserr
        lyy = ys - yserr
        uyy = ys + yserr
        a = max((abs(min(xs)), abs(max(xs))))
        fxs = linspace(-a, a)

        a = r * sin(fxs)
        b = r * cos(fxs)
        pts = vstack((a, b)).T
        fys = reg.predict(pts)

        if not is_matching:
            try:
                l, u = reg.calculate_error_envelope(fxs, rmodel=fys)
            except BaseException:
                l, u = reg.calculate_error_envelope(pts, rmodel=fys)

        if not refresh:
            g.clear()
            p = g.new_plot(xtitle='Hole (Theta)',
                           ytitle='J',
                           # padding=[90, 5, 5, 40],
                           padding=po.paddings())
            p.bgcolor = po.plot_bgcolor

            add_axes_tools(g, p)

            def label_fmt(xx):
                return floatfmt(xx, n=2, s=4, use_scientific=True)

            p.y_axis.tick_label_formatter = label_fmt

            # plot fit line
            # plot0 == line
            if not is_matching:
                line, _p = g.new_series(fxs, fys)

                ee = ErrorEnvelopeOverlay(component=line,
                                          xs=fxs, lower=l, upper=u)
                line.error_envelope = ee
                line.underlays.append(ee)

            # plot the individual analyses
            # plot1 == scatter
            iscatter, iys = self._graph_individual_analyses()

            # plot means
            # plot2 == scatter
            scatter, _ = g.new_series(xs, ys,
                                      yerror=yserr,
                                      type='scatter',
                                      marker_size=4, marker='diamond')

            ebo = ErrorBarOverlay(component=scatter,
                                  orientation='y')
            scatter.underlays.append(ebo)
            scatter.error_bars = ebo

            add_inspector(scatter, self._additional_info)

            ymi = min(lyy.min(), min(iys))
            yma = max(uyy.max(), max(iys))
            g.set_x_limits(-3.5, 3.5)
            g.set_y_limits(ymi, yma, pad='0.1')

            # set metadata last because it will trigger a refresh
            self.suppress_metadata_change = True
            iscatter.index.metadata['selections'] = sel
            self.suppress_metadata_change = False

            # add a legend
            if not is_matching:
                labels = [('plot1', 'Individual'),
                          ('plot2', 'Mean'),
                          ('plot0', 'Fit'),
                          ]
            else:
                labels = [('plot0', 'Individual'),
                          ('plot1', 'Mean')]

            legend = ExplicitLegend(plots=self.graph.plots[0].plots,
                                    labels=labels)
            p.overlays.append(legend)

        else:
            plot = g.plots[0]
#.........这里部分代码省略.........
开发者ID:NMGRL,项目名称:pychron,代码行数:103,代码来源:flux_visualization_editor.py


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