def __init__(self): # Create the data and the PlotData object price1 = random_walk(100) price2 = random_walk(100, start=50) times = np.arange(100) plotdata = ArrayPlotData(times=times, price1=price1, price2=price2) # Create the scatter plot plot1 = Plot(plotdata) plot1.plot(("times", "price1"), type="line", color="blue") plot1.plot(("times", "price1"), type="scatter", color="blue") plot2 = Plot(plotdata) plot2.plot(("times", "price2"), type="line", color="green") plot2.plot(("times", "price2"), type="scatter", color="green") scatterplot = Plot(plotdata) scatterplot.plot(("price2", "price1"), type="scatter", color="green") plot1.tools.append(PanTool(plot1)) plot1.tools.append(ZoomTool(plot1)) plot2.tools.append(PanTool(plot2)) plot2.tools.append(ZoomTool(plot2)) scatterplot.tools.append(PanTool(scatterplot)) scatterplot.tools.append(ZoomTool(scatterplot)) plot1.index_range = plot2.index_range lineplots = VPlotContainer(plot1, plot2) container = HPlotContainer(lineplots, scatterplot) self.plot = container self.plotdata = plotdata
def _container_default(self): # Create the data and the PlotData object x = linspace(-14, 14, 100) y = sin(x) * x**3 plotdata = ArrayPlotData(x = x, y = y) # Create the scatter plot scatter = Plot(plotdata) scatter.plot(("x", "y"), type="scatter", color="blue") # Create the line plot line = Plot(plotdata) line.plot(("x", "y"), type="line", color="blue") # Add pan/zoom so we can see they are connected scatter.tools.append(PanTool(scatter)) scatter.tools.append(ZoomTool(scatter)) line.tools.append(PanTool(line)) line.tools.append(ZoomTool(line)) # Set the two plots' ranges to be the same scatter.index_range = line.index_range # Create a horizontal container and put the two plots inside it return HPlotContainer(scatter, line)
def _container_default(self): # Create the data and the PlotData object x = linspace(-14, 14, 100) y = sin(x) * x ** 3 plotdata = ArrayPlotData(x=x, y=y) # Create the scatter plot scatter = Plot(plotdata) scatter.plot(("x", "y"), type="scatter", color="blue") # Create the line plot line = Plot(plotdata) line.plot(("x", "y"), type="line", color="blue") # Add pan/zoom so we can see they are connected scatter.tools.append(PanTool(scatter)) scatter.tools.append(ZoomTool(scatter)) line.tools.append(PanTool(line)) line.tools.append(ZoomTool(line)) # Set the two plots' ranges to be the same scatter.index_range = line.index_range # Create a horizontal container and put the two plots inside it return HPlotContainer(scatter, line)
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 test_range_change(self): arr = arange(10) data = ArrayPlotData(x=arr, y=arr) plot = Plot(data) renderer = plot.plot(('x', 'y'))[0] new_range = DataRange1D() old_range = plot.index_range self.assertIsNot(old_range, new_range) self.assertIs(renderer.index_range, old_range) plot.index_range = new_range self.assertIs(plot.index_range, new_range) self.assertIs(renderer.index_range, new_range)
def _create_plot_component(): # Create the index numpoints = 100 low = -5 high = 15.0 x = arange(low, high, (high - low) / numpoints) plotdata = ArrayPlotData(x=x, y1=jn(0, x), y2=jn(1, x)) # Create the left plot left_plot = Plot(plotdata) left_plot.x_axis.title = "X" left_plot.y_axis.title = "j0(x)" renderer = left_plot.plot(("x", "y1"), type="line", color="blue", width=2.0)[0] renderer.overlays.append( LineInspector(renderer, axis='value', write_metadata=True, is_listener=True)) renderer.overlays.append( LineInspector(renderer, axis="index", write_metadata=True, is_listener=True)) left_plot.overlays.append(ZoomTool(left_plot, tool_mode="range")) left_plot.tools.append(PanTool(left_plot)) # Create the right plot right_plot = Plot(plotdata) right_plot.index_range = left_plot.index_range right_plot.orientation = "v" right_plot.x_axis.title = "j1(x)" right_plot.y_axis.title = "X" renderer2 = right_plot.plot(("x", "y2"), type="line", color="red", width=2.0)[0] renderer2.index = renderer.index renderer2.overlays.append( LineInspector(renderer2, write_metadata=True, is_listener=True)) renderer2.overlays.append( LineInspector(renderer2, axis="value", is_listener=True)) right_plot.overlays.append(ZoomTool(right_plot, tool_mode="range")) right_plot.tools.append(PanTool(right_plot)) container = HPlotContainer(background="lightgray") container.add(left_plot) container.add(right_plot) return 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 _create_plot_component(): # Create the index numpoints = 100 low = -5 high = 15.0 x = arange(low, high, (high - low) / numpoints) plotdata = ArrayPlotData(x=x, y1=jn(0, x), y2=jn(1, x)) # Create the left plot left_plot = Plot(plotdata) left_plot.x_axis.title = "X" left_plot.y_axis.title = "j0(x)" renderer = left_plot.plot(("x", "y1"), type="line", color="blue", width=2.0)[0] renderer.overlays.append(LineInspector(renderer, axis='value', write_metadata=True, is_listener=True)) renderer.overlays.append(LineInspector(renderer, axis="index", write_metadata=True, is_listener=True)) left_plot.overlays.append(ZoomTool(left_plot, tool_mode="range")) left_plot.tools.append(PanTool(left_plot)) # Create the right plot right_plot = Plot(plotdata) right_plot.index_range = left_plot.index_range right_plot.orientation = "v" right_plot.x_axis.title = "j1(x)" right_plot.y_axis.title = "X" renderer2 = right_plot.plot(("x", "y2"), type="line", color="red", width=2.0)[0] renderer2.index = renderer.index renderer2.overlays.append(LineInspector(renderer2, write_metadata=True, is_listener=True)) renderer2.overlays.append(LineInspector(renderer2, axis="value", is_listener=True)) right_plot.overlays.append(ZoomTool(right_plot, tool_mode="range")) right_plot.tools.append(PanTool(right_plot)) container = HPlotContainer(background="lightgray") container.add(left_plot) container.add(right_plot) return container
def _mic_spectrum_plot_default(self): plot = Plot(self.tf_data) plot.plot(('frequency', 'spectrum'), type='line', color='black', index_scale='log') plot.index_range = DataRange1D(low_setting=500, high_setting=50e3) plot.underlays = [] axis = PlotAxis(orientation='bottom', component=plot, title='Frequency (Hz)') plot.underlays.append(axis) axis = PlotAxis(orientation='left', component=plot, title='Exp. mic. (dB re 1mV)') plot.underlays.append(axis) grid = PlotGrid(mapper=plot.index_mapper, component=plot, orientation='vertical', line_style='dot', line_color='lightgray') plot.underlays.append(grid) grid = PlotGrid(mapper=plot.value_mapper, component=plot, orientation='horizontal', line_style='dot', line_color='lightgray') plot.underlays.append(grid) return plot
def __init__(self): 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") self.container = HPlotContainer(scatter, line) scatter.tools.append(PanTool(scatter)) scatter.tools.append(ZoomTool(scatter)) line.tools.append(PanTool(line)) line.tools.append(ZoomTool(line)) #scatter.range2d = line.range2d scatter.index_range = line.index_range
def __init__(self): # Create the data and the PlotData object price1 = random_walk(100) price2 = random_walk(100, start=50) times = np.arange(100) plotdata = ArrayPlotData(times=times, price1=price1, price2=price2) # Create the scatter plot plot1 = Plot(plotdata) line1 = plot1.plot(("times", "price1"), type="line", color="blue")[0] scatter1 = plot1.plot(("times", "price1"), type="scatter", color="blue")[0] plot2 = Plot(plotdata) line2 = plot2.plot(("times", "price2"), type="line", color="green")[0] scatter2 = plot2.plot(("times", "price2"), type="scatter", color="green")[0] scatterplot = Plot(plotdata) scatterplot.plot(("price2", "price1"), type="scatter", color="green") #plot1.tools.append(PanTool(plot1)) plot1.tools.append(ZoomTool(plot1)) plot1.tools.append(RangeSelection(line1, auto_handle_event=False)) plot1.overlays.append(RangeSelectionOverlay(line1, metadata_name="selections")) plot1.overlays.append(RangeSelectionOverlay(line1, metadata_name="selections")) #plot2.tools.append(PanTool(plot2)) plot2.tools.append(ZoomTool(plot2)) plot2.tools.append(RangeSelection(line2, auto_handle_event=False)) plot2.overlays.append(RangeSelectionOverlay(line2, metadata_name="selections")) #scatterplot.tools.append(PanTool(scatterplot)) scatterplot.tools.append(ZoomTool(scatterplot)) plot1.index_range = plot2.index_range lineplots = VPlotContainer(plot1, plot2) container = HPlotContainer(lineplots, scatterplot) self.plot = container self.plotdata = plotdata
def _add_new_plot(self, new_data): code = self.data_provider.code if code in self.dataset.list_data(): create_new_plot = False else: create_new_plot = True self.dataset.set_data(code, new_data) if create_new_plot: new_plot = Plot(self.dataset) new_plot.plot(('dates', code), type='line') new_plot.tools.append(PanTool(new_plot)) tick_generator = ScalesTickGenerator(scale=CalendarScaleSystem()) new_plot.x_axis.tick_generator = tick_generator # connect the index of the first plot with the new plot first_plot = self.container.components[0] new_plot.index_range = first_plot.index_range self.container.add(new_plot) self.container.request_redraw()
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 create_hplot(self, key=None, mini=False): if mini: hpc = HPlotContainer(bgcolor='darkgrey', height=MINI_HEIGHT, resizable='h', padding=HPLOT_PADDING ) else: hpc = HPlotContainer(bgcolor='lightgrey', padding=HPLOT_PADDING, resizable='hv' ) # make slice plot for showing intesity profile of main plot #************************************************************ slice_plot = Plot(self.data, width=SLICE_PLOT_WIDTH, orientation="v", resizable="v", padding=MAIN_PADDING, padding_left=MAIN_PADDING_LEFT, padding_bottom=MAIN_PADDING_BOTTOM, bgcolor='beige', origin='top left' ) mini_slice = Plot(self.data, width=SLICE_PLOT_WIDTH, orientation="v", resizable="v", padding=MAIN_PADDING, padding_left=MAIN_PADDING_LEFT, padding_bottom=MAIN_PADDING_BOTTOM, bgcolor='beige', origin='top left' ) slice_plot.x_axis.visible = True slice_key = key + '_slice' ydata_key = key + '_y' slice_plot.plot((ydata_key, slice_key), name=slice_key) # make plot to show line at depth of cursor. y values constant slice_depth_key = key + '_depth' slice_plot.plot(('slice_depth_depth', 'slice_depth_y'), name=slice_depth_key, color='red') self.update_slice_depth_line_plot(slice_plot, depth=0) # make main plot for editing depth lines #************************************************************ main = Plot(self.data, border_visible=True, bgcolor='beige', origin='top left', padding=MAIN_PADDING, padding_left=MAIN_PADDING_LEFT, padding_bottom=MAIN_PADDING_BOTTOM ) if mini: #main.padding = MINI_PADDING main.padding_bottom = MINI_PADDING_BOTTOM # add intensity img to plot and get reference for line inspector #************************************************************ img_plot = main.img_plot(key, name=key, xbounds=self.model.xbounds[key], ybounds=self.model.ybounds[key], colormap=self._cmap )[0] # add line plots: use method since these may change #************************************************************ self.update_line_plots(key, main, update=True) self.plot_mask_array(key, main) # set slice plot index range to follow main plot value range #************************************************************ slice_plot.index_range = main.value_range # add vertical core lines to main plots and slices #************************************************************ # save pos and distance in session dict for view info and control for core in self.model.core_samples: # add boundarys to slice plot self.plot_core_depths(slice_plot, core, ref_depth_line=None) # add positions to main plots self.plot_core(main, core, ref_depth_line=None) # now add tools depending if it is a mini plot or not #************************************************************ if mini: # add range selection tool only # first add a reference line to attach it to reference = self.make_reference_plot() main.add(reference) main.plots['reference'] = [reference] # attache range selector to this plot range_tool = RangeSelection(reference) reference.tools.append(range_tool) range_overlay = RangeSelectionOverlay(reference, metadata_name="selections") reference.overlays.append(range_overlay) range_tool.on_trait_change(self._range_selection_handler, "selection") # add zoombox to mini plot main.plot(('zoombox_x', 'zoombox_y'), type='polygon', face_color=ZOOMBOX_COLOR, alpha=ZOOMBOX_ALPHA) # add to hplot and dict hpc.add(main, mini_slice) self.hplot_dict['mini'] = hpc else: # add zoom tools zoom = ZoomTool(main, tool_mode='box', axis='both', alpha=0.5, drag_button="left") main.tools.append(zoom) main.overlays.append(zoom) self.zoom_tools[key] = zoom main.value_mapper.on_trait_change(self.zoom_all_value, 'updated') main.index_mapper.on_trait_change(self.zoom_all_index, 'updated') # add line inspector and attach to freeze tool #********************************************* line_inspector = LineInspector(component=img_plot, axis='index_x', inspect_mode="indexed", is_interactive=True, write_metadata=True, metadata_name='x_slice', is_listener=True, color="white") img_plot.overlays.append(line_inspector) self.inspector_freeze_tool.tool_set.add(line_inspector) # add listener for changes to metadata made by line inspector #************************************************************ img_plot.on_trait_change(self.metadata_changed, 'index.metadata') # set slice plot index range to follow main plot value range #************************************************************ slice_plot.index_range = main.value_range # add clickable legend ; must update legend when depth_dict updated #****************************************************************** legend = Legend(component=main, padding=0, align="ur", font='modern 8') legend_highlighter = LegendHighlighter(legend, drag_button="right") legend.tools.append(legend_highlighter) self.legend_dict[key] = [legend, legend_highlighter] self.update_legend_plots(legend, main) legend.visible = False main.overlays.append(legend) legend_highlighter.on_trait_change(self.legend_moved, '_drag_state') # add pan tool pan_tool = PanTool(main, drag_button="right") main.tools.append(pan_tool) self.pan_tool_dict[key] = pan_tool # add main and slice plot to hplot container and dict #**************************************************** main.title = 'frequency = {} kHz'.format(key) main.title_font = TITLE_FONT hpc.add(main, slice_plot) self.hplot_dict[key] = hpc return hpc
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 _create_plot_component(): army_lat = np.column_stack([army['start_lat'], army['end_lat']]).reshape(-1) army_lon = np.column_stack([army['start_lon'], army['end_lon']]).reshape(-1) plot_data = ArrayPlotData( army_lon=army_lon, army_lat=army_lat, army_size=army['size'], army_color=army['direction'] * army["group"], towns_lat=towns['lat'], towns_lon=towns['lon'], towns=towns['town'], temp_lon=temperatures['lon'], temp=temperatures['temp'], temp_date=temperatures['date'], ) map_plot = Plot(plot_data) map_plot.x_grid = None map_plot.y_grid = None map_plot.x_axis.orientation = 'top' map_plot.x_axis.title = 'Longitude' map_plot.y_axis.title = 'Latitude' map_plot.title = "Minard's Map of Napoleon's Russian Campaign" map_plot._title.overlay_position = "inside top" map_plot._title.hjustify = "left" map_plot._title.vjustify = "bottom" map_plot.plot( ("army_lon", "army_lat", "army_color", "army_size"), type="cmap_segment", name="my_plot", color_mapper=viridis, border_visible=True, bgcolor="white", size_min=1.0, size_max=128.0, ) map_plot.plot( ("towns_lon", "towns_lat"), type="scatter", ) map_plot.plot( ("towns_lon", "towns_lat", "towns"), type="text", text_margin=4, h_position='right', text_offset=(4, 0), ) map_plot.plot_1d( ('temp_lon'), type='line_scatter_1d', alpha=0.5, line_style='dot', ) map_plot.index_range.high_setting = 38 map_plot.index_range.low_setting = 23 map_plot.value_range.high_setting = 56.0 map_plot.value_range.low_setting = 53.5 map_plot.tools.extend([ PanTool(map_plot), ZoomTool(map_plot), ]) temp_plot = Plot(plot_data, height=100) temp_plot.index_range = map_plot.index_range temp_plot.x_grid = None temp_plot.x_axis = None temp_plot.y_axis.orientation = 'right' temp_plot.y_axis.title = u'Temp (°Re)' temp_plot.plot( ('temp_lon', 'temp'), type='line', ) temp_plot.plot_1d( ('temp_lon'), type='line_scatter_1d', alpha=0.5, line_style='dot', ) temp_plot.plot_1d( ('temp_lon', 'temp_date'), type='textplot_1d', alpha=0.5, line_style='dot', alignment='bottom', ) temp_plot.value_range.high_setting = 5 temp_plot.value_range.low_setting = -35 container = VPlotContainer(temp_plot, map_plot) container.spacing = 0 map_plot.padding_bottom = 0 map_plot.padding_left = 70 map_plot.padding_right = 70 map_plot.padding_top = 50 temp_plot.padding_top = 0 temp_plot.padding_bottom = 15 temp_plot.padding_right = 70 temp_plot.padding_left = 70 temp_plot.height = 100 temp_plot.resizable = 'h' return container
def create_hplot(self, key=None, mini=False): if mini: hpc = HPlotContainer(bgcolor='darkgrey', height=MINI_HEIGHT, resizable='h', padding=0) else: hpc = HPlotContainer(bgcolor='lightgrey', padding=HPLOT_PADDING, resizable='hv') # make slice plot for showing intesity profile of main plot #************************************************************ slice_plot = Plot(self.data, width=SLICE_PLOT_WIDTH, orientation="v", resizable="v", padding=MAIN_PADDING, padding_left=MAIN_PADDING_LEFT, bgcolor='beige', origin='top left') slice_plot.x_axis.visible = False slice_key = key + '_slice' ydata_key = key + '_y' slice_plot.plot((ydata_key, slice_key), name=slice_key) # make main plot for editing depth lines #************************************************************ main = Plot( self.data, border_visible=True, bgcolor='beige', origin='top left', padding=MAIN_PADDING, padding_left=MAIN_PADDING_LEFT, ) if mini: main.padding = MINI_PADDING # add intensity img to plot and get reference for line inspector #************************************************************ img_plot = main.img_plot(key, name=key, xbounds=self.model.xbounds[key], ybounds=self.model.ybounds[key], colormap=self._cmap)[0] # add line plots: use method since these may change #************************************************************ self.update_line_plots(key, main, update=True) # set slice plot index range to follow main plot value range #************************************************************ slice_plot.index_range = main.value_range # add vertical core lines to main plots and slices #************************************************************ # save pos and distance in session dict for view info and control for core in self.model.core_samples: loc_index, loc, dist = self.model.core_info_dict[core.core_id] # add boundarys to slice plot ref_line = self.model.final_lake_depth self.plot_core_depths(slice_plot, core, ref_line, loc_index) # add positions to main plots self.plot_core(main, core, ref_line, loc_index, loc) # now add tools depending if it is a mini plot or not #************************************************************ if mini: # add range selection tool only # first add a reference line to attach it to reference = self.make_reference_plot() main.add(reference) # attache range selector to this plot range_tool = RangeSelection(reference) reference.tools.append(range_tool) range_overlay = RangeSelectionOverlay(reference, metadata_name="selections") reference.overlays.append(range_overlay) range_tool.on_trait_change(self._range_selection_handler, "selection") # add zoombox to mini plot main.plot(('zoombox_x', 'zoombox_y'), type='polygon', face_color=ZOOMBOX_COLOR, alpha=ZOOMBOX_ALPHA) # add to hplot and dict hpc.add(main) self.hplot_dict['mini'] = hpc else: # add zoom tools main.tools.append(PanTool(main)) zoom = ZoomTool(main, tool_mode='box', axis='both', alpha=0.5) main.tools.append(zoom) main.overlays.append(zoom) main.value_mapper.on_trait_change(self.zoom_all_value, 'updated') main.index_mapper.on_trait_change(self.zoom_all_index, 'updated') # add line inspector and attach to freeze tool #********************************************* line_inspector = LineInspector(component=img_plot, axis='index_x', inspect_mode="indexed", is_interactive=True, write_metadata=True, metadata_name='x_slice', is_listener=True, color="white") img_plot.overlays.append(line_inspector) self.inspector_freeze_tool.tool_set.add(line_inspector) # add listener for changes to metadata made by line inspector #************************************************************ img_plot.on_trait_change(self.metadata_changed, 'index.metadata') # set slice plot index range to follow main plot value range #************************************************************ slice_plot.index_range = main.value_range # add clickable legend ; must update legend when depth_dict updated #****************************************************************** legend = Legend(component=main, padding=0, align="ur", font='modern 8') legend_highlighter = LegendHighlighter(legend, drag_button="right") legend.tools.append(legend_highlighter) self.update_legend_plots(legend, main) legend.visible = False self.legend_dict[key] = [legend, legend_highlighter] main.overlays.append(legend) # add main and slice plot to hplot container and dict #**************************************************** main.title = 'frequency = {} kHz'.format(key) main.title_font = TITLE_FONT hpc.add(main, slice_plot) self.hplot_dict[key] = hpc return hpc