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


Python Graph.new_plot方法代码示例

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


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

示例1: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self, graph=None):
        if graph is None:
            graph = Graph(
                window_title=self.title,
                container_dict=dict(padding=5,
                                    bgcolor='lightgray'))

        graph.new_plot(
            padding=[50, 5, 5, 50],
            xtitle='DAC (V)',
            ytitle='Intensity (fA)',
            zoom=False,
            show_legend='ul',
            legend_kw=dict(
                font='modern 8',
                line_spacing=1))

        self._series_factory(graph)

        graph.set_series_label('*{}'.format(self.reference_detector))
        self._markup_idx = 1
        spec = self.spectrometer
        for di in self.additional_detectors:
            det = spec.get_detector(di)
            c = det.color
            self._series_factory(graph, line_color=c)
            graph.set_series_label(di)

        if self.show_label:
            graph.add_plot_label('{}@{}'.format(self.reference_isotope,
                                                self.reference_detector), hjustify='center')
        return graph
开发者ID:kenlchen,项目名称:pychron,代码行数:34,代码来源:peak_center.py

示例2: _gc

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _gc(self, p, det, kind):
        g = Graph(container_dict=dict(padding=5), window_width=1000, window_height=800, window_x=40, window_y=20)
        with open(p, "r") as rfile:
            # gather data
            reader = csv.reader(rfile)
            header = reader.next()
            groups = self._parse_data(reader)
            """
                groups= [data,]
                data shape = nrow,ncols
                
            """
            data = groups[0]
            x = data[0]
            y = data[header.index(det)]

        sy = smooth(y, window_len=120)  # , window='flat')

        x = x[::50]
        y = y[::50]
        sy = sy[::50]

        # smooth

        # plot
        g.new_plot(zoom=True, xtitle="Time (s)", ytitle="{} Baseline Intensity (fA)".format(det))
        g.new_series(x, y, type=kind, marker="dot", marker_size=2)
        g.new_series(x, sy, line_width=2)
        #        g.set_x_limits(500, 500 + 60 * 30)
        #        g.edit_traits()
        return g
开发者ID:NMGRL,项目名称:pychron,代码行数:33,代码来源:csv_grapher.py

示例3: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self, **kw):
        g = Graph(
            window_height=250,
            window_width=300,
            container_dict=dict(padding=0))
        g.new_plot(
            bounds=[250, 250],
            resizable='',
            padding=[30, 0, 0, 30])

        cx = self.cx
        cy = self.cy
        cbx = self.xbounds
        cby = self.ybounds
        tr = self.target_radius

        g.set_x_limits(*cbx)
        g.set_y_limits(*cby)

        lp, _plot = g.new_series()
        t = TargetOverlay(component=lp,
                          cx=cx,
                          cy=cy,
                          target_radius=tr)

        lp.overlays.append(t)
        overlap_overlay = OverlapOverlay(component=lp,
                                         visible=self.show_overlap)
        lp.overlays.append(overlap_overlay)

        self._graph_factory_hook(lp)

        g.new_series(type='scatter', marker='circle')
        g.new_series(type='line', color='red')
        return g
开发者ID:OSUPychron,项目名称:pychron,代码行数:37,代码来源:patterns.py

示例4: _graph_default

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
 def _graph_default(self):
     g = Graph(container_dict=dict(padding=5))
     g.new_plot(padding=5)
     g.set_axis_traits(axis='y', visible=False)
     g.set_axis_traits(axis='x', visible=False)
     g.set_grid_traits(grid='x', visible=False)
     g.set_grid_traits(grid='y', visible=False)
     return g
开发者ID:NMGRL,项目名称:pychron,代码行数:10,代码来源:map_view.py

