Coverage for qpdk / samples / sample1.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-14 10:27 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-14 10:27 +0000
1# ---
2# jupyter:
3# jupytext:
4# text_representation:
5# extension: .py
6# format_name: percent
7# format_version: '1.3'
8# jupytext_version: 1.17.3
9# ---
11# %% [markdown]
12# # Write GDS with Sample Connections
13#
14# This sample demonstrates how to connect waveguides sequentially to create a longer path.
16# %%
17import gdsfactory as gf
19from qpdk import cells
21# %% [markdown]
22# ## Sample Function
23#
24# Creates a component with three connected waveguides of increasing length.
27# %%
28@gf.cell
29def sample1_connect() -> gf.Component:
30 """Returns a component with connected waveguides."""
31 c = gf.Component()
32 wg1 = c << cells.straight(length=1, width=1)
33 wg2 = c << cells.straight(length=2, width=1)
34 wg3 = c << cells.straight(length=3, width=1)
36 wg2.connect(port="o1", other=wg1["o2"])
37 wg3.connect(port="o1", other=wg2["o2"])
38 return c