Table Of Contents

This Page

Output functions

Classes and functions for the visualization of layouts cerated with the gdspy Python module.

LayoutViewer

class gdspy.LayoutViewer(cells=None, exclude_layers=[], width=800, height=600, colors=None, outlines=None)

Provide a GUI where the layout can be viewed.

The view can be scrolled vertically with the mouse wheel, and horizontally by holding the shift key and using the mouse wheel. Dragging the 2nd mouse button also scrolls the view, and if control is held down, it scrolls 10 times faster.

You can zoom in or out using control plus the mouse wheel, or drag a rectangle on the window with the 1st mouse button to zoom into that area.

A ruler is available by clicking the 1st mouse button anywhere on the view and moving the mouse around. The distance is shown in the status area.

Double-clicking on any polygon gives some information about it.

Layer colors can be changed by double-clicking on the layer list or clicking the 3rd mouse button on any polygon. On the color chooser, clicking cancel will make the selected layer transparent. To change the outline color, use shift + double click on the layer list, or shift + click with the 3rd button on any polygon.

The background color can be changed by clicking on the background with the 3rd mouse button.

Parameters :

cells : array-like

The array of cells to be included in the view. If None, all cells listed in Cell.cell_list are used.

exclude_layers : array-like

The array of layers to be excluded from the view.

width : integer

Horizontal size of the viewer window.

height : integer

Vertical size of the viewer window.

colors : array-like

Colors (RGB tuple) for each GDSII layer, with components from 0 to 255. Any colors set to None will set that layer to transparent.

outlines : array-like

Colors (RGB tuple) for each GDSII layer, with components from 0 to 255. Any colors set to None will set that layer to transparent.

Examples

All layers filled (in red, green, and blue) and with light outlines:

>>> LayoutViewer(colors=[(255, 0, 0), (0, 255, 0), (0, 0, 255)],
...              outlines=[(192, 192, 192)])

No filling, colored outlines:

>>> LayoutViewer(colors=[None] * 64)

Methods

after
after_cancel
after_idle
bbox
bell
bind
bind_all
bind_class
bindtags
cget
clipboard_append
clipboard_clear
clipboard_get
colormodel
columnconfigure
config
configure
deletecommand
destroy
event_add
event_delete
event_generate
event_info
focus
focus_displayof
focus_force
focus_get
focus_lastfor
focus_set
forget
getboolean
getdouble
getint
getvar
grab_current
grab_release
grab_set
grab_set_global
grab_status
grid
grid_bbox
grid_columnconfigure
grid_configure
grid_forget
grid_info
grid_location
grid_propagate
grid_remove
grid_rowconfigure
grid_size
grid_slaves
image_names
image_types
info
keys
lift
location
lower
mainloop
nametowidget
option_add
option_clear
option_get
option_readfile
pack
pack_configure
pack_forget
pack_info
pack_propagate
pack_slaves
place
place_configure
place_forget
place_info
place_slaves
propagate
quit
register
rowconfigure
selection_clear
selection_get
selection_handle
selection_own
selection_own_get
send
setvar
size
slaves
tk_bisque
tk_focusFollowsMouse
tk_focusNext
tk_focusPrev
tk_menuBar
tk_setPalette
tk_strictMotif
tkraise
unbind
unbind_all
unbind_class
update
update_idletasks
wait_variable
wait_visibility
wait_window
waitvar
winfo_atom
winfo_atomname
winfo_cells
winfo_children
winfo_class
winfo_colormapfull
winfo_containing
winfo_depth
winfo_exists
winfo_fpixels
winfo_geometry
winfo_height
winfo_id
winfo_interps
winfo_ismapped
winfo_manager
winfo_name
winfo_parent
winfo_pathname
winfo_pixels
winfo_pointerx
winfo_pointerxy
winfo_pointery
winfo_reqheight
winfo_reqwidth
winfo_rgb
winfo_rootx
winfo_rooty
winfo_screen
winfo_screencells
winfo_screendepth
winfo_screenheight
winfo_screenmmheight
winfo_screenmmwidth
winfo_screenvisual
winfo_screenwidth
winfo_server
winfo_toplevel
winfo_viewable
winfo_visual
winfo_visualid
winfo_visualsavailable
winfo_vrootheight
winfo_vrootwidth
winfo_vrootx
winfo_vrooty
winfo_width
winfo_x
winfo_y

gds_image()

gdspy.gds_image(cells=None, exclude_layers=[], image_name=None, image_format='png', colors=None, outlines=None, resolution=1, bounding_box=None, antialias=0, background=(0, 0, 0))

Generates an image from each cell and saves them to files.

Parameters :

cells : gdspy.Cell or list

Cell or list of cells to be included in the plot. If None, all cells listed in Cell.cell_list are used.

exclude_layers : array-like

The array of layers to be excluded from the plot.

image_name : string

Name of the output image without extension. If None, the cell names will be used. If cells contains more than 1 element, the name of the output file will be the corresponding cell name with image_name as a prefix.

image_format : string

The supported image formats are bmp, gif, jpg, pcx, png, ppm, and tiff.

colors : array-like

Colors (RGB tuple) for each layer.

outlines : array-like

Outline colors (RGB tuple) for each layer.

resolution : number

Geometry scaling in pixels per user units.

bounding_box : array-like[4]

Area of the geometry to be draw on the output file in the format (min_x, max_x, min_y, max_y). If None, the whole extent of each cell will be used.

antialias : non-negative integer

Level of anti-aliasing to be used when drawing the image.

background : array-like[3]

RGB tuple for the background color.

Examples

>>> colors = [(255,0,0), (0,255,0), (0,0,255)]
>>> gds_image(image_name='/output_folder/layout', colors=colors)

gds_print()

gdspy.gds_print(output, cells=None, name='library', unit=1.0e-06, precision=1.0e-09)

Output a list of cells as a GDSII stream library.

The dimensions actually written on the GDSII file will be the dimensions of the objects created times the ratio unit/precision. For example, if a circle with radius 1.5 is created and we set unit=1.0e-06 (1 um) and precision=1.0e-09 (1 nm), the radius of the circle will be 1.5 um and the GDSII file will contain the dimension 1500 nm.

Parameters :

output : file

The file where the GDSII stream will be written. It must be opened for writing operations in binary format.

cells : array-like

The list of cells to be included in the library. If None, all cells listed in Cell.cell_list are used.

name : string

Name of the GDSII library (file).

unit : number

Unit size for the objects in the library (in meters).

precision : number

Precision for the dimensions of the objects in the library (in meters).

Examples

>>> out = open('out-file.gds', 'wb')
>>> gdspy.gds_print(out, unit=1.0e-6, precision=1.0e-9)
>>> out.close()