示例5: _test

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _test(self):

        p = '/Users/ross/Pychrondata_demo/data/snapshots/scan6/007.jpg'
        g = Graph()
        g.new_plot()


        for scan_i, z, idxs in [
#                    1,
#                     2,
#                     3, 4, 5,
#                     (6, [20, 30, 40, 50, 60, 70, 80, 90, 100, ],
#                         [2, 3, 4, 5, 6, 7, 8, 9, 10]
#                      ),
                    (6, [10],
                        [1]
                     ),
#                     (6, [100, 90, 80, 70, 60, 50, 40, 30, 20],
#                         [11, 12, 13, 14, 15, 16, 17, 18, 19]
#                     )

                   ]:
            dxs = []
            zs = []
            root = '/Users/ross/Pychrondata_demo/data/snapshots/scan{}'.format(scan_i)
            for  zi, idx in zip(z, idxs):
                pn = os.path.join(root, '{:03n}.jpg'.format(idx))
                d = load_image(pn)

                dx = self._calculate_spacing(d)
                dxs.append(dx)

                zs.append(zi)

            g.new_series(zs, dxs, type='scatter')

            coeffs = polyfit(zs, dxs, 2)
            print 'parabolic intercept {}'.format(coeffs[-1])

            xs = linspace(0, max(zs))
            ys = polyval(coeffs, xs)
            g.new_series(xs, ys)

            fitfunc = lambda p, x: p[0] * exp(p[1] * x) + p[2]
            lr = LeastSquaresRegressor(fitfunc=fitfunc,
                                       initial_guess=[1, 0.1, 0],
                                       xs=zs,
                                       ys=dxs
                                       )
            xs = linspace(0, max(zs))
            ys = lr.predict(xs)
            print 'exponential intercept {}'.format(lr.predict(0))
            g.new_series(xs, ys)

        invoke_in_main_thread(g.edit_traits)
开发者ID:UManPychron,项目名称:pychron,代码行数:57,代码来源:zoom_calibration.py

示例6: _src_graph_default

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _src_graph_default(self):
        g = Graph()
        p = g.new_plot(padding_top=10)
        p.data.set_data("imagedata", zeros((self.height * self.pxpermm, self.width * self.pxpermm)))
        p.img_plot("imagedata", colormap=jet)

        p = g.new_plot(padding_bottom=10)
        p.data.set_data("imagedata", zeros((self.height * self.pxpermm, self.width * self.pxpermm)))
        p.img_plot("imagedata", colormap=jet)

        return g
开发者ID:NMGRL,项目名称:pychron,代码行数:13,代码来源:seek_tester.py

示例7: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self):
        graph = Graph(container_dict=dict(padding=5,
                                          bgcolor='lightgray'))

        graph.new_plot(
                       padding=[50, 5, 5, 50],
#                       title='{}'.format(self.title),
                       xtitle='CDD Operating Voltage (V)',
                       ytitle='Intensity (fA)',
                       )
        graph.new_series(type='scatter',
                         marker='pixel')
        return graph
开发者ID:OSUPychron,项目名称:pychron,代码行数:15,代码来源:cdd_operating_voltage_scan.py

示例8: _execute_power_calibration_check

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _execute_power_calibration_check(self):
        '''
        
        '''
        g = Graph()
        g.new_plot()
        g.new_series()
        g.new_series(x=[0, 100], y=[0, 100], line_style='dash')
        do_later(self._open_graph, graph=g)

        self._stop_signal = TEvent()
        callback = lambda pi, r: None
        self._iterate(self.check_parameters,
                      g, False, callback)
开发者ID:UManPychron,项目名称:pychron,代码行数:16,代码来源:power_calibration_manager.py

示例9: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self):
        g = Graph(window_title='Coincidence Scan',
                  container_dict=dict(padding=5, bgcolor='lightgray')
                  )
        g.new_plot(padding=[50, 5, 5, 50],
                   ytitle='Intensity (fA)',
                   xtitle='Operating Voltage (V)')

        for di in self.spectrometer.detectors:
            g.new_series(
                         name=di.name,
                         color=di.color)

        return g
开发者ID:UManPychron,项目名称:pychron,代码行数:16,代码来源:coincidence_scan.py

示例10: _rebuild_hole_vs_j

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

        p = g.new_plot(xtitle='Hole (Theta)',
                       ytitle='J',
                       padding=[90, 5, 5, 40])

        p.y_axis.tick_label_formatter = lambda x: floatfmt(x, n=2, s=3)

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

        scatter, _ = g.new_series(xs, ys,
                                  yerror=yserr,
                                  type='scatter', marker='circle')

        ebo = ErrorBarOverlay(component=scatter,
                              orientation='y')
        scatter.overlays.append(ebo)
        self._add_inspector(scatter)

        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)

        g.new_series(fxs, fys)
        g.set_x_limits(-3.2, 3.2)
