コード例 #1
0
ファイル: flux_editor.py プロジェクト: OSUPychron/pychron
    def _rebuild_contour(self, x, y, z, r, reg):

        g = ContourGraph(container_dict={'kind': 'h'})
        self.graph = g

        p = g.new_plot(xtitle='X', ytitle='Y')

        ito = IrradiationTrayOverlay(component=p,
                                     geometry=self.geometry,
                                     show_labels=self.tool.show_labels)
        self.irradiation_tray_overlay = ito
        p.overlays.append(ito)

        m = self._model_flux(reg, r)
        s, p = g.new_series(z=m,
                            xbounds=(-r, r),
                            ybounds=(-r, r),
                            levels=self.tool.levels,
                            cmap=self.tool.color_map_name,
                            colorbar=True,
                            style='contour')
        g.add_colorbar(s)

        # pts = vstack((x, y)).T
        s = g.new_series(x, y,
                         z=z,
                         style='cmap_scatter',
                         color_mapper=s.color_mapper,
                         marker='circle',
                         marker_size=self.tool.marker_size)
        self.cmap_scatter = s[0]
コード例 #2
0
    def _rebuild_contour(self, x, y, z, r, reg):

        g = ContourGraph(container_dict={'kind': 'h'})
        self.graph = g

        p = g.new_plot(xtitle='X', ytitle='Y')

        ito = IrradiationTrayOverlay(component=p,
                                     geometry=self.geometry,
                                     show_labels=self.tool.show_labels)
        self.irradiation_tray_overlay = ito
        p.overlays.append(ito)

        m = self._model_flux(reg, r)
        s, p = g.new_series(z=m,
                            xbounds=(-r, r),
                            ybounds=(-r, r),
                            levels=self.tool.levels,
                            cmap=self.tool.color_map_name,
                            colorbar=True,
                            style='contour')
        g.add_colorbar(s)

        # pts = vstack((x, y)).T
        s = g.new_series(x,
                         y,
                         z=z,
                         style='cmap_scatter',
                         color_mapper=s.color_mapper,
                         marker='circle',
                         marker_size=self.tool.marker_size)
        self.cmap_scatter = s[0]
コード例 #3
0
    def _rebuild_contour(self, x, y, r, reg):

        g = ContourGraph(container_dict={'kind': 'h'})
        self.graph = g

        p = g.new_plot(xtitle='X', ytitle='Y')

        ito = IrradiationTrayOverlay(component=p, geometry=self.geometry)
        p.overlays.append(ito)

        g.new_series(x, y, type='scatter', marker='circle')

        m = self._model_flux(reg, r)
        s, p = g.new_series(z=m,
                            xbounds=(-r, r),
                            ybounds=(-r, r),
                            levels=self.tool.levels,
                            cmap=self.tool.color_map_name,
                            colorbar=True,
                            style='contour')
        g.add_colorbar(s)
コード例 #4
0
ファイル: flux_editor.py プロジェクト: jirhiker/pychron
    def _rebuild_contour(self, x, y, r, reg):

        g = ContourGraph(container_dict={'kind': 'h'})
        self.graph = g

        p = g.new_plot(xtitle='X', ytitle='Y')

        ito = IrradiationTrayOverlay(component=p,
                                     geometry=self.geometry)
        p.overlays.append(ito)

        g.new_series(x, y, type='scatter',
                     marker='circle')

        m = self._model_flux(reg, r)
        s, p = g.new_series(z=m,
                            xbounds=(-r, r),
                            ybounds=(-r, r),
                            levels=self.tool.levels,
                            cmap=self.tool.color_map_name,
                            colorbar=True,
                            style='contour')
        g.add_colorbar(s)
コード例 #5
0
    def _graph_contour(self, x, y, z, r, reg, refresh):

        g = self.graph
        if not isinstance(g, ContourGraph):
            g = ContourGraph(container_dict={'kind': 'h',
                                             'bgcolor': self.plotter_options.bgcolor})
            self.graph = g
        else:
            g.clear()

        p = g.new_plot(xtitle='X', ytitle='Y')

        ito = IrradiationTrayOverlay(component=p,
                                     geometry=self.geometry,
                                     show_labels=self.show_labels)
        self.irradiation_tray_overlay = ito
        p.overlays.append(ito)

        m = self._model_flux(reg, r)
        s, p = g.new_series(z=m,
                            xbounds=(-r, r),
                            ybounds=(-r, r),
                            levels=self.levels,
                            cmap=self.color_map_name,
                            colorbar=True,
                            style='contour')
        g.add_colorbar(s)

        # pts = vstack((x, y)).T
        s = g.new_series(x, y,
                         z=z,
                         style='cmap_scatter',
                         color_mapper=s.color_mapper,
                         marker='circle',
                         marker_size=self.marker_size)
        self.cmap_scatter = s[0]
