Exporting Layouts to GDSII¶
Once a LayoutView is made, we can write it and all its dependencies (layout views of instances to child cells) to a GDSII file.
wg = i3.Waveguide() layout = wg.Layout() layout.write_gdsii('waveguide.gds')
The user unit and the database unit (GDSII grid) can also be specified. By default, the value of the user unit is extracted from TECH.METRICS.UNIT and the value of the database unit is extracted from TECH.METRICS.GRID. The user unit should always be an integer multiple of the grid.
layout.write_gdsii('waveguide.gds', unit=1e-6, grid=5e-9)
It’s also possible to map the IPKISS layers onto GDSII layer numbers and data-types, with the layer_map variable. This can be a dictionary or LayerMap object. By default, it is extracted from TECH.GDSII.EXPORT_LAYER_MAP. See Technology/GDSII for more info.
For example, let’s say we want to change the GDSII layer and datatype to which the waveguide core layer
(TECH.PROCESS.WG, TECH.PURPOSE.LF.LINE) is written to layer 5 and datatype 2.
Then, we can copy the layer map from the technology (so as to maintain the mapping for all other layers) and modify it as shown below:
from ipkiss.process.layer_map import GenericGdsiiPPLayerOutputMap # We make a copy so that we can freely modify it. pplayer_map = dict(i3.TECH.GDSII.LAYERTABLE) pplayer_map[i3.TECH.PROCESS.WG, i3.TECH.PURPOSE.LF.LINE] = (5, 2) output_layer_map = GenericGdsiiPPLayerOutputMap(pplayer_map=pplayer_map) # Now, we use it to write our GDS: layout.write_gdsii('waveguide.gds', layer_map=output_layer_map)
view_name: str and ( Alphanumeric string or Contains _$ )
The name of the view
write_gdsii(filename_or_stream, unit=1e-06, grid=5e-09, layer_map=None)¶
Writes a LayoutView, including all its dependencies to a GDSII file.
filename_or_stream : string , file object
When a string is provided, a file object will be created When a stream of file object is passed, this will be used The file object should be binary and set in write mode.
unit : positive number
The User units to be used in the GDSII file. By default, the value is extracted from TECH.METRICS.UNIT
grid : positive number
The database units (grid) to be used in the GDSII file. By default, the value is extracted from TECH.METRICS.GRID the user unit should be an integer multiple of the grid
layer_map : dict or LayerMap object
A dictionary-like object to map the IPKISS layers onto GDSII layer numbers and data-types.
When running from a script, the method returns nothing.
When running in an IPython Notebook, the method returns a FileLink object that the user can use to download the generated GDSII file.