开发者ID:OSUPychron,项目名称:pychron,代码行数:37,代码来源:flux_editor.py

示例11: _pos_graph_default

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
 def _pos_graph_default(self):
     g = Graph()
     p = g.new_plot()
     s, p = g.new_series()
     cp = CurrentPointOverlay(component=s)
     s.overlays.append(cp)
     self._cp = cp
     return g
开发者ID:NMGRL,项目名称:pychron,代码行数:10,代码来源:seek_tester.py

示例12: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self):
        gc = self.graph_cnt
        cnt = '' if not gc else gc
        self.graph_cnt += 1
        name = self.parent.name if self.parent else 'Foo'

        g = Graph(window_title='{} Power Calibration {}'.format(name, cnt),
                               container_dict=dict(padding=5),
                               window_x=500 + gc * 25,
                               window_y=25 + gc * 25
                               )

        g.new_plot(
                   xtitle='Setpoint (%)',
                   ytitle='Measured Power (W)')
        g.new_series()
        return g
开发者ID:UManPychron,项目名称:pychron,代码行数:19,代码来源:power_calibration_manager.py

示例13: passive_focus

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [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

示例14: graph

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def graph(poly, opoly, line):
        from pychron.graph.graph import Graph

        g = Graph()
        g.new_plot()

        for po in (poly, opoly):
            po = np.array(po)
            try:
                xs, ys = po.T
            except ValueError:
                xs, ys, _ = po.T
            xs = np.hstack((xs, xs[0]))
            ys = np.hstack((ys, ys[0]))
            g.new_series(xs, ys)

        #    for i, (p1, p2) in enumerate(lines):
        #        xi, yi = (p1[0], p2[0]), (p1[1], p2[1])
        #        g.new_series(xi, yi, color='black')
        return g
开发者ID:jirhiker,项目名称:pychron,代码行数:22,代码来源:scan_line.py

示例15: _graph_factory

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import new_plot [as 别名]
    def _graph_factory(self, with_image=False):
        g = Graph(window_height=250, window_width=300, container_dict=dict(padding=0))
        g.new_plot(bounds=[250, 250], resizable="", padding=[30, 0, 0, 30])

        cx = self.cx
        cy = self.cy
        cbx = self.xbounds
        cby = self.ybounds
        tr = self.target_radius

        #        if with_image:
        #            px = self.pxpermm  #px is in mm
        #            cbx, cby = self._get_crop_bounds()
        #            #g.set_axis_traits(tick_label_formatter=lambda x: '{:0.2f}'.format((x - w / 2) / px))
        #            #g.set_axis_traits(tick_label_formatter=lambda x: '{:0.2f}'.format((x - h / 2) / px), axis='y')
        #
        #            bx, by = g.plots[0].bounds
        #            g.plots[0].x_axis.mapper = LinearMapper(high_pos=bx,
        #                                                    range=DataRange1D(low_setting=self.xbounds[0],
        #                                                                      high_setting=self.xbounds[1]))
        #            g.plots[0].y_axis.mapper = LinearMapper(high_pos=by,
        #                                                    range=DataRange1D(low_setting=self.ybounds[0],
        #                                                                      high_setting=self.ybounds[1]))
        #            cx += self.image_width / 2
        #            cy += self.image_height / 2
        #            tr *= px

        g.set_x_limits(*cbx)
        g.set_y_limits(*cby)

        lp, _plot = g.new_series()
        t = TargetOverlay(component=lp, cx=cx, cy=cy, target_radius=tr)

        lp.overlays.append(t)
        overlap_overlay = OverlapOverlay(component=lp, visible=self.show_overlap)
        lp.overlays.append(overlap_overlay)

        g.new_series(type="scatter", marker="circle")
        g.new_series(type="line", color="red")
        return g
开发者ID:jirhiker,项目名称:pychron,代码行数:42,代码来源:patterns.py


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