コード例 #6
0
ファイル: power_map_processor.py プロジェクト: NMGRL/pychron
    def load_graph(self, reader, window_title=''):
        cg = ContourGraph(
            container_dict=dict(kind='h',
                                #                                               padding=40,
                                #                                               shape=(2, 2),
                                #                                               spacing=(12, 12)
                                )
        )

        z, metadata = self._extract_power_map_data(reader)
        self._data = z
        self._metadata = metadata
        center_plot = cg.new_plot(
            add=False,
            padding=0,
            width=400,
            height=400,
            resizable=''
            #                             aspect_ratio=1
        )
        center_plot.index_axis.visible = False
        center_plot.value_axis.visible = False

        #         from skimage.morphology import label
        #         z = label(z)
        bounds = metadata['bounds']
        # center_plot, names, rd = cg.new_series(z=z, style='contour',
        cg.new_series(z=z, style='contour',
                      xbounds=bounds,
                      ybounds=bounds, )

        bottom_plot = cg.new_plot(
            add=False,
            height=150,
            resizable='h',
            padding=0,
            xtitle='mm',
            ytitle='power')

        right_plot = cg.new_plot(
            add=False,
            width=150,
            resizable='v',
            padding=0,
            xtitle='mm',
            ytitle='power')
        right_plot.x_axis.orientation = 'right'
        #         right_plot.x_axis.title = 'mm'
        right_plot.y_axis.orientation = 'top'
        #         right_plot.y_axis.title = 'power'

        center = center_plot.plots['plot0'][0]
        options = dict(style='cmap_scatter',
                       type='cmap_scatter',
                       marker='circle',
                       color_mapper=center.color_mapper)

        cg.new_series(plotid=1, render_style='connectedpoints')
        cg.new_series(plotid=1, **options)

        right_plot.x_axis.orientation = 'right'
        right_plot.y_axis.orientation = 'top'

        right_plot.x_axis.mapper = center_plot.value_mapper
        right_plot.y_axis.mapper = bottom_plot.value_mapper
        right_plot.x_axis.axis_line_visible = False
        right_plot.y_axis.axis_line_visible = False

        s = cg.new_series(plotid=2, render_style='connectedpoints')[0]
        s.orientation = 'v'
        s = cg.new_series(plotid=2, **options)[0]
        s.orientation = 'v'

        center.index.on_trait_change(cg.metadata_changed,
                                     'metadata_changed')

        cg.show_crosshairs('blue')

        #         z = self._plot_properties(z, metadata, cg)
        #         cg.plots[0].data.set_data('z0', z)

        gridcontainer = container_factory(kind='g',
                                          padding=40,
                                          shape=(2, 2),
                                          spacing=(12, 12))

        gridcontainer.add(center_plot)
        gridcontainer.add(right_plot)
        gridcontainer.add(bottom_plot)

        cb = cg.make_colorbar(center)
        cb.width = 50
        cb.padding_left = 50

        cg.plotcontainer.add(cb)
        cg.plotcontainer.add(gridcontainer)

        self.graph = cg
        return cg
コード例 #7
0
    def load_graph(self, reader, window_title=''):
        cg = ContourGraph(
            container_dict=dict(kind='h',
                                #                                               padding=40,
                                #                                               shape=(2, 2),
                                #                                               spacing=(12, 12)
                                )
        )

        z, metadata = self._extract_power_map_data(reader)
        self._data = z
        self._metadata = metadata
        center_plot = cg.new_plot(
            add=False,
            padding=0,
            width=400,
            height=400,
            resizable=''
            #                             aspect_ratio=1
        )
        center_plot.index_axis.visible = False
        center_plot.value_axis.visible = False

        #         from skimage.morphology import label
        #         z = label(z)
        bounds = metadata['bounds']
        # center_plot, names, rd = cg.new_series(z=z, style='contour',
        cg.new_series(z=z, style='contour',
                      xbounds=bounds,
                      ybounds=bounds, )

        bottom_plot = cg.new_plot(
            add=False,
            height=150,
            resizable='h',
            padding=0,
            xtitle='mm',
            ytitle='power')

        right_plot = cg.new_plot(
            add=False,
            width=150,
            resizable='v',
            padding=0,
            xtitle='mm',
            ytitle='power')
        right_plot.x_axis.orientation = 'right'
        #         right_plot.x_axis.title = 'mm'
        right_plot.y_axis.orientation = 'top'
        #         right_plot.y_axis.title = 'power'

        center = center_plot.plots['plot0'][0]
        options = dict(style='cmap_scatter',
                       type='cmap_scatter',
                       marker='circle',
                       color_mapper=center.color_mapper)

        cg.new_series(plotid=1, render_style='connectedpoints')
        cg.new_series(plotid=1, **options)

        right_plot.x_axis.orientation = 'right'
        right_plot.y_axis.orientation = 'top'

        right_plot.x_axis.mapper = center_plot.value_mapper
        right_plot.y_axis.mapper = bottom_plot.value_mapper
        right_plot.x_axis.axis_line_visible = False
        right_plot.y_axis.axis_line_visible = False

        s = cg.new_series(plotid=2, render_style='connectedpoints')[0]
        s.orientation = 'v'
        s = cg.new_series(plotid=2, **options)[0]
        s.orientation = 'v'

        center.index.on_trait_change(cg.metadata_changed,
                                     'metadata_changed')

        cg.show_crosshairs('blue')

        #         z = self._plot_properties(z, metadata, cg)
        #         cg.plots[0].data.set_data('z0', z)

        gridcontainer = container_factory(kind='g',
                                          padding=40,
                                          shape=(2, 2),
                                          spacing=(12, 12))

        gridcontainer.add(center_plot)
        gridcontainer.add(right_plot)
        gridcontainer.add(bottom_plot)

        cb = cg.make_colorbar(center)
        cb.width = 50
        cb.padding_left = 50

        cg.plotcontainer.add(cb)
        cg.plotcontainer.add(gridcontainer)

        self.graph = cg
        return cg