def draw( self ): """Draw data.""" if len(self.fitResults) == 0: return #if not hasattr( self, 'subplot1' ): # self.subplot1 = self.figure.add_subplot( 211 ) # self.subplot2 = self.figure.add_subplot( 212 ) a, ed = numpy.histogram(self.fitResults['tIndex'], self.Size[0]/2) #self.subplot1.cla() #self.subplot1.plot(ed[:-1], a, color='b' ) #self.subplot1.set_xticks([0, ed.max()]) #self.subplot1.set_yticks([0, a.max()]) #self.subplot2.cla() #self.subplot2.plot(ed[:-1], numpy.cumsum(a), color='g' ) #self.subplot2.set_xticks([0, ed.max()]) #self.subplot2.set_yticks([0, a.sum()]) plot1 = create_line_plot(ed[:,-1], a, color = 'blue', bgcolor="white", add_grid=True, add_axis=True) plot2 = create_line_plot(ed[:,-1], numpy.cumsum(a), color = 'green', bgcolor="white", add_grid=True, add_axis=True) container = HPlotContainer(spacing=20, padding=50, bgcolor="lightgray") container.add(plot1) container.add(plot2) return container
def __init__(self): x, y = np.ogrid[-2*np.pi:2*np.pi:256j, -2*np.pi:2*np.pi:256j] self.img_data = np.sin(x)*y #self.img_mask = np.zeros((len(x), len(y[0]), 4), dtype=np.uint8) #self.img_mask[:, :, 3] = 255 self.img_index = np.array(list((np.broadcast(y, x)))) plotdata = ArrayPlotData(img_data=self.img_data, mask_data=self.img_data) plot1 = Plot(plotdata, padding=10) img_plot = plot1.img_plot("img_data", xbounds=(np.min(x), np.max(x)), ybounds=(np.min(y), np.max(y)))[0] self.lasso = LassoSelection(img_plot) img_plot.tools.append(self.lasso) self.ll = LassoOverlay(img_plot, lasso_selection=self.lasso) img_plot.overlays.append(self.ll) self.lasso.on_trait_change(self._selection_changed, 'selection_completed') plot2 = Plot(plotdata, padding=10) plot2.img_plot("mask_data") self.plot = HPlotContainer(plot1, plot2) self.plot1 = plot1 self.plot2 = plot2 self.plotdata = plotdata
def __init__(self, **traits): super(LassoDemoPlot, self).__init__(**traits) x = np.random.random(N) y = np.random.random(N) x2 = np.array([]) y2 = np.array([]) data = ArrayPlotData(x=x, y=y, x2=x2, y2=y2) plot1 = Plot(data, padding=10) scatter_plot1 = plot1.plot(("x", "y"), type="scatter", marker="circle", color="blue")[0] self.lasso = LassoSelection(scatter_plot1, incremental_select=True, selection_datasource=scatter_plot1.index) self.lasso.on_trait_change(self._selection_changed, 'selection_changed') scatter_plot1.tools.append(self.lasso) scatter_plot1.overlays.append( LassoOverlay(scatter_plot1, lasso_selection=self.lasso)) plot2 = Plot(data, padding=10) plot2.index_range = plot1.index_range plot2.value_range = plot1.value_range plot2.plot(("x2", "y2"), type="scatter", marker="circle", color="red") self.plot = HPlotContainer(plot1, plot2) self.plot2 = plot2 self.data = data
def __init__(self, **traits): super(ContainerExample, self).__init__(**traits) x = np.linspace(-14, 14, 100) y = np.sin(x) * x**3 / 1000 data = ArrayPlotData(x=x, y=y) p1 = Plot(data, padding=30) p1.plot(("x", "y"), type="scatter", color="blue") p1.plot(("x", "y"), type="line", color="blue") p2 = Plot(data, padding=30) p2.plot(("x", "y"), type="line", color="blue") p2.set(bounds=[200, 100], position=[70, 150], bgcolor=(0.9, 0.9, 0.9), unified_draw=True, resizable="") p3 = Plot(data, padding=30) p3.plot(("x", "y"), type="line", color="blue", line_width=2.0) p4 = Plot(data, padding=30) p4.plot(("x", "y"), type="scatter", color="red", marker="circle") c1 = OverlayPlotContainer(p1, p2) c1.fixed_preferred_size = p3.get_preferred_size() c2 = HPlotContainer(c1, p3) c3 = VPlotContainer(p4, c2) self.plot = c3
def __init__(self, **kwargs): super(VariableMeshPannerView, self).__init__(**kwargs) # Create the plot self.add_trait("field", DelegatesTo("vm_plot")) plot = self.vm_plot.plot img_plot = self.vm_plot.img_plot if self.use_tools: plot.tools.append(PanTool(img_plot)) zoom = ZoomTool(component=img_plot, tool_mode="box", always_on=False) plot.overlays.append(zoom) imgtool = ImageInspectorTool(img_plot) img_plot.tools.append(imgtool) overlay = ImageInspectorOverlay(component=img_plot, image_inspector=imgtool, bgcolor="white", border_visible=True) img_plot.overlays.append(overlay) image_value_range = DataRange1D(self.vm_plot.fid) cbar_index_mapper = LinearMapper(range=image_value_range) self.colorbar = ColorBar(index_mapper=cbar_index_mapper, plot=img_plot, padding_right=40, resizable='v', width=30) self.colorbar.tools.append( PanTool(self.colorbar, constrain_direction="y", constrain=True)) zoom_overlay = ZoomTool(self.colorbar, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar.overlays.append(zoom_overlay) # create a range selection for the colorbar range_selection = RangeSelection(component=self.colorbar) self.colorbar.tools.append(range_selection) self.colorbar.overlays.append( RangeSelectionOverlay(component=self.colorbar, border_color="white", alpha=0.8, fill_color="lightgray")) # we also want to the range selection to inform the cmap plot of # the selection, so set that up as well range_selection.listeners.append(img_plot) self.full_container = HPlotContainer(padding=30) self.container = OverlayPlotContainer(padding=0) self.full_container.add(self.colorbar) self.full_container.add(self.container) self.container.add(self.vm_plot.plot)
def __init__(self): super(ContainerExample, self).__init__() x = linspace(-14, 14, 100) y = sin(x) * x**3 plotdata = ArrayPlotData(x=x, y=y) scatter = Plot(plotdata) scatter.plot(("x", "y"), type="scatter", color="blue") line = Plot(plotdata) line.plot(("x", "y"), type="line", color="blue") container = HPlotContainer(scatter, line) self.plot = container
def __init__(self): super(IMUGloveDisplay, self).__init__() x = linspace(-14, 14, 100) y = sin(x) * x**3 plotdata = ArrayPlotData(x=x, y=y) scatter = Plot(plotdata) scatter.plot(("x", "y"), type="scatter", color="blue") line = Plot(plotdata) line.plot(("x", "y"), type="line", color="blue") container = HPlotContainer(scatter, line) #scatter.title = "sin(x) * x^3" #line.title = 'line plot' self.plot = container self.InitGlove()
def _image_plot_container(self): plot = self.render_image() # Create a container to position the plot and the colorbar side-by-side self.container = OverlayPlotContainer() self.container.add(plot) self.img_container = HPlotContainer(use_backbuffer=False) self.img_container.add(self.container) self.img_container.bgcolor = "white" if self.numpeaks_img > 0: scatplot = self.render_scatplot() self.container.add(scatplot) colorbar = self.draw_colorbar() self.img_container.add(colorbar) return self.img_container
def _container_default(self): #image_container = OverlayPlotContainer(padding=20, # use_backbuffer=True, # unified_draw=True) #image_container.add(self.plot) container = HPlotContainer(padding=40, fill_padding=True, bgcolor="white", use_backbuffer=False) inner_cont = VPlotContainer(padding=0, use_backbuffer=True) # container = HPlotContainer(bgcolor = "white", use_backbuffer=False) # inner_cont = VPlotContainer(use_backbuffer=True) inner_cont.add(self.h_plot) inner_cont.add(self.plot) container.add(inner_cont) container.add(self.v_plot) return container
def activate_template(self): """ Converts all contained 'TDerived' objects to real objects using the template traits of the object. This method must be overridden in subclasses. Returns ------- None """ plots = [ p for p in [self.scatter_plot_1.plot, self.scatter_plot_2.plot] if p is not None ] if len(plots) == 2: self.plot = HPlotContainer(spacing=self.spacing) self.plot.add(*plots) elif len(plots) == 1: self.plot = plots[0]
def _create_window(self, title, xtitle, x, ytitle, y, z): ''' - Left-drag pans the plot. - Mousewheel up and down zooms the plot in and out. - Pressing "z" brings up the Zoom Box, and you can click-drag a rectangular region to zoom. If you use a sequence of zoom boxes, pressing alt-left-arrow and alt-right-arrow moves you forwards and backwards through the "zoom history". ''' self._plotname = title # Create window self.data = ArrayPlotData() self.plot = Plot(self.data) self.update_plot(x, y, z) self.plot.title = title self.plot.x_axis.title = xtitle self.plot.y_axis.title = ytitle cmap_renderer = self.plot.plots[self._plotname][0] # Create colorbar self._create_colorbar() self._colorbar.plot = cmap_renderer self._colorbar.padding_top = self.plot.padding_top self._colorbar.padding_bottom = self.plot.padding_bottom # Add some tools self.plot.tools.append(PanTool(self.plot, constrain_key="shift")) self.plot.overlays.append( ZoomTool(component=self.plot, tool_mode="box", always_on=False)) # selection = ColormappedSelectionOverlay(cmap_renderer, fade_alpha=0.35, selection_type="mask") # cmap_renderer.overlays.append(selection) # Create a container to position the plot and the colorbar side-by-side container = HPlotContainer(use_backbuffer=True) container.add(self.plot) container.add(self._colorbar) self.container = container # Return a window containing our plot container return Window(self, -1, component=container)
def _object_index_changed(self): """Handle object index slider changing.""" try: self.current_object = self.current_image[self.object_index - 1] # Display sil = self.current_object.image self._update_img_plot('sil_plot', sil, 'Extracted mask') # .T to get major axis horizontal rotated = self.current_object.aligned_version.image.T self._update_img_plot('rotated_plot', rotated, 'Aligned mask') self.image_plots = HPlotContainer(self.sil_plot, self.rotated_plot, valign="top", bgcolor="transparent") self._update_spline_plot() except IndexError: self.current_object = None
def __init__(self): #读入图像 img = cv.imread("lena_full.jpg") img2 = cv.Mat() cv.cvtColor(img, img2, cv.CV_BGR2GRAY) img = cv.Mat() cv.resize(img2, img, cv.Size(N, N)) self.fimg = fft.fft2(img[:]) # 图像的频域信号 mag_img = np.log10(np.abs(self.fimg)) # 创建计算用图像 filtered_img = np.zeros((N, N), dtype=np.float) self.mask = np.zeros((N, N), dtype=np.float) self.mask_img = cv.asMat(self.mask) # 在self.mask上绘制多边形用的图像 # 创建数据源 self.data = ArrayPlotData(mag_img=fft.fftshift(mag_img), filtered_img=filtered_img, mask_img=self.mask) # 创建三个图像绘制框以及容器 meg_plot, img = self.make_image_plot("mag_img") mask_plot, _ = self.make_image_plot("mask_img") filtered_plot, _ = self.make_image_plot("filtered_img") self.plot = HPlotContainer(meg_plot, mask_plot, filtered_plot) # 创建套索工具 lasso_selection = LassoSelection(component=img) lasso_overlay = LassoOverlay(lasso_selection=lasso_selection, component=img, selection_alpha=0.3) img.tools.append(lasso_selection) img.overlays.append(lasso_overlay) self.lasso_selection = lasso_selection # 监听套索工具的事件、开启时钟事件 lasso_selection.on_trait_change(self.lasso_updated, "disjoint_selections") self.timer = Timer(50, self.on_timer)
def _create_plot_component(self): # Create a plot data object and give it this data self.pd = ArrayPlotData() self.pd.set_data("imagedata", self.data[self.data_name]) # Create the plot self.tplot = Plot(self.pd, default_origin="top left") self.tplot.x_axis.orientation = "top" self.tplot.img_plot( "imagedata", name="my_plot", #xbounds=(0,10), #ybounds=(0,10), colormap=jet) # Tweak some of the plot properties self.tplot.title = "Matrix" self.tplot.padding = 50 # Right now, some of the tools are a little invasive, and we need the # actual CMapImage object to give to them self.my_plot = self.tplot.plots["my_plot"][0] # Attach some tools to the plot self.tplot.tools.append(PanTool(self.tplot)) zoom = ZoomTool(component=self.tplot, tool_mode="box", always_on=False) self.tplot.overlays.append(zoom) # my custom tool to get the connection information self.custtool = CustomTool(self.tplot) self.tplot.tools.append(self.custtool) # Create the colorbar, handing in the appropriate range and colormap colormap = self.my_plot.color_mapper self.colorbar = ColorBar( index_mapper=LinearMapper(range=colormap.range), color_mapper=colormap, plot=self.my_plot, orientation='v', resizable='v', width=30, padding=20) self.colorbar.padding_top = self.tplot.padding_top self.colorbar.padding_bottom = self.tplot.padding_bottom # create a range selection for the colorbar self.range_selection = RangeSelection(component=self.colorbar) self.colorbar.tools.append(self.range_selection) self.colorbar.overlays.append( RangeSelectionOverlay(component=self.colorbar, border_color="white", alpha=0.8, fill_color="lightgray")) # we also want to the range selection to inform the cmap plot of # the selection, so set that up as well self.range_selection.listeners.append(self.my_plot) # Create a container to position the plot and the colorbar side-by-side container = HPlotContainer(use_backbuffer=True) container.add(self.tplot) container.add(self.colorbar) container.bgcolor = "white" return container
def get_plot(self): pixel_sizes = self.data_source.voxel_sizes shape = self.data.shape m = min(pixel_sizes) s = [int(d * sz / m) for d, sz in zip(shape, pixel_sizes)] if 1: # else physical aspect ratio is enabled ss = max(s) / 4 s = [max(s, ss) for s in s] plot_sizes = dict(xy=(s[2], s[1]), xz=(s[2], s[0]), zy=(s[0], s[1]), zz=(s[0], s[0])) plots = GridContainer(shape=(2, 2), spacing=(3, 3), padding=50, aspect_ratio=1) pxy = Plot( self.plotdata, padding=1, fixed_preferred_size=plot_sizes['xy'], x_axis=PlotAxis(orientation='top'), ) pxz = Plot( self.plotdata, padding=1, fixed_preferred_size=plot_sizes['xz'], ) pzy = Plot( self.plotdata, padding=1, fixed_preferred_size=plot_sizes['zy'], #orientation = 'v', # cannot use 'v' because of img_plot assumes row-major ordering x_axis=PlotAxis(orientation='top'), y_axis=PlotAxis(orientation='right'), ) pzz = Plot(self.plotdata, padding=1, fixed_preferred_size=plot_sizes['zz']) plots.add(pxy, pzy, pxz, pzz) self.plots = dict( xy=pxy.img_plot('xy', colormap=bone)[0], xz=pxz.img_plot('xz', colormap=bone)[0], zy=pzy.img_plot('zy', colormap=bone)[0], zz=pzz.img_plot('zz')[0], xyp=pxy.plot(('z_x', 'z_y'), type='scatter', color='orange', marker='circle', marker_size=3, selection_marker_size=3, selection_marker='circle')[0], xzp=pxz.plot(('y_x', 'y_z'), type='scatter', color='orange', marker='circle', marker_size=3, selection_marker_size=3, selection_marker='circle')[0], zyp=pzy.plot(('x_z', 'x_y'), type='scatter', color='orange', marker='circle', marker_size=3, selection_marker_size=3, selection_marker='circle')[0], ) for p in ['xy', 'xz', 'zy']: self.plots[p].overlays.append(ZoomTool(self.plots[p])) self.plots[p].tools.append( PanTool(self.plots[p], drag_button='right')) imgtool = ImageInspectorTool(self.plots[p]) self.plots[p].tools.append(imgtool) overlay = ImageInspectorOverlay(component=self.plots[p], bgcolor='white', image_inspector=imgtool) self.plots['zz'].overlays.append(overlay) self.plots[p + 'p'].tools.append( ScatterInspector(self.plots[p + 'p'], selection_mode='toggle')) self.plots['xyp'].index.on_trait_change(self._xyp_metadata_handler, 'metadata_changed') self.plots['xzp'].index.on_trait_change(self._xzp_metadata_handler, 'metadata_changed') self.plots['zyp'].index.on_trait_change(self._zyp_metadata_handler, 'metadata_changed') plot = HPlotContainer() # todo: add colormaps plot.add(plots) return plot
def __init__(self,xdata=None,ydata=None,weights=None,model=None, include_models=None,exclude_models=None,fittype=None,**traits): """ :param xdata: the first dimension of the data to be fit :type xdata: array-like :param ydata: the second dimension of the data to be fit :type ydata: array-like :param weights: The weights to apply to the data. Statistically interpreted as inverse errors (*not* inverse variance). May be any of the following forms: * None for equal weights * an array of points that must match `ydata` * a 2-sequence of arrays (xierr,yierr) such that xierr matches the `xdata` and yierr matches `ydata` * a function called as f(params) that returns an array of weights that match one of the above two conditions :param model: the initial model to use to fit this data :type model: None, string, or :class:`pymodelfit.core.FunctionModel1D` instance. :param include_models: With `exclude_models`, specifies which models should be available in the "new model" dialog (see `models.list_models` for syntax). :param exclude_models: With `include_models`, specifies which models should be available in the "new model" dialog (see `models.list_models` for syntax). :param fittype: The fitting technique for the initial fit (see :class:`pymodelfit.core.FunctionModel`). :type fittype: string kwargs are passed in as any additional traits to apply to the application. """ self.modelpanel = View(Label('empty'),kind='subpanel',title='model editor') self.tmodel = TraitedModel(model) if model is not None and fittype is not None: self.tmodel.model.fittype = fittype if xdata is None or ydata is None: if not hasattr(self.tmodel.model,'data') or self.tmodel.model.data is None: raise ValueError('data not provided and no data in model') if xdata is None: xdata = self.tmodel.model.data[0] if ydata is None: ydata = self.tmodel.model.data[1] if weights is None: weights = self.tmodel.model.data[2] self.on_trait_change(self._paramsChanged,'tmodel.paramchange') self.modelselector = NewModelSelector(include_models,exclude_models) self.data = [xdata,ydata] if weights is None: self.weights = np.ones_like(xdata) self.weighttype = 'equal' else: self.weights = np.array(weights,copy=True) self.savews = True weights1d = self.weights while len(weights1d.shape)>1: weights1d = np.sum(weights1d**2,axis=0) pd = ArrayPlotData(xdata=self.data[0],ydata=self.data[1],weights=weights1d) self.plot = plot = Plot(pd,resizable='hv') self.scatter = plot.plot(('xdata','ydata','weights'),name='data', color_mapper=_cmapblack if self.weights0rem else _cmap, type='cmap_scatter', marker='circle')[0] self.errorplots = None if not isinstance(model,FunctionModel1D): self.fitmodel = True self.updatemodelplot = False #force plot update - generates xmod and ymod plot.plot(('xmod','ymod'),name='model',type='line',line_style='dash',color='black',line_width=2) del plot.x_mapper.range.sources[-1] #remove the line plot from the x_mapper source so only the data is tied to the scaling self.on_trait_change(self._rangeChanged,'plot.index_mapper.range.updated') self.pantool = PanTool(plot,drag_button='left') plot.tools.append(self.pantool) self.zoomtool = ZoomTool(plot) self.zoomtool.prev_state_key = KeySpec('a') self.zoomtool.next_state_key = KeySpec('s') plot.overlays.append(self.zoomtool) self.scattertool = None self.scatter.overlays.append(ScatterInspectorOverlay(self.scatter, hover_color = "black", selection_color="black", selection_outline_color="red", selection_line_width=2)) self.colorbar = colorbar = ColorBar(index_mapper=LinearMapper(range=plot.color_mapper.range), color_mapper=plot.color_mapper.range, plot=plot, orientation='v', resizable='v', width = 30, padding = 5) colorbar.padding_top = plot.padding_top colorbar.padding_bottom = plot.padding_bottom colorbar._axis.title = 'Weights' self.plotcontainer = container = HPlotContainer(use_backbuffer=True) container.add(plot) container.add(colorbar) super(FitGui,self).__init__(**traits) self.on_trait_change(self._scale_change,'plot.value_scale,plot.index_scale') if weights is not None and len(weights)==2: self.weightsChanged() #update error bars
def create_plot_component(self): color_range_max_value = 10 # gripper right cos field x_axis = numpy.array( range(self.arch._gripper_right_cos_field. get_output_dimension_sizes()[0])) self._gripper_right_cos_field_plotdata = ArrayPlotData( x=x_axis, y=self.arch._gripper_right_cos_field.get_activation()) self._gripper_right_cos_field_plot = Plot( self._gripper_right_cos_field_plotdata) self._gripper_right_cos_field_plot.title = 'gripper right cos' self._gripper_right_cos_field_plot.plot(("x", "y"), name='gripper_right_cos', type="line", color="blue") range_self = self._gripper_right_cos_field_plot.plots[ 'gripper_right_cos'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # gripper left cos field x_axis = numpy.array( range( self.arch._gripper_left_cos_field.get_output_dimension_sizes() [0])) self._gripper_left_cos_field_plotdata = ArrayPlotData( x=x_axis, y=self.arch._gripper_left_cos_field.get_activation()) self._gripper_left_cos_field_plot = Plot( self._gripper_left_cos_field_plotdata) self._gripper_left_cos_field_plot.title = 'gripper left cos' self._gripper_left_cos_field_plot.plot(("x", "y"), name='gripper_left_cos', type="line", color="blue") range_self = self._gripper_left_cos_field_plot.plots[ 'gripper_left_cos'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # find red color intention field x_axis = numpy.array( range(self.arch._find_color.get_intention_field(). get_output_dimension_sizes()[0])) self._find_color_intention_field_plotdata = ArrayPlotData( x=x_axis, y=self.arch._find_color.get_intention_field().get_activation()) self._find_color_intention_field_plot = Plot( self._find_color_intention_field_plotdata) self._find_color_intention_field_plot.title = 'find color int' self._find_color_intention_field_plot.plot(("x", "y"), name='find_color_int', type="line", color="blue") range_self = self._find_color_intention_field_plot.plots[ 'find_color_int'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # find green color intention field x_axis = numpy.array( range(self.arch._find_color_ee.get_intention_field(). get_output_dimension_sizes()[0])) self._find_color_ee_intention_field_plotdata = ArrayPlotData( x=x_axis, y=self.arch._find_color_ee.get_intention_field().get_activation()) self._find_color_ee_intention_field_plot = Plot( self._find_color_ee_intention_field_plotdata) self._find_color_ee_intention_field_plot.title = 'find color ee int' self._find_color_ee_intention_field_plot.plot(("x", "y"), name='find_color_ee_int', type="line", color="blue") range_self = self._find_color_ee_intention_field_plot.plots[ 'find_color_ee_int'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # camera self._camera_field_plotdata = ArrayPlotData() self._camera_field_plotdata.set_data( 'imagedata', self.arch._camera_field.get_activation().max(2).transpose()) self._camera_field_plot = Plot(self._camera_field_plotdata) self._camera_field_plot.title = 'camera' self._camera_field_plot.img_plot( 'imagedata', name='camera_field', xbounds=(0, self.arch._camera_field_sizes[0] - 1), ybounds=(0, self.arch._camera_field_sizes[1] - 1), colormap=jet, ) range_self = self._camera_field_plot.plots['camera_field'][ 0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # color space red self._color_space_field_plotdata = ArrayPlotData() self._color_space_field_plotdata.set_data( 'imagedata', self.arch._color_space_field.get_activation().max(1).transpose()) self._color_space_field_plot = Plot(self._color_space_field_plotdata) self._color_space_field_plot.title = 'color space' self._color_space_field_plot.img_plot( 'imagedata', name='color_space_field', xbounds=(0, self.arch._color_space_field_sizes[0] - 1), ybounds=(0, self.arch._color_space_field_sizes[2] - 1), colormap=jet, ) range_self = self._color_space_field_plot.plots['color_space_field'][ 0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # color space green self._color_space_ee_field_plotdata = ArrayPlotData() self._color_space_ee_field_plotdata.set_data( 'imagedata', self.arch._color_space_ee_field.get_activation().max( 2).transpose()) self._color_space_ee_field_plot = Plot( self._color_space_ee_field_plotdata) self._color_space_ee_field_plot.title = 'color space ee' self._color_space_ee_field_plot.img_plot( 'imagedata', name='color_space_ee_field', xbounds=(0, self.arch._color_space_ee_field_sizes[0] - 1), ybounds=(0, self.arch._color_space_ee_field_sizes[1] - 1), colormap=jet, ) range_self = self._color_space_ee_field_plot.plots[ 'color_space_ee_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # spatial target self._spatial_target_field_plotdata = ArrayPlotData() self._spatial_target_field_plotdata.set_data( 'imagedata', self.arch._spatial_target_field.get_activation().transpose()) self._spatial_target_field_plot = Plot( self._spatial_target_field_plotdata) self._spatial_target_field_plot.title = 'spatial target' self._spatial_target_field_plot.img_plot( 'imagedata', name='spatial_target_field', xbounds=(0, self.arch._spatial_target_field_sizes[0] - 1), ybounds=(0, self.arch._spatial_target_field_sizes[1] - 1), colormap=jet, ) range_self = self._spatial_target_field_plot.plots[ 'spatial_target_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # move head intention self._move_head_intention_field_plotdata = ArrayPlotData() self._move_head_intention_field_plotdata.set_data( 'imagedata', self.arch._move_head.get_intention_field().get_activation(). transpose()) self._move_head_intention_field_plot = Plot( self._move_head_intention_field_plotdata) self._move_head_intention_field_plot.title = 'move head int' self._move_head_intention_field_plot.img_plot( 'imagedata', name='move_head_intention_field', xbounds=(0, self.arch._move_head_field_sizes[0] - 1), ybounds=(0, self.arch._move_head_field_sizes[1] - 1), colormap=jet, ) range_self = self._move_head_intention_field_plot.plots[ 'move_head_intention_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # move head cos self._move_head_cos_field_plotdata = ArrayPlotData() self._move_head_cos_field_plotdata.set_data( 'imagedata', self.arch._move_head.get_cos_field().get_activation().transpose()) self._move_head_cos_field_plot = Plot( self._move_head_cos_field_plotdata) self._move_head_cos_field_plot.title = 'move head cos' self._move_head_cos_field_plot.img_plot( 'imagedata', name='move_head_cos_field', xbounds=(0, self.arch._move_head_field_sizes[0] - 1), ybounds=(0, self.arch._move_head_field_sizes[1] - 1), colormap=jet, ) range_self = self._move_head_cos_field_plot.plots[ 'move_head_cos_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # move right arm intention self._move_right_arm_intention_field_plotdata = ArrayPlotData() self._move_right_arm_intention_field_plotdata.set_data( 'imagedata', self.arch._move_right_arm_intention_field.get_activation(). transpose()) self._move_right_arm_intention_field_plot = Plot( self._move_right_arm_intention_field_plotdata) self._move_right_arm_intention_field_plot.title = 'move right arm int' self._move_right_arm_intention_field_plot.img_plot( 'imagedata', name='move_right_arm_intention_field', xbounds=(0, self.arch._move_arm_field_sizes[0] - 1), ybounds=(0, self.arch._move_arm_field_sizes[1] - 1), colormap=jet, ) range_self = self._move_right_arm_intention_field_plot.plots[ 'move_right_arm_intention_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # move right arm cos self._move_right_arm_cos_field_plotdata = ArrayPlotData() self._move_right_arm_cos_field_plotdata.set_data( 'imagedata', self.arch._move_arm_cos_field.get_activation().transpose()) self._move_right_arm_cos_field_plot = Plot( self._move_right_arm_cos_field_plotdata) self._move_right_arm_cos_field_plot.title = 'move right arm cos' self._move_right_arm_cos_field_plot.img_plot( 'imagedata', name='move_right_arm_cos_field', xbounds=(0, self.arch._move_arm_field_sizes[0] - 1), ybounds=(0, self.arch._move_arm_field_sizes[1] - 1), colormap=jet, ) range_self = self._move_right_arm_cos_field_plot.plots[ 'move_right_arm_cos_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # visual servoing right intention self._visual_servoing_right_intention_field_plotdata = ArrayPlotData() self._visual_servoing_right_intention_field_plotdata.set_data( 'imagedata', self.arch._visual_servoing_right.get_intention_field(). get_activation().transpose()) self._visual_servoing_right_intention_field_plot = Plot( self._visual_servoing_right_intention_field_plotdata) self._visual_servoing_right_intention_field_plot.title = 'visual servoing right int' self._visual_servoing_right_intention_field_plot.img_plot( 'imagedata', name='visual_servoing_right_intention_field', xbounds=(0, self.arch._visual_servoing_field_sizes[0] - 1), ybounds=(0, self.arch._visual_servoing_field_sizes[1] - 1), colormap=jet, ) range_self = self._visual_servoing_right_intention_field_plot.plots[ 'visual_servoing_right_intention_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value # visual servoing right cos self._visual_servoing_right_cos_field_plotdata = ArrayPlotData() self._visual_servoing_right_cos_field_plotdata.set_data( 'imagedata', self.arch._visual_servoing_right.get_cos_field().get_activation(). transpose()) self._visual_servoing_right_cos_field_plot = Plot( self._visual_servoing_right_cos_field_plotdata) self._visual_servoing_right_cos_field_plot.title = 'visual servoing right cos' self._visual_servoing_right_cos_field_plot.img_plot( 'imagedata', name='visual_servoing_right_cos_field', xbounds=(0, self.arch._visual_servoing_field_sizes[0] - 1), ybounds=(0, self.arch._visual_servoing_field_sizes[1] - 1), colormap=jet, ) range_self = self._visual_servoing_right_cos_field_plot.plots[ 'visual_servoing_right_cos_field'][0].value_mapper.range range_self.high = color_range_max_value range_self.low = -color_range_max_value self._container = VPlotContainer() self._hcontainer_top = HPlotContainer() self._hcontainer_bottom = HPlotContainer() self._hcontainer_bottom.add(self._camera_field_plot) self._hcontainer_bottom.add(self._color_space_field_plot) self._hcontainer_bottom.add(self._spatial_target_field_plot) self._hcontainer_bottom.add(self._move_head_intention_field_plot) self._hcontainer_bottom.add(self._move_right_arm_intention_field_plot) # self._hcontainer_bottom.add(self._find_color_intention_field_plot) # self._hcontainer_bottom.add(self._gripper_right_intention_field_plot) self._hcontainer_top.add(self._color_space_ee_field_plot) self._hcontainer_top.add( self._visual_servoing_right_intention_field_plot) self._hcontainer_top.add(self._visual_servoing_right_cos_field_plot) self._hcontainer_top.add(self._move_head_cos_field_plot) self._hcontainer_top.add(self._move_right_arm_cos_field_plot) # self._hcontainer_top.add(self._gripper_right_cos_field_plot) self._container.add(self._hcontainer_bottom) self._container.add(self._hcontainer_top)