Bokeh visualization extension

get_lyp_path[source]

get_lyp_path(path:Optional[str]=None)

get_lyp_path()
'/__w/flayout/flayout/flayout/layers.lyp'

read_lyp[source]

read_lyp(path:Optional[str]=None)

Load layer properties from a file

Args:
    path: the path where to load the layer properties from

Returns:
    a dictionary of layer property dictionaries
lyp = read_lyp()
{k: v for k, v in lyp.items() if k in [(19, 0), (10001, 0)]}
{(19, 0): {'name': '',
  'frame-color': '#ff0000',
  'fill-color': '#ff0000',
  'visible': True},
 (10001, 0): {'name': '',
  'frame-color': '#ff8000',
  'fill-color': '#ff8000',
  'visible': True}}

get_lyp[source]

get_lyp(layer_info:Union[pya.LayerInfo, Tuple[int, int]], path:Optional[str]=None)

Load layer properties for a specific layer from a file

Args:
    layer_info: the layer info tuple to load the layer properties for
    path: the path where to load the layer properties from

Returns:
    a layer property dictionary
get_lyp((19, 0))
{'name': '',
 'frame-color': '#ff0000',
 'fill-color': '#ff0000',
 'visible': True}
box = pya.Box(0.0, 0.0, 5.0, 2.5)
_get_range(box)
(0.0, 5.0, 0.0, 2.0, 5.0, 2.0)
box = pya.DBox(0.0, 0.0, 5.0, 2.5)
#box = box.enlarge(pya.DVector(0.5, 0.5))
_get_range(box)
(0.0, 5.0, 0.0, 2.5, 5.0, 2.5)

new_plot[source]

new_plot(box:Union[pya.Box, pya.DBox], max_dim:Optional[float]=None)

Create a new plot with limits determined by a bbox

Args:
    box: the bbox of the polygon or cell to create the figure for

Returns:
    a bokeh Figure.
p = new_plot(box)
p.line([0, 1], [0, 1])
bio.show(p)

adjust_plot[source]

adjust_plot(plot:bp.Figure, box:Union[pya.Box, pya.DBox], max_dim:Optional[float]=None)

Adjust a plot with limits determined by a bbox

Args:
    plot: the plot to adjust the limits for
    box: the bbox of the polygon or cell to create the figure for

Returns:
    a bokeh Figure.
fig = adjust_plot(p, pya.DBox(-1.0, -1.0, 5.0, 3.0))
bio.show(fig)

draw_polys[source]

draw_polys(plot:bp.Figure, polys:List[Union[pya.Polygon, pya.SimplePolygon, pya.DPolygon, pya.DSimplePolygon]], layer=(0, 0), fill_color=None, line_color=None, fill_alpha=0.3)

draw polygons with bokeh

Args:
    plot: the plot to draw the polygon in
    polys: the polygons to draw

Returns:
    the (inplace) modified plot containing the polygons
fig = new_plot(box)
draw_polys(fig, [pya.DPolygon([pya.DPoint(0, 0), pya.DPoint(2, 0), pya.DPoint(3, 1)])])
bio.show(fig)

draw_poly[source]

draw_poly(plot:bp.Figure, poly:Union[pya.Polygon, pya.SimplePolygon, pya.DPolygon, pya.DSimplePolygon], layer=(0, 0), fill_color=None, line_color=None, fill_alpha=0.3)

draw a polygon with bokeh

Args:
    plot: the plot to draw the polygon in
    poly: the polygon to draw

Returns:
    the (inplace) modified plot containing the polygon
fig = new_plot(box)
draw_poly(fig, pya.DPolygon([pya.DPoint(0, 0), pya.DPoint(2, 0), pya.DPoint(3, 1)]), layer=(19, 0))
bio.show(fig)

draw_path[source]

draw_path(plot:bp.Figure, path:Union[pya.Path, pya.DPath], layer=(0, 0), fill_color=None, line_color=None, fill_alpha=0.3)

draw a path with bokeh

Args:
    plot: the plot to draw the path in
    poly: the path to draw

Returns:
    the (inplace) modified plot containing the path
fig = new_plot(box)
path = pya.DPath([pya.Point(0, 0), pya.Point(10, 0)], 3.0)
draw_path(fig, path)
bio.show(fig)

draw_point[source]

draw_point(plot:bp.Figure, p:Union[pya.Point, pya.DPoint], layer=(0, 0), fill_color=None, line_color=None, fill_alpha=0.3)

draw a point with bokeh

Args:
    plot: the plot to draw the point in
    p: the point to draw

Returns:
    the (inplace) modified plot containing the point
fig = new_plot(box)
draw_point(fig, pya.Point(0, 0))
bio.show(fig)

draw_vector[source]

draw_vector(plot:bp.Figure, v:Union[pya.Vector, pya.DVector], layer=(0, 0), fill_color=None, line_color=None, fill_alpha=0.3)

draw a vector as an arrow with bokeh

Args:
    plot: the plot to draw the vector in
    v: the vector to draw

Returns:
    the (inplace) modified plot containing the vector
fig = new_plot(box)
draw_vector(fig, pya.DVector(3, 4))
bio.show(fig)

draw_box[source]

draw_box(plot:bp.Figure, box:Union[pya.Box, pya.DBox], fill_alpha=0.0, fill_color='#000000', line_color='#00FF00')

draw a box with bokeh

Args:
    plot: the plot to draw the box in
    box: the box to draw

Returns:
    the (inplace) modified plot containing the box
fig = new_plot(box)
draw_box(fig, pya.DBox(1.0, 2.0, 4.0, 3.0))
bio.show(fig)

draw_cell[source]

draw_cell(plot, cell, draw_bbox=True)

draw a cell with bokeh

Args:
    plot: the plot to draw the cell in
    cell: the cell to draw

Returns:
    the (inplace) modified plot containing the cell

draw_inst[source]

draw_inst(plot, inst, draw_bbox=True, draw_arrow=True)

draw a instance with bokeh

Args:
    plot: the plot to draw the instance in
    inst: the instance to draw

Returns:
    the (inplace) modified plot with containing the instance

draw_layout[source]

draw_layout(plot, layout)

draw a layout with bokeh

Args:
    plot: the plot to draw the layout in
    layout: the layout to draw

Returns:
    the (inplace) modified plot with containing the layout