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)

write_gdsii

class ipkiss3.all.LayoutView
Parameters:
view_name: String that contains only alphanumeric characters from the ASCII set or contains _$. ASCII set is extended on PY3.

The name of the view

write_gdsii(filename_or_stream, unit=None, grid=None, layer_map=None, filter=None, timestamp=None)

Writes a LayoutView, including all its dependencies to a GDSII file.

Parameters:
filename_or_streamstring , 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.

unitpositive number

The User units to be used in the GDSII file. By default, the value is extracted from TECH.METRICS.UNIT

gridpositive 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_mapdict or LayerMap object

A dictionary-like object to map the IPKISS layers onto GDSII layer numbers and data-types.

filter: Filter

Optional, a filter to be applied instead of the default.

timestamp: datetime.datetime or None

Optional, a fixed timestamp to apply to the library and all cells written. If None, the current date and time will be used.

Returns:
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.

FileOutputGdsii

class ipkiss3.all.FileOutputGdsii

Writes GDS2 output to a file.

The constructor takes the filename. The write() method streams the GDS2 data to the file

Parameters:
fixed_time_stamp: ( datetime ), optional, *None allowed*

Fix the time stamp to a specific value.If None (default), the actual local time at the time of writing the GDSIIare used. Otherwise, specify a datetime.datetime object or a float (e.g. 0.0 for 1/1/1970)

userefcache: ( bool, bool_ or int ), optional

Use a cache for efficiency; might not work in some cases

echo: ( bool, bool_ or int ), optional

when True, additional information is logged

layer_map: optional

layer map between Layer objects and output layers

name_filter: Filter, optional

filter class which is applied to all names

filter: Filter, optional

filter class which is applied to all output items

o_stream: optional

output stream