Creating cross section images
Vertical cross-section images of layouts can be created using the
XSection plugin for KLayout.
To use it, install the XSection plugin from
KLayout -> Tools -> Manage packages.
XSection only works with the default KLayout setup, secondary environments are not yet supported.
KLayout GUI XSection tool
Once XSection plugin is installed in KLayout, a “XSection” ruler tool is available as a scroll option for the Ruler tool.
Use the Ruler tool in KLayout to choose the cuts along which the vertical cross-sections are created. Select the “XSection” ruler type if you want to use other rulers for measurements.
To create the cross-sections:
Tools -> XSection scripts -> Run script -> example.xs
XSection call in KQC code
XSection plugin can be called from python code to automate cross-section geometry generation for simulation files. klayout_package/python/kqcircuits/simulations/export/xsection/xsection_export.py includes
create_xsections_from_simulations, a high level method to take a cross-section for each simulation object using two
xsection_call, a low level method requiring a path to the input and output OAS files, two
DPointvalues and, optionally, a path to a process file. If xsection/kqc_process.xs process file is used, make sure to provide a path to the parameters json file as well.
An example of using XSection tool to produce cross-section simulation files is demonstrated in klayout_package/python/scripts/simulations/waveguides_sim_xsection.py
XSection 1.7 does not work immediately after package install due to the improvement
to backwards compatibility with older Ruby versions. To mitigate the issue,
you need to make a change in the XSection code. From you KLayout environment directory,
.klayout/salt/xsection/ruby/xsection_script.rb file in editor and change line 200
pts << [[[ p1, p2 ]]] to
pts << [[ p1, p2 ]]
Process files (.xs)
The process by which the actual physical shapes are created from the layout
layers is defined in
.xs files. The xsection folder in KQC contains two
Information about writing the
.xs files can be found in the following pages: