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


Python Graph.rules方法代码示例

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


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

示例1: _graph_grid

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import rules [as 别名]
    def _graph_grid(self, x, y, z, ze, r, reg, refresh):
        self.min_j = min(z)
        self.max_j = max(z)

        g = self.graph
        layout = FigureLayout(fixed='square')
        nrows, ncols = layout.calculate(len(x))

        if not isinstance(g, Graph):
            g = Graph(container_dict={'bgcolor': 'gray',
                                      'kind': 'g',
                                      'shape': (nrows, ncols)})
            self.graph = g

        def get_ip(xi, yi):
            return next(
                (ip for ip in self.monitor_positions if ((ip.x - xi) ** 2 + (ip.y - yi) ** 2) ** 0.5 < 0.01), None)

        opt = self.plotter_options
        monage = opt.monitor_age * 1e6
        lk = opt.lambda_k
        ans = self._analyses[0]
        scale = opt.flux_scalar
        for r in range(nrows):
            for c in range(ncols):
                idx = c + ncols * r

                if refresh:
                    try:
                        yy = z[idx] * scale
                        ye = ze[idx] * scale
                    except IndexError:
                        continue
                    if hasattr(g, 'rules'):
                        l1, l2, l3 = g.rules[idx]
                        l1.value = yy
                        l2.value = yy + ye
                        l3.value = yy - ye
                        g.refresh()

                else:
                    plot = g.new_plot(padding_left=65, padding_right=5, padding_top=30, padding_bottom=5)
                    try:
                        ip = get_ip(x[idx], y[idx])
                    except IndexError:
                        continue

                    add_axes_tools(g, plot)
                    yy = z[idx] * scale
                    ye = ze[idx] * scale
                    plot.title = 'Identifier={} Position={}'.format(ip.identifier, ip.hole_id)

                    plot.x_axis.visible = False
                    if c == 0 and r == nrows // 2:
                        plot.y_axis.title = 'J x{}'.format(scale)

                    if not ip.use:
                        continue

                    # get ip via x,y
                    ais = [a for a in ans if a.irradiation_position == ip.hole_id]
                    n = len(ais)

                    # plot mean value
                    l1 = g.add_horizontal_rule(yy, color='black', line_style='solid', plotid=idx)
                    l2 = g.add_horizontal_rule(yy + ye, plotid=idx)
                    l3 = g.add_horizontal_rule(yy - ye, plotid=idx)
                    if hasattr(g, 'rules'):
                        g.rules.append((l1, l2, l3))
                    else:
                        g.rules = [(l1, l2, l3)]

                    # plot individual analyses
                    fs = [a.model_j(monage, lk) * scale for a in ais]
                    fs = sorted(fs)
                    iys = array([nominal_value(fi) for fi in fs])
                    ies = array([std_dev(fi) for fi in fs])

                    s, _p = g.new_series(linspace(0, n - 1, n), iys, yerror=ies, type='scatter',
                                         marker='circle', marker_size=3)
                    g.set_x_limits(0, n - 1, pad='0.1', plotid=idx)
                    g.set_y_limits(min(iys - ies), max(iys + ies), pad='0.1', plotid=idx)

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

                    add_analysis_inspector(s, ais)
                    s.index.on_trait_change(self._grid_update_graph_metadata(ais), 'metadata_changed')
                    self.suppress_metadata_change = True
                    sel = [i for i, a in enumerate(ais) if a.is_omitted()]
                    s.index.metadata['selections'] = sel
                    self.suppress_metadata_change = False
开发者ID:NMGRL,项目名称:pychron,代码行数:95,代码来源:flux_visualization_editor.py


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