Exemple #1
0
def _create_plot_component():

    # Generate some data for the eye diagram.
    num_samples = 5000
    samples_per_symbol = 24
    y = demo_data(num_samples, samples_per_symbol)

    # Compute the eye diagram array.
    ybounds = (-0.25, 1.25)
    grid = grid_count(y,
                      2 * samples_per_symbol,
                      offset=16,
                      size=(480, 480),
                      bounds=ybounds).T

    # Convert the array to floating point, and replace 0 with np.nan.
    # These points will be transparent in the image plot.
    grid = grid.astype(np.float32)
    grid[grid == 0] = np.nan

    #---------------------------------------------------------------------
    # The rest of the function creates the chaco image plot.

    pd = ArrayPlotData()
    pd.set_data("eyediagram", grid)

    plot = Plot(pd)
    img_plot = plot.img_plot("eyediagram",
                             xbounds=(0, 2),
                             ybounds=ybounds,
                             bgcolor=(0, 0, 0),
                             colormap=cool)[0]

    # Tweak some of the plot properties
    plot.title = "Eye Diagram"
    plot.padding = 50

    # Axis grids
    vgrid = PlotGrid(component=plot,
                     mapper=plot.index_mapper,
                     orientation='vertical',
                     line_color='gray',
                     line_style='dot')
    hgrid = PlotGrid(component=plot,
                     mapper=plot.value_mapper,
                     orientation='horizontal',
                     line_color='gray',
                     line_style='dot')
    plot.underlays.append(vgrid)
    plot.underlays.append(hgrid)

    # Add pan and zoom tools.
    plot.tools.append(PanTool(plot))
    zoom = ZoomTool(component=img_plot, tool_mode="box", always_on=False)
    img_plot.overlays.append(zoom)

    return plot
Exemple #2
0
def _create_plot_component():

    # Generate some data for the eye diagram.
    num_samples = 5000
    samples_per_symbol = 24
    y = demo_data(num_samples, samples_per_symbol)

    # Compute the eye diagram array.
    ybounds = (-0.25, 1.25)
    grid = grid_count(y, 2 * samples_per_symbol, offset=16, size=(480, 480), bounds=ybounds).T

    # Convert the array to floating point, and replace 0 with np.nan.
    # These points will be transparent in the image plot.
    grid = grid.astype(np.float32)
    grid[grid == 0] = np.nan

    # ---------------------------------------------------------------------
    # The rest of the function creates the chaco image plot.

    pd = ArrayPlotData()
    pd.set_data("eyediagram", grid)

    plot = Plot(pd)
    img_plot = plot.img_plot("eyediagram", xbounds=(0, 2), ybounds=ybounds, bgcolor=(0, 0, 0), colormap=cool)[0]

    # Tweak some of the plot properties
    plot.title = "Eye Diagram"
    plot.padding = 50

    # Axis grids
    vgrid = PlotGrid(
        component=plot, mapper=plot.index_mapper, orientation="vertical", line_color="gray", line_style="dot"
    )
    hgrid = PlotGrid(
        component=plot, mapper=plot.value_mapper, orientation="horizontal", line_color="gray", line_style="dot"
    )
    plot.underlays.append(vgrid)
    plot.underlays.append(hgrid)

    # Add pan and zoom tools.
    plot.tools.append(PanTool(plot))
    zoom = ZoomTool(component=img_plot, tool_mode="box", always_on=False)
    img_plot.overlays.append(zoom)

    return plot
    b = np.linspace(color1[2], color2[2], m)
    colors[1:, 0] = r
    colors[1:, 1] = g
    colors[1:, 2] = b
    colors[1:, 3] = 255
    colors[0, 3] = 0
    img = colors[counts]
    return img


# Generate image data
y = demo_data(5000, 24)
ybounds = (-0.25, 1.25)

# Compute the eye diagram image data.
counts = grid_count(y, 48, offset=16, size=(480, 480), bounds=ybounds)

# Convert counts to an array of RGBA values.
yellow = (224, 192, 48)
img_data = colorize(counts, yellow)

#-------------------------------------------------------------------------
# The rest of this script uses pyqtgraph to create a plot
# of the eye diagram.

pg.mkQApp()

win = pg.GraphicsLayoutWidget()
win.setWindowTitle('Eye Diagram')

# A plot area with axes for displaying the image.
Exemple #4
0
    b = np.linspace(color1[2], color2[2], m)
    colors[1:, 0] = r
    colors[1:, 1] = g
    colors[1:, 2] = b
    colors[1:, 3] = 255
    colors[0, 3] = 0
    img = colors[counts]
    return img


# Generate image data
y = demo_data(5000, 24)
ybounds = (-0.25, 1.25)

# Compute the eye diagram image data.
counts = grid_count(y, 48, offset=16, size=(480, 480), bounds=ybounds)

# Convert counts to an array of RGBA values.
yellow = (224, 192, 48)
img_data = colorize(counts, yellow)

#-------------------------------------------------------------------------
# The rest of this script uses pyqtgraph to create a plot
# of the eye diagram.

pg.mkQApp()

win = pg.GraphicsLayoutWidget()
win.setWindowTitle('Eye Diagram')

# A plot area with axes for displaying the image.