Skip to content

Straight

straight

Provides straight waveguides in dbu and um versions.

A waveguide is a rectangle of material with excludes and/or slab around it::

┌─────────────────────────────┐
│        Slab/Exclude         │
├─────────────────────────────┤
│                             │
│            Core             │
│                             │
├─────────────────────────────┤
│        Slab/Exclude         │
└─────────────────────────────┘

The slabs and excludes are part of the cross section, or can be given for the legacy (width, layer, enclosure) call via a LayerEnclosure.

straight_dbu module-attribute

straight_dbu = straight_dbu_factory(kcl=demo)

Cross-section-first straight factory on the default KCLayout (length in dbu).

straight

straight(
    *,
    width: um,
    length: um,
    layer: LayerInfo,
    enclosure: LayerEnclosure | None = None,
) -> KCell
straight(
    *,
    cross_section: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict,
    length: um,
) -> KCell
straight(
    *,
    length: um,
    cross_section: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    width: um | None = None,
    layer: LayerInfo | None = None,
    enclosure: LayerEnclosure | None = None,
) -> KCell

Straight waveguide in um.

Either pass a cross_section (name, spec, or instance) or the legacy width/layer/enclosure.

Parameters:

Name Type Description Default
length um

Length of the straight. [um]

required
cross_section str | CrossSection | DCrossSection | CrossSectionSpecDict | DCrossSectionSpecDict | None

Cross section of the straight.

None
width um | None

Width of the core. [um] (legacy; requires layer)

None
layer LayerInfo | None

Main layer of the straight. (legacy)

None
enclosure LayerEnclosure | None

Definition of slabs/excludes. (legacy)

None
Source code in kfactory/cells/straight.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def straight(
    *,
    length: um,
    cross_section: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    width: um | None = None,
    layer: kdb.LayerInfo | None = None,
    enclosure: LayerEnclosure | None = None,
) -> KCell:
    """Straight waveguide in um.

    Either pass a ``cross_section`` (name, spec, or instance) or the legacy
    ``width``/``layer``/``enclosure``.

    Args:
        length: Length of the straight. [um]
        cross_section: Cross section of the straight.
        width: Width of the core. [um] (legacy; requires ``layer``)
        layer: Main layer of the straight. (legacy)
        enclosure: Definition of slabs/excludes. (legacy)
    """
    if cross_section is not None:
        return straight_dbu(cross_section=cross_section, length=demo.to_dbu(length))
    if width is None or layer is None:
        raise ValueError("Provide a cross_section, or width and layer (legacy call).")
    return straight_dbu(
        width=demo.to_dbu(width),
        length=demo.to_dbu(length),
        layer=layer,
        enclosure=enclosure,
    )