def awesome(rng, **traits): """ Generator function for a Chaco color scale that has low-intensity contrast. """ stream = pkg_resources.resource_stream(__name__, 'data/awesomecolormap.csv') return ColorMapper.from_palette_array(N.loadtxt(stream, delimiter=','), range=rng, **traits)
def awesome(rng, **traits): """ Generator function for a Chaco color scale that has low-intensity contrast. """ return ColorMapper.from_palette_array(N.loadtxt( '../data/awesomecolormap.csv', delimiter=','), range=rng, **traits)
def test_alpha_palette(self): """ Create a colormap with a varying alpha channel from a palette array. """ cm = ColorMapper.from_palette_array([[0.0,0.0,0.0,0.5],[1.0,1.0,1.0,1.0]]) sd = {'alpha': [(0.0, 0.5, 0.5), (1.0, 1.0, 1.0)], 'blue': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'green': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'red': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)]} assert cm._segmentdata == sd
def setUp(self): """ Set up called before each test case. """ _gray_data = {'red': [(0., 0, 0), (1., 1.0, 1.0)], 'green': [(0., 0, 0), (1., 1.0, 1.0)], 'blue': [(0., 0, 0), (1., 1.0, 1.0)]} self.colormap = ColorMapper.from_segment_map(_gray_data) self.colormap.range = DataRange1D()
def test_alpha_segment_data(self): """ Create a colormap with a varying alpha channel from segment data. """ sd = {'alpha': [(0.0, 0.5, 0.5), (1.0, 1.0, 1.0)], 'blue': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'green': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'red': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)]} cm = ColorMapper.from_segment_map(sd) assert cm._segmentdata == sd
def bone(rng, **traits): """ Generator function for the 'bone' colormap. (Instead of faulty one in Chaco.) Data from Matplotlib. """ _bone_data = { 'red': ((0., 0., 0.), (0.746032, 0.652778, 0.652778), (1.0, 1.0, 1.0)), 'green': ((0., 0., 0.), (0.365079, 0.319444, 0.319444), (0.746032, 0.777778, 0.777778), (1.0, 1.0, 1.0)), 'blue': ((0., 0., 0.), (0.365079, 0.444444, 0.444444), (1.0, 1.0, 1.0))} return ColorMapper.from_segment_map(_bone_data, range=rng, **traits)
def chaco_gen(self): self.conn_mat=Plot(ArrayPlotData(imagedata=self.ds.adj_thresdiag)) cm=ColorMapper.from_palette_array(self.ds.opts.connmat_map._pl( xrange(256))) self.conn_mat.img_plot('imagedata',name='connmatplot',colormap=cm) self.conn_mat.tools.append(ZoomTool(self.conn_mat)) self.conn_mat.tools.append(PanTool(self.conn_mat)) self.xa=ColorfulAxis(self.conn_mat,self.ds.node_colors,'x') self.ya=ColorfulAxis(self.conn_mat,self.ds.node_colors,'y') self.conn_mat.underlays=[self.xa,self.ya]
def bone(rng, **traits): """ Generator function for the 'bone' colormap. (Instead of faulty one in Chaco.) Data from Matplotlib. """ _bone_data = { 'red': ((0., 0., 0.), (0.746032, 0.652778, 0.652778), (1.0, 1.0, 1.0)), 'green': ((0., 0., 0.), (0.365079, 0.319444, 0.319444), (0.746032, 0.777778, 0.777778), (1.0, 1.0, 1.0)), 'blue': ((0., 0., 0.), (0.365079, 0.444444, 0.444444), (1.0, 1.0, 1.0)) } return ColorMapper.from_segment_map(_bone_data, range=rng, **traits)
def chaco_gen(self): self.conn_mat = Plot(ArrayPlotData(imagedata=self.ds.adj_thresdiag)) cm = ColorMapper.from_palette_array( self.ds.opts.connmat_map._pl(xrange(256))) self.conn_mat.img_plot('imagedata', name='connmatplot', colormap=cm) self.conn_mat.tools.append(ZoomTool(self.conn_mat)) self.conn_mat.tools.append(PanTool(self.conn_mat)) self.xa = ColorfulAxis(self.conn_mat, self.ds.node_colors, 'x') self.ya = ColorfulAxis(self.conn_mat, self.ds.node_colors, 'y') self.conn_mat.underlays = [self.xa, self.ya]
def empty_gen(self): from chaco.api import Greys img = np.zeros((self.ds.nr_labels,self.ds.nr_labels)) self.conn_mat=Plot(ArrayPlotData(imagedata=img)) cm=ColorMapper.from_palette_array(self.ds.opts.connmat_map._pl( xrange(256))) self.conn_mat.img_plot('imagedata',name='connmatplot',colormap=cm) self.conn_mat.tools.append(ZoomTool(self.conn_mat)) self.conn_mat.tools.append(PanTool(self.conn_mat)) self.xa=ColorfulAxis(self.conn_mat,self.ds.node_colors,'x') self.ya=ColorfulAxis(self.conn_mat,self.ds.node_colors,'y') self.conn_mat.underlays=[self.xa,self.ya]
def empty_gen(self): from chaco.api import Greys img = np.zeros((self.ds.nr_labels, self.ds.nr_labels)) self.conn_mat = Plot(ArrayPlotData(imagedata=img)) cm = ColorMapper.from_palette_array( self.ds.opts.connmat_map._pl(xrange(256))) self.conn_mat.img_plot('imagedata', name='connmatplot', colormap=cm) self.conn_mat.tools.append(ZoomTool(self.conn_mat)) self.conn_mat.tools.append(PanTool(self.conn_mat)) self.xa = ColorfulAxis(self.conn_mat, self.ds.node_colors, 'x') self.ya = ColorfulAxis(self.conn_mat, self.ds.node_colors, 'y') self.conn_mat.underlays = [self.xa, self.ya]
def test_array_factory(self): """ Test that the array factory creates valid colormap. """ colors = array([[0.0,0.0,0.0], [1.0,1.0,1.0]]) cm = ColorMapper.from_palette_array(colors) cm.range = DataRange1D() ar = ArrayDataSource(array([0.0, 0.5, 1.0])) cm.range.add(ar) b = cm.map_screen(ar.get_data()) cm.range.remove(ar) expected = array([0.0, 0.5, 1.0]) self.assertTrue(allclose(ravel(b[:,:1]), expected, atol=0.02), "Array factory failed. Expected %s. Got %s" % (expected, b[:,:1])) return
def isoluminant(rng, num_cycles=1, num_colors=256, reverse=False, **traits): """ Generator function for a Chaco color scale that cycles through the hues @num_cycles times, while maintaining monotonic luminance (i.e., if it is printed in black and white, then it will be perceptually equal to a linear grayscale. Ported from the Matlab(R) code from: McNames, J. (2006). An effective color scale for simultaneous color and gray-scale publications. IEEE Signal Processing Magazine 23(1), 82--87. """ # Triangular window function window = N.sqrt(3.0) / 8.0 * N.bartlett(num_colors) # Independent variable t = N.linspace(N.sqrt(3.0), 0.0, num_colors) # Initial values operand = (t - N.sqrt(3.0) / 2.0) * num_cycles * 2.0 * N.pi / N.sqrt(3.0) r0 = t g0 = window * N.cos(operand) b0 = window * N.sin(operand) # Convert RG to polar, rotate, and convert back r1, g1 = _rotate(r0, g0, N.arcsin(1.0 / N.sqrt(3.0))) b1 = b0 # Convert RB to polar, rotate, and convert back r2, b2 = _rotate(r1, b1, N.pi / 4.0) g2 = g1 # Ensure finite precision effects don't exceed unit cube boundaries r = r2.clip(0.0, 1.0) g = g2.clip(0.0, 1.0) b = b2.clip(0.0, 1.0) the_map = N.vstack((r, g, b)).T return ColorMapper.from_palette_array(the_map[::-1 if reverse else 1], range=rng, **traits)
def import_colormap(self, info): """Implements the "File / Import" menu item.""" dialog = FileDialog(parent=info.ui.control, action="open", title="Import colormap file") if dialog.open() == OK: if dialog.path.endswith(".cmap"): # Read the colormap data file. # First read the name from the first line, then use # ColorMap.from_file() to actually load the color map. with open(dialog.path, "r") as f: name = f.readline().strip() color_mapper = ColorMapper.from_file(dialog.path) info.object._load_color_mapper(name, color_mapper) elif dialog.path.endswith(".py"): # Look for a function that is a color map factory that was # created by this application; these are functions with the # attribute `_colormap_data`. # Get the basename, and chop off '.py'. name = basename(dialog.path)[:-3] # Try to read the python file. try: f = open(dialog.path, "r") except IOError: error(None, 'Unable to read "%s"' % dialog.path, "File Error") return # Try to import the script. module = types.ModuleType(str(name)) module.__file__ = dialog.path try: exec f in module.__dict__ except Exception, e: error(None, ('An error occurred while importing "%s".\n\n%s' % (dialog.path, e)), "Import Error") return finally: f.close()
def change_colormap(self): self.conn_mat.color_mapper = ColorMapper.from_palette_array( self.ds.opts.connmat_map._pl(xrange(256))) self.conn_mat.request_redraw()
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 awesome(rng, **traits): """ Generator function for a Chaco color scale that has low-intensity contrast. """ return ColorMapper.from_palette_array(N.loadtxt("../data/awesomecolormap.csv", delimiter=","), range=rng, **traits)
def _get_colormapper(self): segment_map = self._segment_map() colormapper = ColorMapper.from_segment_map(segment_map, range=self.color_range) return colormapper