def _add_line_plots(self, plot): """Adds curve line plots to the ChacoPlot""" line_plots = [] for plot_config in self.line_plot_configs: line_plot = ChacoPlot(self._plot_data) # Customize text line_plot.trait_set(title=plot_config.title, padding=75, line_width=1) line_plot.x_axis.title = plot_config.x_label line_plot.y_axis.title = plot_config.y_label # Add pan and zoom tools line_plot.tools.append(PanTool(line_plot)) line_plot.overlays.append(ZoomTool(line_plot)) for name, kwargs in plot_config.line_config.items(): line = line_plot.plot((f"x_line_{name}", f"y_line_{name}"), type="line", **kwargs)[0] self._sub_axes[f'{name}_line_plot'] = line line_plots.append(line_plot) container = GridPlotContainer(*line_plots, shape=self._grid_shape, spacing=(0, 0), valign='top', bgcolor="none") self._component = HPlotContainer(plot, container, bgcolor="none") self._line_plots = line_plots
def _plot_default(self): # Create a GridContainer to hold all of our plots: 2 rows, 3 columns container = GridPlotContainer(shape=(2, 3), spacing=(10, 5), valign='top', bgcolor='lightgray') pd = ArrayPlotData(data=np.arange(36).reshape(6, 6)) plots = [] renderers = [] for i in range(6): plot = Plot(pd) r, = plot.img_plot("data") plots.append(plot) renderers.append(r) add_tools(r) # Add to the grid container container.add(plot) share_attr(plots, "range2d") share_attr([rend.index_mapper for rend in renderers], "range") return container
def _plot_default(self): # Create a GridContainer to hold all of our plots: 2 rows, 3 columns container = GridPlotContainer(shape=(2,3), spacing=(10,5), valign='top', bgcolor='lightgray') # Create x data x = linspace(-5, 15.0, 100) pd = ArrayPlotData(index = x) # Plot some Bessel functions and add the plots to our container for i in range(6): data_name = 'y{}'.format(i) pd.set_data(data_name, jn(i,x)) plot = Plot(pd) plot.plot(('index', data_name), color=COLOR_PALETTE[i], line_width=3.0) # Set each plot's aspect based on its position in the grid plot.set(height=((i % 3) + 1)*50, resizable='h') # Add to the grid container container.add(plot) return container
def _create_window(self): # Create the model #try: # self.model = model = BrainModel() # cmap = bone #except SystemExit: # sys.exit() #except: # print "Unable to load BrainModel, using generated data cube." self.model = model = Model() cmap = jet self._update_model(cmap) datacube = self.colorcube # Create the plot self.plotdata = ArrayPlotData() self._update_images() # Center Plot centerplot = Plot(self.plotdata, padding=0) imgplot = centerplot.img_plot("xy", xbounds=(model.xs[0], model.xs[-1]), ybounds=(model.ys[0], model.ys[-1]), colormap=cmap)[0] self._add_plot_tools(imgplot, "xy") self.center = imgplot # Right Plot rightplot = Plot(self.plotdata, width=150, resizable="v", padding=0) rightplot.value_range = centerplot.value_range imgplot = rightplot.img_plot("yz", xbounds=(model.zs[0], model.zs[-1]), ybounds=(model.ys[0], model.ys[-1]), colormap=cmap)[0] self._add_plot_tools(imgplot, "yz") self.right = imgplot # Bottom Plot bottomplot = Plot(self.plotdata, height=150, resizable="h", padding=0) bottomplot.index_range = centerplot.index_range imgplot = bottomplot.img_plot("xz", xbounds=(model.xs[0], model.xs[-1]), ybounds=(model.zs[0], model.zs[-1]), colormap=cmap)[0] self._add_plot_tools(imgplot, "xz") self.bottom = imgplot # Create Container and add all Plots container = GridPlotContainer(padding=20, fill_padding=True, bgcolor="white", use_backbuffer=True, shape=(2,2), spacing=(12,12)) container.add(centerplot) container.add(rightplot) container.add(bottomplot) self.container = container return Window(self, -1, component=container)
def _create_window(self): self.model = model = Model() self.cmap = jet #self._update_model(self.cmap) # Create the plot self.plotdata = ArrayPlotData() self._update_images() # Center Plot centerplot = Plot(self.plotdata, padding=0) imgplot = centerplot.img_plot("xy", xbounds=(model.min_x, model.max_x), ybounds=(model.min_y, model.max_y), colormap=self.cmap)[0] self._add_plot_tools(imgplot, "xy") self.center = imgplot # Right Plot rightplot = Plot(self.plotdata, width=150, resizable="v", padding=0) rightplot.value_range = centerplot.value_range imgplot = rightplot.img_plot("yz", xbounds=(model.min_z, model.max_z), ybounds=(model.min_y, model.max_y), colormap=self.cmap)[0] self._add_plot_tools(imgplot, "yz") self.right = imgplot # Bottom Plot. Seismic plot axis1 (depth) down into earth # i.e. z is depth, to altitude. bottomplot = Plot(self.plotdata, height=150, resizable="h", padding=0, origin="top left") bottomplot.index_range = centerplot.index_range imgplot = bottomplot.img_plot("xz", xbounds=(model.min_x, model.max_x), ybounds=(model.min_z, model.max_z), colormap=self.cmap)[0] self._add_plot_tools(imgplot, "xz") self.bottom = imgplot # Create Container and add all Plots container = GridPlotContainer(padding=20, fill_padding=True, bgcolor="white", use_backbuffer=True, shape=(2, 2), spacing=(20, 20)) container.add(centerplot) container.add(rightplot) container.add(bottomplot) self.container = container return Window(self, -1, component=container)
def grid_plot_component(self): container = GridPlotContainer(padding=50, fill_padding=True, shape=(1, len(self.plot_constructors)), spacing=(20, 20)) for plot_constructor in self.plot_constructors: plot = plot_constructor() container.add(plot) return container
def __init__(self, ptv=None, exp1=None): super(DemoGUI, self).__init__() self.exp1 = exp1 self.ptv1 = ptv self.n_camera = self.exp1.active_params.m_params.Num_Cam print self.n_camera self.orig_image = [] self.hp_image = [] if self.n_camera == 1: shape = (1, 1) else: shape = (2, int(self.n_camera / 2)) self.container = GridPlotContainer(shape=shape) for i in range(self.n_camera): self.camera_list.append(DemoWindow()) self.container.add(self.camera_list[i]._plot) self.orig_image.append(np.array([], dtype=np.ubyte)) self.hp_image.append(np.array([]))
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 = [] i = 0 for r in range(self.rows): row = [] for c in range(self.columns): plot = self.scatter_plots[i].plot if plot is None: plot = PlotComponent() row.append(plot) i += 1 plots.append(row) self.plot = GridPlotContainer(shape=(self.rows, self.columns)) self.plot.component_grid = plots
def create_plot_component(self): if not self.data.size: return self.pd = ArrayPlotData() self.shape = self.data.shape self.pd.set_data("imagedata", self.data) self.pd.set_data("left_line", self.data[:, self.shape[0]//2]) self.pd.set_data("top_line", self.data[self.shape[1]//2,:]) plot = Plot(self.pd) cmap = default_colormaps.color_map_name_dict[self.colormap] if self.rev_cmap: cmap = default_colormaps.reverse(cmap) drange = DataRange1D(ImageData(data=self.data, value_depth=1)) self.ccmap = cmap_constant_range(cmap, drange)(drange) #from copy import copy self.img_plot = plot.img_plot("imagedata", colormap=cmap, #xbounds=self.xbounds, #ybounds=self.ybounds, )[0] self.cmap = self.img_plot.value_mapper if not self.autoscale: self.img_plot.value_mapper = self.ccmap # Tweak some of the plot properties plot.title = self.title plot.padding = 10 # Attach some tools to the plot plot.tools.append(PanTool(plot)) zoom = ZoomTool(component=plot, tool_mode="box", always_on=False) plot.overlays.append(zoom) csr = CursorTool(self.img_plot, drag_button='right', color='white', line_width=2.0 ) self.cursor = csr csr.current_index = self.shape[0]//2, self.shape[1]//2 self.img_plot.overlays.append(csr) imgtool = ImageInspectorTool(self.img_plot) self.img_plot.tools.append(imgtool) overlay = ImageInspectorOverlay(component=self.img_plot, image_inspector=imgtool, bgcolor="white", border_visible=True) self.img_plot.overlays.append(overlay) self.plot = plot self.cross_plot = Plot(self.pd,resizable='h') self.cross_plot.height = 40 self.cross_plot.padding = 15 self.cross_plot.plot("top_line", line_style="dot") self.cross_plot.index_range = self.img_plot.index_range.x_range self.cross_plot2 = Plot(self.pd, width=40, orientation="v", padding=15, padding_bottom=10, resizable='v') self.cross_plot2.plot("left_line", line_style="dot") self.cross_plot2.index_range = self.img_plot.index_range.y_range # Create a container and add components #self.container = HPlotContainer(padding=10, fill_padding=False, # bgcolor="none", use_backbuffer=False) #inner_cont = VPlotContainer(padding=0, use_backbuffer=True, bgcolor="none") #inner_cont.add(self.plot) #inner_cont.add(self.cross_plot) self.container = GridPlotContainer(padding=20, fill_padding=False, bgcolor="none", use_backbuffer=True, shape=(2, 2), spacing=(12, 20)) #self.container.add(self.colorbar) self.container.add(self.plot) self.container.add(self.cross_plot2) self.container.add(self.cross_plot)
def make_plots(self, n_dfe_taps): """ Create the plots used by the PyBERT GUI.""" plotdata = self.plotdata # - DFE tab plot1 = Plot(plotdata) plot1.plot(("t_ns", "dfe_out"), type="line", color="blue") plot1.plot(("t_ns", "clocks"), type="line", color="green") plot1.plot(("t_ns", "lockeds"), type="line", color="red") plot1.title = "DFE Output, Recovered Clocks, & Locked" plot1.index_axis.title = "Time (ns)" plot1.tools.append(PanTool(plot1, constrain=True, constrain_key=None, constrain_direction='x')) zoom1 = ZoomTool(plot1, tool_mode="range", axis='index', always_on=False) plot1.overlays.append(zoom1) plot2 = Plot(plotdata) plot2.plot(("t_ns", "ui_ests"), type="line", color="blue") plot2.title = "CDR Adaptation" plot2.index_axis.title = "Time (ns)" plot2.value_axis.title = "UI (ps)" plot2.index_range = plot1.index_range # Zoom x-axes in tandem. plot3 = Plot(plotdata) plot3.plot(('f_MHz_dfe', 'jitter_rejection_ratio'), type="line", color="blue") plot3.title = "CDR/DFE Jitter Rejection Ratio" plot3.index_axis.title = "Frequency (MHz)" plot3.value_axis.title = "Ratio (dB)" zoom3 = ZoomTool(plot3, tool_mode="range", axis='index', always_on=False) plot3.overlays.append(zoom3) plot4 = Plot(plotdata) plot4.plot(('auto_corr'), type="line", color="blue") plot4.title = "Received to Transmitted Bits Correlation" plot4.index_axis.title = "Offset (bits)" plot4.value_axis.title = "Correlation" plot4.value_range.high_setting = 1 plot4.value_range.low_setting = 0 zoom4 = ZoomTool(plot4, tool_mode="range", axis='index', always_on=False) plot4.overlays.append(zoom4) plot9 = Plot(plotdata, auto_colors=['red', 'orange', 'yellow', 'green', 'blue', 'purple']) for i in range(n_dfe_taps): plot9.plot(("tap_weight_index", "tap%d_weights" % (i + 1)), type="line", color="auto", name="tap%d"%(i+1)) plot9.title = "DFE Adaptation" plot9.tools.append(PanTool(plot9, constrain=True, constrain_key=None, constrain_direction='x')) zoom9 = ZoomTool(plot9, tool_mode="range", axis='index', always_on=False) plot9.overlays.append(zoom9) plot9.legend.visible = True plot9.legend.align = 'ul' plot_clk_per_hist = Plot(plotdata) plot_clk_per_hist.plot(('clk_per_hist_bins', 'clk_per_hist_vals'), type="line", color="blue") plot_clk_per_hist.title = "CDR Clock Period Histogram" plot_clk_per_hist.index_axis.title = "Clock Period (ps)" plot_clk_per_hist.value_axis.title = "Bin Count" plot_clk_per_spec = Plot(plotdata) plot_clk_per_spec.plot(('clk_freqs', 'clk_spec'), type="line", color="blue") plot_clk_per_spec.title = "CDR Clock Period Spectrum" plot_clk_per_spec.index_axis.title = "Frequency (bit rate)" plot_clk_per_spec.value_axis.title = "|H(f)| (dB mean)" plot_clk_per_spec.value_range.low_setting = -10 zoom_clk_per_spec = ZoomTool(plot_clk_per_spec, tool_mode="range", axis='index', always_on=False) plot_clk_per_spec.overlays.append(zoom_clk_per_spec) container_dfe = GridPlotContainer(shape=(2,2)) container_dfe.add(plot2) container_dfe.add(plot9) container_dfe.add(plot_clk_per_hist) container_dfe.add(plot_clk_per_spec) self.plots_dfe = container_dfe # - EQ Tune tab plot_h_tune = Plot(plotdata) plot_h_tune.plot(("t_ns_chnl", "ctle_out_h_tune"), type="line", color="red", name="Cumulative") plot_h_tune.plot(("t_ns_chnl", "ctle_out_g_tune"), type="line", color="gray") plot_h_tune.title = "Channel + Tx Preemphasis + CTLE" plot_h_tune.index_axis.title = "Time (ns)" plot_h_tune.y_axis.title = "Response" zoom_tune = ZoomTool(plot_h_tune, tool_mode="range", axis='index', always_on=False) plot_h_tune.overlays.append(zoom_tune) self.plot_h_tune = plot_h_tune # - Impulse Responses tab plot_h_chnl = Plot(plotdata) plot_h_chnl.plot(("t_ns_chnl", "chnl_h"), type="line", color="blue") plot_h_chnl.title = "Channel" plot_h_chnl.index_axis.title = "Time (ns)" plot_h_chnl.y_axis.title = "Impulse Response (V/ns)" zoom_h = ZoomTool(plot_h_chnl, tool_mode="range", axis='index', always_on=False) plot_h_chnl.overlays.append(zoom_h) plot_h_tx = Plot(plotdata) plot_h_tx.plot(("t_ns_chnl", "tx_out_h"), type="line", color="red", name="Cumulative") plot_h_tx.title = "Channel + Tx Preemphasis" plot_h_tx.index_axis.title = "Time (ns)" plot_h_tx.y_axis.title = "Impulse Response (V/ns)" plot_h_tx.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. plot_h_ctle = Plot(plotdata) plot_h_ctle.plot(("t_ns_chnl", "ctle_out_h"), type="line", color="red", name="Cumulative") plot_h_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_h_ctle.index_axis.title = "Time (ns)" plot_h_ctle.y_axis.title = "Impulse Response (V/ns)" plot_h_ctle.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. plot_h_dfe = Plot(plotdata) plot_h_dfe.plot(("t_ns_chnl", "dfe_out_h"), type="line", color="red", name="Cumulative") plot_h_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_h_dfe.index_axis.title = "Time (ns)" plot_h_dfe.y_axis.title = "Impulse Response (V/ns)" plot_h_dfe.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. container_h = GridPlotContainer(shape=(2,2)) container_h.add(plot_h_chnl) container_h.add(plot_h_tx) container_h.add(plot_h_ctle) container_h.add(plot_h_dfe) self.plots_h = container_h # - Step Responses tab plot_s_chnl = Plot(plotdata) plot_s_chnl.plot(("t_ns_chnl", "chnl_s"), type="line", color="blue") plot_s_chnl.title = "Channel" plot_s_chnl.index_axis.title = "Time (ns)" plot_s_chnl.y_axis.title = "Step Response (V)" zoom_s = ZoomTool(plot_s_chnl, tool_mode="range", axis='index', always_on=False) plot_s_chnl.overlays.append(zoom_s) plot_s_tx = Plot(plotdata) plot_s_tx.plot(("t_ns_chnl", "tx_s"), type="line", color="blue", name="Incremental") plot_s_tx.plot(("t_ns_chnl", "tx_out_s"), type="line", color="red", name="Cumulative") plot_s_tx.title = "Channel + Tx Preemphasis" plot_s_tx.index_axis.title = "Time (ns)" plot_s_tx.y_axis.title = "Step Response (V)" plot_s_tx.legend.visible = True plot_s_tx.legend.align = 'lr' plot_s_tx.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. plot_s_ctle = Plot(plotdata) plot_s_ctle.plot(("t_ns_chnl", "ctle_s"), type="line", color="blue", name="Incremental") plot_s_ctle.plot(("t_ns_chnl", "ctle_out_s"), type="line", color="red", name="Cumulative") plot_s_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_s_ctle.index_axis.title = "Time (ns)" plot_s_ctle.y_axis.title = "Step Response (V)" plot_s_ctle.legend.visible = True plot_s_ctle.legend.align = 'lr' plot_s_ctle.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. plot_s_dfe = Plot(plotdata) plot_s_dfe.plot(("t_ns_chnl", "dfe_s"), type="line", color="blue", name="Incremental") plot_s_dfe.plot(("t_ns_chnl", "dfe_out_s"), type="line", color="red", name="Cumulative") plot_s_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_s_dfe.index_axis.title = "Time (ns)" plot_s_dfe.y_axis.title = "Step Response (V)" plot_s_dfe.legend.visible = True plot_s_dfe.legend.align = 'lr' plot_s_dfe.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. container_s = GridPlotContainer(shape=(2,2)) container_s.add(plot_s_chnl) container_s.add(plot_s_tx) container_s.add(plot_s_ctle) container_s.add(plot_s_dfe) self.plots_s = container_s # - Pulse Responses tab plot_p_chnl = Plot(plotdata) plot_p_chnl.plot(("t_ns_chnl", "chnl_p"), type="line", color="blue") plot_p_chnl.title = "Channel" plot_p_chnl.index_axis.title = "Time (ns)" plot_p_chnl.y_axis.title = "Pulse Response (V)" zoom_p = ZoomTool(plot_p_chnl, tool_mode="range", axis='index', always_on=False) plot_p_chnl.overlays.append(zoom_p) plot_p_tx = Plot(plotdata) plot_p_tx.plot(("t_ns_chnl", "tx_out_p"), type="line", color="red", name="Cumulative") plot_p_tx.title = "Channel + Tx Preemphasis" plot_p_tx.index_axis.title = "Time (ns)" plot_p_tx.y_axis.title = "Pulse Response (V)" plot_p_tx.legend.align = 'lr' plot_p_tx.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. plot_p_ctle = Plot(plotdata) plot_p_ctle.plot(("t_ns_chnl", "ctle_out_p"), type="line", color="red", name="Cumulative") plot_p_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_p_ctle.index_axis.title = "Time (ns)" plot_p_ctle.y_axis.title = "Pulse Response (V)" plot_p_ctle.legend.align = 'lr' plot_p_ctle.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. plot_p_dfe = Plot(plotdata) plot_p_dfe.plot(("t_ns_chnl", "dfe_out_p"), type="line", color="red", name="Cumulative") plot_p_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_p_dfe.index_axis.title = "Time (ns)" plot_p_dfe.y_axis.title = "Pulse Response (V)" plot_p_dfe.legend.align = 'lr' plot_p_dfe.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. container_p = GridPlotContainer(shape=(2,2)) container_p.add(plot_p_chnl) container_p.add(plot_p_tx) container_p.add(plot_p_ctle) container_p.add(plot_p_dfe) self.plots_p = container_p # - Frequency Responses tab plot_H_chnl = Plot(plotdata) plot_H_chnl.plot(("f_GHz", "chnl_H"), type="line", color="blue", index_scale='log') plot_H_chnl.title = "Channel" plot_H_chnl.index_axis.title = "Frequency (GHz)" plot_H_chnl.y_axis.title = "Frequency Response (dB)" plot_H_chnl.index_range.low_setting = 0.01 plot_H_chnl.index_range.high_setting = 40. plot_H_tx = Plot(plotdata) plot_H_tx.plot(("f_GHz", "tx_H"), type="line", color="blue", name="Incremental", index_scale='log') plot_H_tx.plot(("f_GHz", "tx_out_H"), type="line", color="red", name="Cumulative", index_scale='log') plot_H_tx.title = "Channel + Tx Preemphasis" plot_H_tx.index_axis.title = "Frequency (GHz)" plot_H_tx.y_axis.title = "Frequency Response (dB)" plot_H_tx.index_range.low_setting = 0.01 plot_H_tx.index_range.high_setting = 40. plot_H_tx.legend.visible = True plot_H_tx.legend.align = 'll' plot_H_ctle = Plot(plotdata) plot_H_ctle.plot(("f_GHz", "ctle_H"), type="line", color="blue", name="Incremental", index_scale='log') plot_H_ctle.plot(("f_GHz", "ctle_out_H"), type="line", color="red", name="Cumulative", index_scale='log') plot_H_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_H_ctle.index_axis.title = "Frequency (GHz)" plot_H_ctle.y_axis.title = "Frequency Response (dB)" plot_H_ctle.index_range.low_setting = 0.01 plot_H_ctle.index_range.high_setting = 40. plot_H_ctle.value_range.low_setting = -40. plot_H_ctle.legend.visible = True plot_H_ctle.legend.align = 'll' plot_H_chnl.value_range = plot_H_ctle.value_range plot_H_tx.value_range = plot_H_ctle.value_range plot_H_dfe = Plot(plotdata) plot_H_dfe.plot(("f_GHz", "dfe_H"), type="line", color="blue", name="Incremental", index_scale='log') plot_H_dfe.plot(("f_GHz", "dfe_out_H"), type="line", color="red", name="Cumulative", index_scale='log') plot_H_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_H_dfe.index_axis.title = "Frequency (GHz)" plot_H_dfe.y_axis.title = "Frequency Response (dB)" plot_H_dfe.index_range.low_setting = 0.01 plot_H_dfe.index_range.high_setting = 40. plot_H_dfe.value_range = plot_H_ctle.value_range plot_H_dfe.legend.visible = True plot_H_dfe.legend.align = 'll' container_H = GridPlotContainer(shape=(2,2)) container_H.add(plot_H_chnl) container_H.add(plot_H_tx) container_H.add(plot_H_ctle) container_H.add(plot_H_dfe) self.plots_H = container_H # - Outputs tab plot_out_chnl = Plot(plotdata) plot_out_chnl.plot(("t_ns", "ideal_signal"), type="line", color="lightgrey") plot_out_chnl.plot(("t_ns", "chnl_out"), type="line", color="blue") plot_out_chnl.title = "Channel" plot_out_chnl.index_axis.title = "Time (ns)" plot_out_chnl.y_axis.title = "Output (V)" zoom_out_chnl = ZoomTool(plot_out_chnl, tool_mode="range", axis='index', always_on=False) plot_out_chnl.overlays.append(zoom_out_chnl) plot_out_tx = Plot(plotdata) plot_out_tx.plot(("t_ns", "tx_out"), type="line", color="blue") plot_out_tx.title = "Channel + Tx Preemphasis (Noise added here.)" plot_out_tx.index_axis.title = "Time (ns)" plot_out_tx.y_axis.title = "Output (V)" plot_out_tx.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. plot_out_ctle = Plot(plotdata) plot_out_ctle.plot(("t_ns", "ctle_out"), type="line", color="blue") plot_out_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_out_ctle.index_axis.title = "Time (ns)" plot_out_ctle.y_axis.title = "Output (V)" plot_out_ctle.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. plot_out_dfe = Plot(plotdata) plot_out_dfe.plot(("t_ns", "dfe_out"), type="line", color="blue") plot_out_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_out_dfe.index_axis.title = "Time (ns)" plot_out_dfe.y_axis.title = "Output (V)" plot_out_dfe.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. container_out = GridPlotContainer(shape=(2,2)) container_out.add(plot_out_chnl) container_out.add(plot_out_tx) container_out.add(plot_out_ctle) container_out.add(plot_out_dfe) self.plots_out = container_out # - Eye Diagrams tab seg_map = dict( red = [ (0.00, 0.00, 0.00), # black (0.00001, 0.00, 0.00), # blue (0.15, 0.00, 0.00), # cyan (0.30, 0.00, 0.00), # green (0.45, 1.00, 1.00), # yellow (0.60, 1.00, 1.00), # orange (0.75, 1.00, 1.00), # red (0.90, 1.00, 1.00), # pink (1.00, 1.00, 1.00) # white ], green = [ (0.00, 0.00, 0.00), # black (0.00001, 0.00, 0.00), # blue (0.15, 0.50, 0.50), # cyan (0.30, 0.50, 0.50), # green (0.45, 1.00, 1.00), # yellow (0.60, 0.50, 0.50), # orange (0.75, 0.00, 0.00), # red (0.90, 0.50, 0.50), # pink (1.00, 1.00, 1.00) # white ], blue = [ (0.00, 0.00, 0.00), # black (1e-18, 0.50, 0.50), # blue (0.15, 0.50, 0.50), # cyan (0.30, 0.00, 0.00), # green (0.45, 0.00, 0.00), # yellow (0.60, 0.00, 0.00), # orange (0.75, 0.00, 0.00), # red (0.90, 0.50, 0.50), # pink (1.00, 1.00, 1.00) # white ] ) clr_map = ColorMapper.from_segment_map(seg_map) self.clr_map = clr_map plot_eye_chnl = Plot(plotdata) plot_eye_chnl.img_plot("eye_chnl", colormap=clr_map,) plot_eye_chnl.y_direction = 'normal' plot_eye_chnl.components[0].y_direction = 'normal' plot_eye_chnl.title = "Channel" plot_eye_chnl.x_axis.title = "Time (ps)" plot_eye_chnl.x_axis.orientation = "bottom" plot_eye_chnl.y_axis.title = "Signal Level (V)" plot_eye_chnl.x_grid.visible = True plot_eye_chnl.y_grid.visible = True plot_eye_chnl.x_grid.line_color = 'gray' plot_eye_chnl.y_grid.line_color = 'gray' plot_eye_tx = Plot(plotdata) plot_eye_tx.img_plot("eye_tx", colormap=clr_map,) plot_eye_tx.y_direction = 'normal' plot_eye_tx.components[0].y_direction = 'normal' plot_eye_tx.title = "Channel + Tx Preemphasis (Noise added here.)" plot_eye_tx.x_axis.title = "Time (ps)" plot_eye_tx.x_axis.orientation = "bottom" plot_eye_tx.y_axis.title = "Signal Level (V)" plot_eye_tx.x_grid.visible = True plot_eye_tx.y_grid.visible = True plot_eye_tx.x_grid.line_color = 'gray' plot_eye_tx.y_grid.line_color = 'gray' plot_eye_ctle = Plot(plotdata) plot_eye_ctle.img_plot("eye_ctle", colormap=clr_map,) plot_eye_ctle.y_direction = 'normal' plot_eye_ctle.components[0].y_direction = 'normal' plot_eye_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_eye_ctle.x_axis.title = "Time (ps)" plot_eye_ctle.x_axis.orientation = "bottom" plot_eye_ctle.y_axis.title = "Signal Level (V)" plot_eye_ctle.x_grid.visible = True plot_eye_ctle.y_grid.visible = True plot_eye_ctle.x_grid.line_color = 'gray' plot_eye_ctle.y_grid.line_color = 'gray' plot_eye_dfe = Plot(plotdata) plot_eye_dfe.img_plot("eye_dfe", colormap=clr_map,) plot_eye_dfe.y_direction = 'normal' plot_eye_dfe.components[0].y_direction = 'normal' plot_eye_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_eye_dfe.x_axis.title = "Time (ps)" plot_eye_dfe.x_axis.orientation = "bottom" plot_eye_dfe.y_axis.title = "Signal Level (V)" plot_eye_dfe.x_grid.visible = True plot_eye_dfe.y_grid.visible = True plot_eye_dfe.x_grid.line_color = 'gray' plot_eye_dfe.y_grid.line_color = 'gray' container_eye = GridPlotContainer(shape=(2,2)) container_eye.add(plot_eye_chnl) container_eye.add(plot_eye_tx) container_eye.add(plot_eye_ctle) container_eye.add(plot_eye_dfe) self.plots_eye = container_eye # - Jitter Distributions tab plot_jitter_dist_chnl = Plot(plotdata) plot_jitter_dist_chnl.plot(('jitter_bins', 'jitter_chnl'), type="line", color="blue", name="Measured") plot_jitter_dist_chnl.plot(('jitter_bins', 'jitter_ext_chnl'), type="line", color="red", name="Extrapolated") plot_jitter_dist_chnl.title = "Channel" plot_jitter_dist_chnl.index_axis.title = "Time (ps)" plot_jitter_dist_chnl.value_axis.title = "Count" plot_jitter_dist_chnl.legend.visible = True plot_jitter_dist_chnl.legend.align = 'ur' plot_jitter_dist_tx = Plot(plotdata) plot_jitter_dist_tx.plot(('jitter_bins', 'jitter_tx'), type="line", color="blue", name="Measured") plot_jitter_dist_tx.plot(('jitter_bins', 'jitter_ext_tx'), type="line", color="red", name="Extrapolated") plot_jitter_dist_tx.title = "Channel + Tx Preemphasis (Noise added here.)" plot_jitter_dist_tx.index_axis.title = "Time (ps)" plot_jitter_dist_tx.value_axis.title = "Count" plot_jitter_dist_tx.legend.visible = True plot_jitter_dist_tx.legend.align = 'ur' plot_jitter_dist_ctle = Plot(plotdata) plot_jitter_dist_ctle.plot(('jitter_bins', 'jitter_ctle'), type="line", color="blue", name="Measured") plot_jitter_dist_ctle.plot(('jitter_bins', 'jitter_ext_ctle'), type="line", color="red", name="Extrapolated") plot_jitter_dist_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_jitter_dist_ctle.index_axis.title = "Time (ps)" plot_jitter_dist_ctle.value_axis.title = "Count" plot_jitter_dist_ctle.legend.visible = True plot_jitter_dist_ctle.legend.align = 'ur' plot_jitter_dist_dfe = Plot(plotdata) plot_jitter_dist_dfe.plot(('jitter_bins', 'jitter_dfe'), type="line", color="blue", name="Measured") plot_jitter_dist_dfe.plot(('jitter_bins', 'jitter_ext_dfe'), type="line", color="red", name="Extrapolated") plot_jitter_dist_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_jitter_dist_dfe.index_axis.title = "Time (ps)" plot_jitter_dist_dfe.value_axis.title = "Count" plot_jitter_dist_dfe.legend.visible = True plot_jitter_dist_dfe.legend.align = 'ur' container_jitter_dist = GridPlotContainer(shape=(2,2)) container_jitter_dist.add(plot_jitter_dist_chnl) container_jitter_dist.add(plot_jitter_dist_tx) container_jitter_dist.add(plot_jitter_dist_ctle) container_jitter_dist.add(plot_jitter_dist_dfe) self.plots_jitter_dist = container_jitter_dist # - Jitter Spectrums tab plot_jitter_spec_chnl = Plot(plotdata) plot_jitter_spec_chnl.plot(('f_MHz', 'jitter_spectrum_chnl'), type="line", color="blue", name="Total") plot_jitter_spec_chnl.plot(('f_MHz', 'jitter_ind_spectrum_chnl'), type="line", color="red", name="Data Independent") plot_jitter_spec_chnl.plot(('f_MHz', 'thresh_chnl'), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_chnl.title = "Channel" plot_jitter_spec_chnl.index_axis.title = "Frequency (MHz)" plot_jitter_spec_chnl.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_chnl.tools.append(PanTool(plot_jitter_spec_chnl, constrain=True, constrain_key=None, constrain_direction='x')) zoom_jitter_spec_chnl = ZoomTool(plot_jitter_spec_chnl, tool_mode="range", axis='index', always_on=False) plot_jitter_spec_chnl.overlays.append(zoom_jitter_spec_chnl) plot_jitter_spec_chnl.legend.visible = True plot_jitter_spec_chnl.legend.align = 'lr' plot_jitter_spec_tx = Plot(plotdata) plot_jitter_spec_tx.plot(('f_MHz', 'jitter_spectrum_tx'), type="line", color="blue", name="Total") plot_jitter_spec_tx.plot(('f_MHz', 'jitter_ind_spectrum_tx'), type="line", color="red", name="Data Independent") plot_jitter_spec_tx.plot(('f_MHz', 'thresh_tx'), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_tx.title = "Channel + Tx Preemphasis (Noise added here.)" plot_jitter_spec_tx.index_axis.title = "Frequency (MHz)" plot_jitter_spec_tx.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_tx.value_range.low_setting = -40. plot_jitter_spec_tx.tools.append(PanTool(plot_jitter_spec_tx, constrain=True, constrain_key=None, constrain_direction='x')) zoom_jitter_spec_tx = ZoomTool(plot_jitter_spec_tx, tool_mode="range", axis='index', always_on=False) plot_jitter_spec_tx.overlays.append(zoom_jitter_spec_tx) plot_jitter_spec_tx.legend.visible = True plot_jitter_spec_tx.legend.align = 'lr' plot_jitter_spec_chnl.value_range = plot_jitter_spec_tx.value_range plot_jitter_spec_ctle = Plot(plotdata) plot_jitter_spec_ctle.plot(('f_MHz', 'jitter_spectrum_ctle'), type="line", color="blue", name="Total") plot_jitter_spec_ctle.plot(('f_MHz', 'jitter_ind_spectrum_ctle'), type="line", color="red", name="Data Independent") plot_jitter_spec_ctle.plot(('f_MHz', 'thresh_ctle'), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_jitter_spec_ctle.index_axis.title = "Frequency (MHz)" plot_jitter_spec_ctle.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_ctle.tools.append(PanTool(plot_jitter_spec_ctle, constrain=True, constrain_key=None, constrain_direction='x')) zoom_jitter_spec_ctle = ZoomTool(plot_jitter_spec_ctle, tool_mode="range", axis='index', always_on=False) plot_jitter_spec_ctle.overlays.append(zoom_jitter_spec_ctle) plot_jitter_spec_ctle.legend.visible = True plot_jitter_spec_ctle.legend.align = 'lr' plot_jitter_spec_ctle.value_range = plot_jitter_spec_tx.value_range plot_jitter_spec_dfe = Plot(plotdata) plot_jitter_spec_dfe.plot(('f_MHz_dfe', 'jitter_spectrum_dfe'), type="line", color="blue", name="Total") plot_jitter_spec_dfe.plot(('f_MHz_dfe', 'jitter_ind_spectrum_dfe'), type="line", color="red", name="Data Independent") plot_jitter_spec_dfe.plot(('f_MHz_dfe', 'thresh_dfe'), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_jitter_spec_dfe.index_axis.title = "Frequency (MHz)" plot_jitter_spec_dfe.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_dfe.tools.append(PanTool(plot_jitter_spec_dfe, constrain=True, constrain_key=None, constrain_direction='x')) zoom_jitter_spec_dfe = ZoomTool(plot_jitter_spec_dfe, tool_mode="range", axis='index', always_on=False) plot_jitter_spec_dfe.overlays.append(zoom_jitter_spec_dfe) plot_jitter_spec_dfe.legend.visible = True plot_jitter_spec_dfe.legend.align = 'lr' plot_jitter_spec_dfe.value_range = plot_jitter_spec_tx.value_range container_jitter_spec = GridPlotContainer(shape=(2,2)) container_jitter_spec.add(plot_jitter_spec_chnl) container_jitter_spec.add(plot_jitter_spec_tx) container_jitter_spec.add(plot_jitter_spec_ctle) container_jitter_spec.add(plot_jitter_spec_dfe) self.plots_jitter_spec = container_jitter_spec # - Bathtub Curves tab plot_bathtub_chnl = Plot(plotdata) plot_bathtub_chnl.plot(("jitter_bins", "bathtub_chnl"), type="line", color="blue") plot_bathtub_chnl.value_range.high_setting = 0 plot_bathtub_chnl.value_range.low_setting = -18 plot_bathtub_chnl.value_axis.tick_interval = 3 plot_bathtub_chnl.title = "Channel" plot_bathtub_chnl.index_axis.title = "Time (ps)" plot_bathtub_chnl.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_tx = Plot(plotdata) plot_bathtub_tx.plot(("jitter_bins", "bathtub_tx"), type="line", color="blue") plot_bathtub_tx.value_range.high_setting = 0 plot_bathtub_tx.value_range.low_setting = -18 plot_bathtub_tx.value_axis.tick_interval = 3 plot_bathtub_tx.title = "Channel + Tx Preemphasis (Noise added here.)" plot_bathtub_tx.index_axis.title = "Time (ps)" plot_bathtub_tx.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_ctle = Plot(plotdata) plot_bathtub_ctle.plot(("jitter_bins", "bathtub_ctle"), type="line", color="blue") plot_bathtub_ctle.value_range.high_setting = 0 plot_bathtub_ctle.value_range.low_setting = -18 plot_bathtub_ctle.value_axis.tick_interval = 3 plot_bathtub_ctle.title = "Channel + Tx Preemphasis + CTLE" plot_bathtub_ctle.index_axis.title = "Time (ps)" plot_bathtub_ctle.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_dfe = Plot(plotdata) plot_bathtub_dfe.plot(("jitter_bins", "bathtub_dfe"), type="line", color="blue") plot_bathtub_dfe.value_range.high_setting = 0 plot_bathtub_dfe.value_range.low_setting = -18 plot_bathtub_dfe.value_axis.tick_interval = 3 plot_bathtub_dfe.title = "Channel + Tx Preemphasis + CTLE + DFE" plot_bathtub_dfe.index_axis.title = "Time (ps)" plot_bathtub_dfe.value_axis.title = "Log10(P(Transition occurs inside.))" container_bathtub = GridPlotContainer(shape=(2,2)) container_bathtub.add(plot_bathtub_chnl) container_bathtub.add(plot_bathtub_tx) container_bathtub.add(plot_bathtub_ctle) container_bathtub.add(plot_bathtub_dfe) self.plots_bathtub = container_bathtub update_eyes(self) return
def make_plots(self, n_dfe_taps): """ Create the plots used by the PyBERT GUI.""" post_chnl_str = "Channel" post_tx_str = "Channel + Tx Preemphasis" post_ctle_str = "Channel + Tx Preemphasis + CTLE (+ AMI DFE)" post_dfe_str = "Channel + Tx Preemphasis + CTLE (+ AMI DFE) + PyBERT DFE" plotdata = self.plotdata # - DFE tab plot2 = Plot(plotdata, padding_left=75) plot2.plot(("t_ns", "ui_ests"), type="line", color="blue") plot2.title = "CDR Adaptation" plot2.index_axis.title = "Time (ns)" plot2.value_axis.title = "UI (ps)" plot9 = Plot( plotdata, auto_colors=["red", "orange", "yellow", "green", "blue", "purple"], padding_left=75, ) for i in range(n_dfe_taps): plot9.plot( ("tap_weight_index", "tap%d_weights" % (i + 1)), type="line", color="auto", name="tap%d" % (i + 1), ) plot9.title = "DFE Adaptation" plot9.tools.append( PanTool(plot9, constrain=True, constrain_key=None, constrain_direction="x")) zoom9 = ZoomTool(plot9, tool_mode="range", axis="index", always_on=False) plot9.overlays.append(zoom9) plot9.legend.visible = True plot9.legend.align = "ul" plot_clk_per_hist = Plot(plotdata, padding_left=75) plot_clk_per_hist.plot(("clk_per_hist_bins", "clk_per_hist_vals"), type="line", color="blue") plot_clk_per_hist.title = "CDR Clock Period Histogram" plot_clk_per_hist.index_axis.title = "Clock Period (ps)" plot_clk_per_hist.value_axis.title = "Bin Count" plot_clk_per_spec = Plot(plotdata, padding_left=75) plot_clk_per_spec.plot(("clk_freqs", "clk_spec"), type="line", color="blue") plot_clk_per_spec.title = "CDR Clock Period Spectrum" plot_clk_per_spec.index_axis.title = "Frequency (bit rate)" plot_clk_per_spec.value_axis.title = "|H(f)| (dB mean)" plot_clk_per_spec.value_range.low_setting = -10 zoom_clk_per_spec = ZoomTool(plot_clk_per_spec, tool_mode="range", axis="index", always_on=False) plot_clk_per_spec.overlays.append(zoom_clk_per_spec) container_dfe = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_dfe.add(plot2) container_dfe.add(plot9) container_dfe.add(plot_clk_per_hist) container_dfe.add(plot_clk_per_spec) self.plots_dfe = container_dfe self._dfe_plot = plot9 # - EQ Tune tab # plot_h_tune = Plot(plotdata, padding_left=75) plot_h_tune = Plot(plotdata, padding_bottom=75) plot_h_tune.plot(("t_ns_chnl", "ctle_out_h_tune"), type="line", color="blue") plot_h_tune.plot(("t_ns_chnl", "clocks_tune"), type="line", color="gray") plot_h_tune.title = "Channel + Tx Preemphasis + CTLE (+ AMI DFE) + Ideal DFE" plot_h_tune.index_axis.title = "Time (ns)" plot_h_tune.y_axis.title = "Pulse Response (V)" zoom_tune = ZoomTool(plot_h_tune, tool_mode="range", axis="index", always_on=False) plot_h_tune.overlays.append(zoom_tune) self.plot_h_tune = plot_h_tune # - Impulse Responses tab plot_h_chnl = Plot(plotdata, padding_left=75) plot_h_chnl.plot(("t_ns_chnl", "chnl_h"), type="line", color="blue", name="Incremental") plot_h_chnl.title = post_chnl_str plot_h_chnl.index_axis.title = "Time (ns)" plot_h_chnl.y_axis.title = "Impulse Response (V/ns)" plot_h_chnl.legend.visible = True plot_h_chnl.legend.align = "ur" zoom_h = ZoomTool(plot_h_chnl, tool_mode="range", axis="index", always_on=False) plot_h_chnl.overlays.append(zoom_h) plot_h_tx = Plot(plotdata, padding_left=75) plot_h_tx.plot(("t_ns_chnl", "tx_out_h"), type="line", color="red", name="Cumulative") plot_h_tx.title = post_tx_str plot_h_tx.index_axis.title = "Time (ns)" plot_h_tx.y_axis.title = "Impulse Response (V/ns)" plot_h_tx.legend.visible = True plot_h_tx.legend.align = "ur" plot_h_tx.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. plot_h_ctle = Plot(plotdata, padding_left=75) plot_h_ctle.plot(("t_ns_chnl", "ctle_out_h"), type="line", color="red", name="Cumulative") plot_h_ctle.title = post_ctle_str plot_h_ctle.index_axis.title = "Time (ns)" plot_h_ctle.y_axis.title = "Impulse Response (V/ns)" plot_h_ctle.legend.visible = True plot_h_ctle.legend.align = "ur" plot_h_ctle.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. plot_h_dfe = Plot(plotdata, padding_left=75) plot_h_dfe.plot(("t_ns_chnl", "dfe_out_h"), type="line", color="red", name="Cumulative") plot_h_dfe.title = post_dfe_str plot_h_dfe.index_axis.title = "Time (ns)" plot_h_dfe.y_axis.title = "Impulse Response (V/ns)" plot_h_dfe.legend.visible = True plot_h_dfe.legend.align = "ur" plot_h_dfe.index_range = plot_h_chnl.index_range # Zoom x-axes in tandem. container_h = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_h.add(plot_h_chnl) container_h.add(plot_h_tx) container_h.add(plot_h_ctle) container_h.add(plot_h_dfe) self.plots_h = container_h # - Step Responses tab plot_s_chnl = Plot(plotdata, padding_left=75) plot_s_chnl.plot(("t_ns_chnl", "chnl_s"), type="line", color="blue", name="Incremental") plot_s_chnl.title = post_chnl_str plot_s_chnl.index_axis.title = "Time (ns)" plot_s_chnl.y_axis.title = "Step Response (V)" plot_s_chnl.legend.visible = True plot_s_chnl.legend.align = "lr" zoom_s = ZoomTool(plot_s_chnl, tool_mode="range", axis="index", always_on=False) plot_s_chnl.overlays.append(zoom_s) plot_s_tx = Plot(plotdata, padding_left=75) plot_s_tx.plot(("t_ns_chnl", "tx_s"), type="line", color="blue", name="Incremental") plot_s_tx.plot(("t_ns_chnl", "tx_out_s"), type="line", color="red", name="Cumulative") plot_s_tx.title = post_tx_str plot_s_tx.index_axis.title = "Time (ns)" plot_s_tx.y_axis.title = "Step Response (V)" plot_s_tx.legend.visible = True plot_s_tx.legend.align = "lr" plot_s_tx.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. plot_s_ctle = Plot(plotdata, padding_left=75) plot_s_ctle.plot(("t_ns_chnl", "ctle_s"), type="line", color="blue", name="Incremental") plot_s_ctle.plot(("t_ns_chnl", "ctle_out_s"), type="line", color="red", name="Cumulative") plot_s_ctle.title = post_ctle_str plot_s_ctle.index_axis.title = "Time (ns)" plot_s_ctle.y_axis.title = "Step Response (V)" plot_s_ctle.legend.visible = True plot_s_ctle.legend.align = "lr" plot_s_ctle.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. plot_s_dfe = Plot(plotdata, padding_left=75) plot_s_dfe.plot(("t_ns_chnl", "dfe_s"), type="line", color="blue", name="Incremental") plot_s_dfe.plot(("t_ns_chnl", "dfe_out_s"), type="line", color="red", name="Cumulative") plot_s_dfe.title = post_dfe_str plot_s_dfe.index_axis.title = "Time (ns)" plot_s_dfe.y_axis.title = "Step Response (V)" plot_s_dfe.legend.visible = True plot_s_dfe.legend.align = "lr" plot_s_dfe.index_range = plot_s_chnl.index_range # Zoom x-axes in tandem. container_s = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_s.add(plot_s_chnl) container_s.add(plot_s_tx) container_s.add(plot_s_ctle) container_s.add(plot_s_dfe) self.plots_s = container_s # - Pulse Responses tab plot_p_chnl = Plot(plotdata, padding_left=75) plot_p_chnl.plot(("t_ns_chnl", "chnl_p"), type="line", color="blue", name="Incremental") plot_p_chnl.title = post_chnl_str plot_p_chnl.index_axis.title = "Time (ns)" plot_p_chnl.y_axis.title = "Pulse Response (V)" plot_p_chnl.legend.visible = True plot_p_chnl.legend.align = "ur" zoom_p = ZoomTool(plot_p_chnl, tool_mode="range", axis="index", always_on=False) plot_p_chnl.overlays.append(zoom_p) plot_p_tx = Plot(plotdata, padding_left=75) plot_p_tx.plot(("t_ns_chnl", "tx_out_p"), type="line", color="red", name="Cumulative") plot_p_tx.title = post_tx_str plot_p_tx.index_axis.title = "Time (ns)" plot_p_tx.y_axis.title = "Pulse Response (V)" plot_p_tx.legend.visible = True plot_p_tx.legend.align = "ur" plot_p_tx.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. plot_p_ctle = Plot(plotdata, padding_left=75) plot_p_ctle.plot(("t_ns_chnl", "ctle_out_p"), type="line", color="red", name="Cumulative") plot_p_ctle.title = post_ctle_str plot_p_ctle.index_axis.title = "Time (ns)" plot_p_ctle.y_axis.title = "Pulse Response (V)" plot_p_ctle.legend.visible = True plot_p_ctle.legend.align = "ur" plot_p_ctle.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. plot_p_dfe = Plot(plotdata, padding_left=75) plot_p_dfe.plot(("t_ns_chnl", "dfe_out_p"), type="line", color="red", name="Cumulative") plot_p_dfe.title = post_dfe_str plot_p_dfe.index_axis.title = "Time (ns)" plot_p_dfe.y_axis.title = "Pulse Response (V)" plot_p_dfe.legend.visible = True plot_p_dfe.legend.align = "ur" plot_p_dfe.index_range = plot_p_chnl.index_range # Zoom x-axes in tandem. container_p = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_p.add(plot_p_chnl) container_p.add(plot_p_tx) container_p.add(plot_p_ctle) container_p.add(plot_p_dfe) self.plots_p = container_p # - Frequency Responses tab plot_H_chnl = Plot(plotdata, padding_left=75) plot_H_chnl.plot(("f_GHz", "chnl_H"), type="line", color="blue", name="Original Impulse", index_scale="log") plot_H_chnl.plot(("f_GHz", "chnl_trimmed_H"), type="line", color="red", name="Trimmed Impulse", index_scale="log") plot_H_chnl.title = post_chnl_str plot_H_chnl.index_axis.title = "Frequency (GHz)" plot_H_chnl.y_axis.title = "Frequency Response (dB)" plot_H_chnl.index_range.low_setting = 0.01 plot_H_chnl.index_range.high_setting = 40.0 plot_H_chnl.legend.visible = True plot_H_chnl.legend.align = "ll" plot_H_tx = Plot(plotdata, padding_left=75) plot_H_tx.plot(("f_GHz", "tx_H"), type="line", color="blue", name="Incremental", index_scale="log") plot_H_tx.plot(("f_GHz", "tx_out_H"), type="line", color="red", name="Cumulative", index_scale="log") plot_H_tx.title = post_tx_str plot_H_tx.index_axis.title = "Frequency (GHz)" plot_H_tx.y_axis.title = "Frequency Response (dB)" plot_H_tx.index_range.low_setting = 0.01 plot_H_tx.index_range.high_setting = 40.0 plot_H_tx.legend.visible = True plot_H_tx.legend.align = "ll" plot_H_ctle = Plot(plotdata, padding_left=75) plot_H_ctle.plot(("f_GHz", "ctle_H"), type="line", color="blue", name="Incremental", index_scale="log") plot_H_ctle.plot(("f_GHz", "ctle_out_H"), type="line", color="red", name="Cumulative", index_scale="log") plot_H_ctle.title = post_ctle_str plot_H_ctle.index_axis.title = "Frequency (GHz)" plot_H_ctle.y_axis.title = "Frequency Response (dB)" plot_H_ctle.index_range.low_setting = 0.01 plot_H_ctle.index_range.high_setting = 40.0 plot_H_ctle.value_range.low_setting = -40.0 plot_H_ctle.legend.visible = True plot_H_ctle.legend.align = "ll" plot_H_chnl.value_range = plot_H_ctle.value_range plot_H_tx.value_range = plot_H_ctle.value_range plot_H_dfe = Plot(plotdata, padding_left=75) plot_H_dfe.plot(("f_GHz", "dfe_H"), type="line", color="blue", name="Incremental", index_scale="log") plot_H_dfe.plot(("f_GHz", "dfe_out_H"), type="line", color="red", name="Cumulative", index_scale="log") plot_H_dfe.title = post_dfe_str plot_H_dfe.index_axis.title = "Frequency (GHz)" plot_H_dfe.y_axis.title = "Frequency Response (dB)" plot_H_dfe.index_range.low_setting = 0.01 plot_H_dfe.index_range.high_setting = 40.0 plot_H_dfe.value_range = plot_H_ctle.value_range plot_H_dfe.legend.visible = True plot_H_dfe.legend.align = "ll" container_H = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_H.add(plot_H_chnl) container_H.add(plot_H_tx) container_H.add(plot_H_ctle) container_H.add(plot_H_dfe) self.plots_H = container_H # - Outputs tab plot_out_chnl = Plot(plotdata, padding_left=75) # plot_out_chnl.plot(("t_ns", "ideal_signal"), type="line", color="lightgrey") plot_out_chnl.plot(("t_ns", "chnl_out"), type="line", color="blue") plot_out_chnl.title = post_chnl_str plot_out_chnl.index_axis.title = "Time (ns)" plot_out_chnl.y_axis.title = "Output (V)" plot_out_chnl.tools.append( PanTool(plot_out_chnl, constrain=True, constrain_key=None, constrain_direction="x")) zoom_out_chnl = ZoomTool(plot_out_chnl, tool_mode="range", axis="index", always_on=False) plot_out_chnl.overlays.append(zoom_out_chnl) plot_out_tx = Plot(plotdata, padding_left=75) plot_out_tx.plot(("t_ns", "tx_out"), type="line", color="blue") plot_out_tx.title = post_tx_str plot_out_tx.index_axis.title = "Time (ns)" plot_out_tx.y_axis.title = "Output (V)" plot_out_tx.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. plot_out_ctle = Plot(plotdata, padding_left=75) plot_out_ctle.plot(("t_ns", "ctle_out"), type="line", color="blue") plot_out_ctle.title = post_ctle_str plot_out_ctle.index_axis.title = "Time (ns)" plot_out_ctle.y_axis.title = "Output (V)" plot_out_ctle.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. plot_out_dfe = Plot(plotdata, padding_left=75) plot_out_dfe.plot(("t_ns", "dfe_out"), type="line", color="blue") plot_out_dfe.title = post_dfe_str plot_out_dfe.index_axis.title = "Time (ns)" plot_out_dfe.y_axis.title = "Output (V)" plot_out_dfe.index_range = plot_out_chnl.index_range # Zoom x-axes in tandem. container_out = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_out.add(plot_out_chnl) container_out.add(plot_out_tx) container_out.add(plot_out_ctle) container_out.add(plot_out_dfe) self.plots_out = container_out # - Eye Diagrams tab seg_map = dict( red=[ (0.00, 0.00, 0.00), # black (0.00001, 0.00, 0.00), # blue (0.15, 0.00, 0.00), # cyan (0.30, 0.00, 0.00), # green (0.45, 1.00, 1.00), # yellow (0.60, 1.00, 1.00), # orange (0.75, 1.00, 1.00), # red (0.90, 1.00, 1.00), # pink (1.00, 1.00, 1.00), # white ], green=[ (0.00, 0.00, 0.00), # black (0.00001, 0.00, 0.00), # blue (0.15, 0.50, 0.50), # cyan (0.30, 0.50, 0.50), # green (0.45, 1.00, 1.00), # yellow (0.60, 0.50, 0.50), # orange (0.75, 0.00, 0.00), # red (0.90, 0.50, 0.50), # pink (1.00, 1.00, 1.00), # white ], blue=[ (0.00, 0.00, 0.00), # black (1e-18, 0.50, 0.50), # blue (0.15, 0.50, 0.50), # cyan (0.30, 0.00, 0.00), # green (0.45, 0.00, 0.00), # yellow (0.60, 0.00, 0.00), # orange (0.75, 0.00, 0.00), # red (0.90, 0.50, 0.50), # pink (1.00, 1.00, 1.00), # white ], ) clr_map = ColorMapper.from_segment_map(seg_map) self.clr_map = clr_map plot_eye_chnl = Plot(plotdata, padding_left=75) plot_eye_chnl.img_plot("eye_chnl", colormap=clr_map) plot_eye_chnl.y_direction = "normal" plot_eye_chnl.components[0].y_direction = "normal" plot_eye_chnl.title = post_chnl_str plot_eye_chnl.x_axis.title = "Time (ps)" plot_eye_chnl.x_axis.orientation = "bottom" plot_eye_chnl.y_axis.title = "Signal Level (V)" plot_eye_chnl.x_grid.visible = True plot_eye_chnl.y_grid.visible = True plot_eye_chnl.x_grid.line_color = "gray" plot_eye_chnl.y_grid.line_color = "gray" plot_eye_tx = Plot(plotdata, padding_left=75) plot_eye_tx.img_plot("eye_tx", colormap=clr_map) plot_eye_tx.y_direction = "normal" plot_eye_tx.components[0].y_direction = "normal" plot_eye_tx.title = post_tx_str plot_eye_tx.x_axis.title = "Time (ps)" plot_eye_tx.x_axis.orientation = "bottom" plot_eye_tx.y_axis.title = "Signal Level (V)" plot_eye_tx.x_grid.visible = True plot_eye_tx.y_grid.visible = True plot_eye_tx.x_grid.line_color = "gray" plot_eye_tx.y_grid.line_color = "gray" plot_eye_ctle = Plot(plotdata, padding_left=75) plot_eye_ctle.img_plot("eye_ctle", colormap=clr_map) plot_eye_ctle.y_direction = "normal" plot_eye_ctle.components[0].y_direction = "normal" plot_eye_ctle.title = post_ctle_str plot_eye_ctle.x_axis.title = "Time (ps)" plot_eye_ctle.x_axis.orientation = "bottom" plot_eye_ctle.y_axis.title = "Signal Level (V)" plot_eye_ctle.x_grid.visible = True plot_eye_ctle.y_grid.visible = True plot_eye_ctle.x_grid.line_color = "gray" plot_eye_ctle.y_grid.line_color = "gray" plot_eye_dfe = Plot(plotdata, padding_left=75) plot_eye_dfe.img_plot("eye_dfe", colormap=clr_map) plot_eye_dfe.y_direction = "normal" plot_eye_dfe.components[0].y_direction = "normal" plot_eye_dfe.title = post_dfe_str plot_eye_dfe.x_axis.title = "Time (ps)" plot_eye_dfe.x_axis.orientation = "bottom" plot_eye_dfe.y_axis.title = "Signal Level (V)" plot_eye_dfe.x_grid.visible = True plot_eye_dfe.y_grid.visible = True plot_eye_dfe.x_grid.line_color = "gray" plot_eye_dfe.y_grid.line_color = "gray" container_eye = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_eye.add(plot_eye_chnl) container_eye.add(plot_eye_tx) container_eye.add(plot_eye_ctle) container_eye.add(plot_eye_dfe) self.plots_eye = container_eye # - Jitter Distributions tab plot_jitter_dist_chnl = Plot(plotdata, padding_left=75) plot_jitter_dist_chnl.plot(("jitter_bins", "jitter_chnl"), type="line", color="blue", name="Measured") plot_jitter_dist_chnl.plot(("jitter_bins", "jitter_ext_chnl"), type="line", color="red", name="Extrapolated") plot_jitter_dist_chnl.title = post_chnl_str plot_jitter_dist_chnl.index_axis.title = "Time (ps)" plot_jitter_dist_chnl.value_axis.title = "Count" plot_jitter_dist_chnl.legend.visible = True plot_jitter_dist_chnl.legend.align = "ur" plot_jitter_dist_tx = Plot(plotdata, padding_left=75) plot_jitter_dist_tx.plot(("jitter_bins", "jitter_tx"), type="line", color="blue", name="Measured") plot_jitter_dist_tx.plot(("jitter_bins", "jitter_ext_tx"), type="line", color="red", name="Extrapolated") plot_jitter_dist_tx.title = post_tx_str plot_jitter_dist_tx.index_axis.title = "Time (ps)" plot_jitter_dist_tx.value_axis.title = "Count" plot_jitter_dist_tx.legend.visible = True plot_jitter_dist_tx.legend.align = "ur" plot_jitter_dist_ctle = Plot(plotdata, padding_left=75) plot_jitter_dist_ctle.plot(("jitter_bins", "jitter_ctle"), type="line", color="blue", name="Measured") plot_jitter_dist_ctle.plot(("jitter_bins", "jitter_ext_ctle"), type="line", color="red", name="Extrapolated") plot_jitter_dist_ctle.title = post_ctle_str plot_jitter_dist_ctle.index_axis.title = "Time (ps)" plot_jitter_dist_ctle.value_axis.title = "Count" plot_jitter_dist_ctle.legend.visible = True plot_jitter_dist_ctle.legend.align = "ur" plot_jitter_dist_dfe = Plot(plotdata, padding_left=75) plot_jitter_dist_dfe.plot(("jitter_bins", "jitter_dfe"), type="line", color="blue", name="Measured") plot_jitter_dist_dfe.plot(("jitter_bins", "jitter_ext_dfe"), type="line", color="red", name="Extrapolated") plot_jitter_dist_dfe.title = post_dfe_str plot_jitter_dist_dfe.index_axis.title = "Time (ps)" plot_jitter_dist_dfe.value_axis.title = "Count" plot_jitter_dist_dfe.legend.visible = True plot_jitter_dist_dfe.legend.align = "ur" container_jitter_dist = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_jitter_dist.add(plot_jitter_dist_chnl) container_jitter_dist.add(plot_jitter_dist_tx) container_jitter_dist.add(plot_jitter_dist_ctle) container_jitter_dist.add(plot_jitter_dist_dfe) self.plots_jitter_dist = container_jitter_dist # - Jitter Spectrums tab plot_jitter_spec_chnl = Plot(plotdata) plot_jitter_spec_chnl.plot(("f_MHz", "jitter_spectrum_chnl"), type="line", color="blue", name="Total") plot_jitter_spec_chnl.plot(("f_MHz", "jitter_ind_spectrum_chnl"), type="line", color="red", name="Data Independent") plot_jitter_spec_chnl.plot(("f_MHz", "thresh_chnl"), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_chnl.title = post_chnl_str plot_jitter_spec_chnl.index_axis.title = "Frequency (MHz)" plot_jitter_spec_chnl.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_chnl.tools.append( PanTool(plot_jitter_spec_chnl, constrain=True, constrain_key=None, constrain_direction="x")) zoom_jitter_spec_chnl = ZoomTool(plot_jitter_spec_chnl, tool_mode="range", axis="index", always_on=False) plot_jitter_spec_chnl.overlays.append(zoom_jitter_spec_chnl) plot_jitter_spec_chnl.legend.visible = True plot_jitter_spec_chnl.legend.align = "lr" plot_jitter_spec_tx = Plot(plotdata) plot_jitter_spec_tx.plot(("f_MHz", "jitter_spectrum_tx"), type="line", color="blue", name="Total") plot_jitter_spec_tx.plot(("f_MHz", "jitter_ind_spectrum_tx"), type="line", color="red", name="Data Independent") plot_jitter_spec_tx.plot(("f_MHz", "thresh_tx"), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_tx.title = post_tx_str plot_jitter_spec_tx.index_axis.title = "Frequency (MHz)" plot_jitter_spec_tx.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_tx.value_range.low_setting = -40.0 plot_jitter_spec_tx.index_range = plot_jitter_spec_chnl.index_range # Zoom x-axes in tandem. plot_jitter_spec_tx.legend.visible = True plot_jitter_spec_tx.legend.align = "lr" plot_jitter_spec_chnl.value_range = plot_jitter_spec_tx.value_range plot_jitter_spec_ctle = Plot(plotdata) plot_jitter_spec_ctle.plot(("f_MHz", "jitter_spectrum_ctle"), type="line", color="blue", name="Total") plot_jitter_spec_ctle.plot(("f_MHz", "jitter_ind_spectrum_ctle"), type="line", color="red", name="Data Independent") plot_jitter_spec_ctle.plot(("f_MHz", "thresh_ctle"), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_ctle.title = post_ctle_str plot_jitter_spec_ctle.index_axis.title = "Frequency (MHz)" plot_jitter_spec_ctle.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_ctle.index_range = plot_jitter_spec_chnl.index_range # Zoom x-axes in tandem. plot_jitter_spec_ctle.legend.visible = True plot_jitter_spec_ctle.legend.align = "lr" plot_jitter_spec_ctle.value_range = plot_jitter_spec_tx.value_range plot_jitter_spec_dfe = Plot(plotdata) plot_jitter_spec_dfe.plot(("f_MHz_dfe", "jitter_spectrum_dfe"), type="line", color="blue", name="Total") plot_jitter_spec_dfe.plot(("f_MHz_dfe", "jitter_ind_spectrum_dfe"), type="line", color="red", name="Data Independent") plot_jitter_spec_dfe.plot(("f_MHz_dfe", "thresh_dfe"), type="line", color="magenta", name="Pj Threshold") plot_jitter_spec_dfe.title = post_dfe_str plot_jitter_spec_dfe.index_axis.title = "Frequency (MHz)" plot_jitter_spec_dfe.value_axis.title = "|FFT(TIE)| (dBui)" plot_jitter_spec_dfe.index_range = plot_jitter_spec_chnl.index_range # Zoom x-axes in tandem. plot_jitter_spec_dfe.legend.visible = True plot_jitter_spec_dfe.legend.align = "lr" plot_jitter_spec_dfe.value_range = plot_jitter_spec_tx.value_range container_jitter_spec = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_jitter_spec.add(plot_jitter_spec_chnl) container_jitter_spec.add(plot_jitter_spec_tx) container_jitter_spec.add(plot_jitter_spec_ctle) container_jitter_spec.add(plot_jitter_spec_dfe) self.plots_jitter_spec = container_jitter_spec # - Bathtub Curves tab plot_bathtub_chnl = Plot(plotdata) plot_bathtub_chnl.plot(("jitter_bins", "bathtub_chnl"), type="line", color="blue") plot_bathtub_chnl.value_range.high_setting = 0 plot_bathtub_chnl.value_range.low_setting = -18 plot_bathtub_chnl.value_axis.tick_interval = 3 plot_bathtub_chnl.title = post_chnl_str plot_bathtub_chnl.index_axis.title = "Time (ps)" plot_bathtub_chnl.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_tx = Plot(plotdata) plot_bathtub_tx.plot(("jitter_bins", "bathtub_tx"), type="line", color="blue") plot_bathtub_tx.value_range.high_setting = 0 plot_bathtub_tx.value_range.low_setting = -18 plot_bathtub_tx.value_axis.tick_interval = 3 plot_bathtub_tx.title = post_tx_str plot_bathtub_tx.index_axis.title = "Time (ps)" plot_bathtub_tx.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_ctle = Plot(plotdata) plot_bathtub_ctle.plot(("jitter_bins", "bathtub_ctle"), type="line", color="blue") plot_bathtub_ctle.value_range.high_setting = 0 plot_bathtub_ctle.value_range.low_setting = -18 plot_bathtub_ctle.value_axis.tick_interval = 3 plot_bathtub_ctle.title = post_ctle_str plot_bathtub_ctle.index_axis.title = "Time (ps)" plot_bathtub_ctle.value_axis.title = "Log10(P(Transition occurs inside.))" plot_bathtub_dfe = Plot(plotdata) plot_bathtub_dfe.plot(("jitter_bins", "bathtub_dfe"), type="line", color="blue") plot_bathtub_dfe.value_range.high_setting = 0 plot_bathtub_dfe.value_range.low_setting = -18 plot_bathtub_dfe.value_axis.tick_interval = 3 plot_bathtub_dfe.title = post_dfe_str plot_bathtub_dfe.index_axis.title = "Time (ps)" plot_bathtub_dfe.value_axis.title = "Log10(P(Transition occurs inside.))" container_bathtub = GridPlotContainer(shape=(2, 2), spacing=(PLOT_SPACING, PLOT_SPACING)) container_bathtub.add(plot_bathtub_chnl) container_bathtub.add(plot_bathtub_tx) container_bathtub.add(plot_bathtub_ctle) container_bathtub.add(plot_bathtub_dfe) self.plots_bathtub = container_bathtub update_eyes(self)
def setup_plots(self): self.screen = Plot(self.data, resizable="hv", padding=0, bgcolor="lightgray", border_visible=False) self.screen.index_grid.visible = False self.screen.value_grid.visible = False px = self.process.capture.pixelsize w, h = self.process.capture.width, self.process.capture.height # value_range last, see set_range() self.screen.index_range.low_setting = -w/2*px self.screen.index_range.high_setting = w/2*px self.screen.value_range.low_setting = -h/2*px self.screen.value_range.high_setting = h/2*px self.horiz = Plot(self.data, resizable="h", padding=0, height=100, bgcolor="lightgray", border_visible=False) self.horiz.value_mapper.range.low_setting = \ -.1*self.process.capture.maxval self.horiz.index_range = self.screen.index_range self.vert = Plot(self.data, orientation="v", resizable="v", padding=0, width=100, bgcolor="lightgray", border_visible=False) for p in self.horiz, self.vert: p.index_axis.visible = False p.value_axis.visible = False p.index_grid.visible = True p.value_grid.visible = False self.vert.value_mapper.range.low_setting = \ -.1*self.process.capture.maxval self.vert.index_range = self.screen.value_range #self.vert.value_range = self.horiz.value_range self.mini = Plot(self.data, width=100, height=100, resizable="", padding=0, bgcolor="lightgray", border_visible=False) self.mini.index_axis.visible = False self.mini.value_axis.visible = False self.label = PlotLabel(component=self.mini, overlay_position="inside left", font="modern 10", text=self.process.text) self.mini.overlays.append(self.label) self.plots = GridPlotContainer(shape=(2, 2), padding=0, spacing=(5, 5), use_backbuffer=True, bgcolor="lightgray") self.plots.component_grid = [[self.vert, self.screen], [self.mini, self.horiz ]] self.screen.overlays.append(ZoomTool(self.screen, x_max_zoom_factor=1e2, y_max_zoom_factor=1e2, x_min_zoom_factor=0.5, y_min_zoom_factor=0.5, zoom_factor=1.2)) self.screen.tools.append(PanTool(self.screen)) self.plots.tools.append(SaveTool(self.plots, filename="bullseye.pdf")) self.asum = Plot(self.data, padding=0, height=100, bgcolor="lightgray", title="major axis", border_visible=False) self.bsum = Plot(self.data, padding=0, height=100, bgcolor="lightgray", title="minor axis", border_visible=False) for p in self.asum, self.bsum: p.value_axis.visible = False p.value_grid.visible = False p.title_font = "modern 10" p.title_position = "left" p.title_angle = 90 # lock scales #self.bsum.value_range = self.asum.value_range #self.bsum.index_range = self.asum.index_range self.abplots = VPlotContainer(padding=20, spacing=20, use_backbuffer=True,bgcolor="lightgray", fill_padding=True) self.abplots.add(self.bsum, self.asum)
def _plot2(self): print"...plotting line scans" title = str(self.plotE['plot']) + str(self.plotE["notes"]["start"]) self.plotdata5 = ArrayPlotData(imagedata = self.plotE['data']) self._image_index = GridDataSource(array([]), array([]), sort_order=("ascending","ascending")) self.xs = linspace(self.plotE["range"][0][0], self.plotE["range"][0][1], self.plotE["shape"][0]) self.ys = linspace(self.plotE["range"][1][0], self.plotE["range"][1][1], self.plotE["shape"][1]) self._image_index.set_data(self.xs, self.ys) image_index_range = DataRange2D(self._image_index) self._image_value = ImageData(data=array([]), value_depth=1) self._image_value.data = self.plotE['data'] image_value_range = DataRange1D(self._image_value) s = "" f = "" if self.x_s: s = "X" if self.y_s: s = "Y" if self.z_s: s = "Z" if self.x_f: f = "X" if self.y_f: f = "Y" if self.z_f: f = "Z" self.plot1lines = Plot(self.plotdata5, title = title) self.plot1lines.img_plot("imagedata", xbounds = (self.plotE["range"][0][0],self.plotE["range"][0][1]), ybounds = (self.plotE["range"][1][0],self.plotE["range"][1][1]), colormap=jet) img_plot = self.plot1lines.img_plot("imagedata")[0] imgtool = ImageInspectorTool(img_plot) img_plot.tools.append(imgtool) overlay = ImageInspectorOverlay(component=img_plot, image_inspector=imgtool, bgcolor="white", border_visible=True) self.plot1lines.overlays.append(overlay) ##ADD TOOLS self.plot1lines.tools.append(PanTool(self.plot1lines)) zoom1 = ZoomTool(component=self.plot1lines, tool_mode="box", always_on=False) self.plot1lines.overlays.append(zoom1) self.plot1lines.overlays.append(LineInspector(component=self.plot1lines, axis='index_x', inspect_mode="indexed", write_metadata=True, is_listener=False, #constrain_key="right", color="white")) self.plot1lines.overlays.append(LineInspector(component=self.plot1lines, axis='index_y', inspect_mode="indexed", write_metadata=True, color="white", is_listener=False)) ##ADD COLORBAR self.colorbar5 = ColorBar(index_mapper=LinearMapper(range=self.plot1lines.color_mapper.range), color_mapper=self.plot1lines.color_mapper, orientation='v', resizable='v', width=20, padding=5) self.colorbar5.plot = self.plot1lines self.colorbar5.tools.append(PanTool(self.colorbar5, constrain_direction="y", constrain=True)) self.zoom_overlay5 = ZoomTool(self.colorbar5, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar5.overlays.append(self.zoom_overlay5) self.pd = ArrayPlotData(line_index = array([]), line_value = array([])) self.slow_plot = Plot(self.pd, title = "Slowline : " + self.slowline) self.slow_plot.plot(("line_index", "line_value"), line_style='solid') self.pd.set_data("line_index2", array([])) self.pd.set_data("line_value2", array([])) self.fast_plot = Plot(self.pd, title = "Fastline : " + self.fastline) self.fast_plot.plot(("line_index2", "line_value2"), line_style='solid') self.pd.set_data("line_index", self.xs) self.pd.set_data("line_index2", self.ys) self.pd.set_data("line_value", self._image_value.data[self.fastscanline,:]) self.pd.set_data("line_value2", self._image_value.data[:,self.slowscanline]) self.colorbar5.padding= 0 self.colorbar5.padding_left = 15 #self.colorbar5.height = 400 self.colorbar5.padding_top =50 self.colorbar5.padding_bottom = 0 self.colorbar5.padding_right = 25 self.colorbar5.padding_left = 50 self.plot1lines.width = 300 self.plot1lines.padding_top = 50 self.plot1lines.index_axis.title = 'fast axis (um)' self.plot1lines.value_axis.title = 'slow axis (um)' self.slow_plot.width = 100 self.slow_plot.padding_right = 20 self.fast_plot.width = 100 self.fast_plot.padding_right = 20 self.container2 = GridPlotContainer(shape = (1,2), spacing = ((0,0)), use_backbuffer=True, valign = 'top', halign = 'center', bgcolor = 'white') self.container3 = GridPlotContainer(shape = (2,1), spacing = (0,0), use_backbuffer=True, valign = 'top', halign = 'center', bgcolor = 'grey') self.container4 = GridPlotContainer(shape = (1,2), spacing = (0,0), use_backbuffer=True, valign = 'top', halign = 'center', bgcolor = 'grey') self.container2.add(self.colorbar5) self.container3.add(self.fast_plot) self.container3.add(self.slow_plot) self.container4.add(self.container3) self.container4.add(self.plot1lines) self.container2.add(self.container4) self.LineScans = self.container2 self._readline_fired() self._scale_set_fired()
def _plot(self): print "...plotting" self.notes = "" for key, value in self.plotA["notes"].iteritems() : self.notes += str(key) + " " + str(value)+ "\n" self.container1 = GridPlotContainer(shape = (2,4), spacing = (0,0), use_backbuffer=True, valign = 'top', bgcolor = 'white') print"\t assigning data" self.plotdata1 = ArrayPlotData(imagedata = self.plotA["data"]) self.plotdata2 = ArrayPlotData(imagedata = self.plotB["data"]) self.plotdata3 = ArrayPlotData(imagedata = self.plotC["data"]) self.plotdata4 = ArrayPlotData(imagedata = self.plotD["data"]) print"\t calling names" self.plot1 = Plot(self.plotdata1, title = self.plotA["plot"]+ str(self.plotA["notes"]["start"])) self.plot2 = Plot(self.plotdata2, title = self.plotB["plot"]) self.plot3 = Plot(self.plotdata3, title = self.plotC["plot"]) self.plot4 = Plot(self.plotdata4, title = self.plotD["plot"]) self.plot1.img_plot("imagedata", xbounds = (self.plotA["range"][0][0],self.plotA["range"][0][1]), ybounds = (self.plotA["range"][1][0],self.plotA["range"][1][1])) self.plot2.img_plot("imagedata", xbounds = (self.plotB["range"][0][0],self.plotB["range"][0][1]), ybounds = (self.plotB["range"][1][0],self.plotB["range"][1][1])) self.plot3.img_plot("imagedata", xbounds = (self.plotC["range"][0][0],self.plotC["range"][0][1]), ybounds = (self.plotC["range"][1][0],self.plotC["range"][1][1])) self.plot4.img_plot("imagedata", xbounds = (self.plotD["range"][0][0],self.plotD["range"][0][1]), ybounds = (self.plotD["range"][1][0],self.plotD["range"][1][1])) # self.scale = Str(self.plot3.color_mapper.high) # plot1.index_axis.title = str(f) + ' (um)' ##ADD TOOLS self.plot1.tools.append(PanTool(self.plot1)) zoom1 = ZoomTool(component=self.plot1, tool_mode="box", always_on=False) self.plot1.overlays.append(zoom1) self.plot2.tools.append(PanTool(self.plot2)) zoom2 = ZoomTool(component=self.plot2, tool_mode="box", always_on=False) self.plot2.overlays.append(zoom2) self.plot3.tools.append(PanTool(self.plot3)) zoom3 = ZoomTool(component=self.plot3, tool_mode="box", always_on=False) self.plot3.overlays.append(zoom3) self.plot4.tools.append(PanTool(self.plot4)) zoom4 = ZoomTool(component=self.plot4, tool_mode="box", always_on=False) self.plot4.overlays.append(zoom4) ##ADD COLORBARS self.colorbar1 = ColorBar(index_mapper=LinearMapper(range=self.plot1.color_mapper.range), color_mapper=self.plot1.color_mapper, orientation='v', resizable='v', width=20, padding=5) self.colorbar1.plot = self.plot1 self.colorbar1.padding_left = 45 self.colorbar1.padding_right= 5 self.colorbar2 = ColorBar(index_mapper=LinearMapper(range=self.plot2.color_mapper.range), color_mapper=self.plot2.color_mapper, orientation='v', resizable='v', width=20, padding=5) self.colorbar2.plot = self.plot2 self.colorbar2.padding_left = 10 self.colorbar3 = ColorBar(index_mapper=LinearMapper(range=self.plot3.color_mapper.range), color_mapper=self.plot3.color_mapper, orientation='v', resizable='v', width=20, padding=5) self.colorbar3.plot = self.plot3 self.colorbar3.padding_left = 45 self.colorbar3.padding_right= 5 self.colorbar4 = ColorBar(index_mapper=LinearMapper(range=self.plot4.color_mapper.range), color_mapper=self.plot4.color_mapper, orientation='v', resizable='v', width=20, padding=5) self.colorbar4.plot = self.plot4 self.colorbar4.padding_left = 15 self.colorbar1.tools.append(PanTool(self.colorbar1, constrain_direction="y", constrain=True)) self.zoom_overlay1 = ZoomTool(self.colorbar1, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar1.overlays.append(self.zoom_overlay1) self.colorbar2.tools.append(PanTool(self.colorbar2, constrain_direction="y", constrain=True)) self.zoom_overlay2 = ZoomTool(self.colorbar2, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar2.overlays.append(self.zoom_overlay2) self.colorbar3.tools.append(PanTool(self.colorbar3, constrain_direction="y", constrain=True)) self.zoom_overlay3 = ZoomTool(self.colorbar3, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar3.overlays.append(self.zoom_overlay3) self.colorbar4.tools.append(PanTool(self.colorbar4, constrain_direction="y", constrain=True)) self.zoom_overlay4 = ZoomTool(self.colorbar4, axis="index", tool_mode="range", always_on=True, drag_button="right") self.colorbar4.overlays.append(self.zoom_overlay4) self.container1.add(self.colorbar1) self.container1.add(self.plot1) self.container1.add(self.plot2) self.container1.add(self.colorbar2) self.container1.add(self.colorbar3) self.container1.add(self.plot3) self.container1.add(self.plot4) self.container1.add(self.colorbar4) self.plot1.padding_right = 5 self.plot2.padding_left = 5 self.plot1.padding_bottom = 15 self.plot2.padding_bottom = 15 self.plot3.padding_top = 15 self.plot4.padding_top = 15 self.plot1.x_axis.orientation = "top" self.plot2.x_axis.orientation = "top" self.plot2.y_axis.orientation = "right" self.plot3.padding_right = 5 self.plot4.padding_left = 5 self.plot4.y_axis.orientation = "right" self.colorbar1.padding_top = self.plot1.padding_top self.colorbar1.padding_bottom = self.plot1.padding_bottom self.colorbar2.padding_top = self.plot2.padding_top self.colorbar2.padding_bottom = self.plot2.padding_bottom self.colorbar3.padding_top = self.plot3.padding_top self.colorbar3.padding_bottom = self.plot3.padding_bottom self.colorbar4.padding_top = self.plot4.padding_top self.colorbar4.padding_bottom = self.plot4.padding_bottom imgtool = ImageInspectorTool(self.plot1) self.plot1.tools.append(imgtool) overlay = ImageInspectorOverlay(component=self.plot1, image_inspector=imgtool, bgcolor="white", border_visible=True) self.plot1.overlays.append(overlay) self.plot = self.container1 self._plot2()