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=1e-06, grid=5e-09, layer_map=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.

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 ipkiss.io.output_gdsii.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: ( Real, number ), optional, *None allowed*

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

name_filter: Filter, optional

filter class which is applied to all names

userefcache: ( bool, bool_, bool or int ), optional

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

echo: ( bool, bool_, bool or int ), optional

when True, additional information is logged

layer_map: optional

layer map between Layer objects and output layers

filter: Filter, optional

filter class which is applied to all output items

o_stream: optional

output stream

write(item)

writes output to the stream.

Parameters
itemsomething

it is handled by a collect__xxx method (xxx=class of the item).