Skip to content

Taper

taper

Tapers, linear only.

A linear taper transitions between two cross sections (two core widths). The slabs and excludes are part of the cross sections, or can be given for the legacy (width1, width2, layer, enclosure) call via a LayerEnclosure.

TODO: Non-linear tapers.

taper_dbu module-attribute

taper_dbu = taper_factory(kcl=demo)

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

taper

taper(
    *,
    width1: um,
    width2: um,
    length: um,
    layer: LayerInfo,
    enclosure: LayerEnclosure | None = None,
) -> KCell
taper(
    *,
    cross_section1: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict,
    cross_section2: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict,
    length: um,
) -> KCell
taper(
    *,
    length: um,
    cross_section1: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    cross_section2: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    width1: um | None = None,
    width2: um | None = None,
    layer: LayerInfo | None = None,
    enclosure: LayerEnclosure | None = None,
) -> KCell

Linear Taper [um].

Visualization::

       __
     _/  │ Slab/Exclude
   _/  __│
 _/  _/  │
│  _/    │
│_/      │
│_       │ Core
│ \_     │
│_  \_   │
  \_  \__│
    \_   │
      \__│ Slab/Exclude

Either pass two cross sections (cross_section1/cross_section2) or the legacy width1/width2/layer/enclosure.

Parameters:

Name Type Description Default
length um

Length of the taper. [um]

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

Cross section of the left side.

None
cross_section2 str | CrossSection | DCrossSection | CrossSectionSpecDict | DCrossSectionSpecDict | None

Cross section of the right side.

None
width1 um | None

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

None
width2 um | None

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

None
layer LayerInfo | None

Main layer of the taper. (legacy)

None
enclosure LayerEnclosure | None

Definition of the slab/exclude. (legacy)

None
Source code in kfactory/cells/taper.py
 56
 57
 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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
def taper(
    *,
    length: um,
    cross_section1: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    cross_section2: str
    | CrossSection
    | DCrossSection
    | CrossSectionSpecDict
    | DCrossSectionSpecDict
    | None = None,
    width1: um | None = None,
    width2: um | None = None,
    layer: kdb.LayerInfo | None = None,
    enclosure: LayerEnclosure | None = None,
) -> KCell:
    r"""Linear Taper [um].

    Visualization::

               __
             _/  │ Slab/Exclude
           _/  __│
         _/  _/  │
        │  _/    │
        │_/      │
        │_       │ Core
        │ \_     │
        │_  \_   │
          \_  \__│
            \_   │
              \__│ Slab/Exclude

    Either pass two cross sections (``cross_section1``/``cross_section2``) or the
    legacy ``width1``/``width2``/``layer``/``enclosure``.

    Args:
        length: Length of the taper. [um]
        cross_section1: Cross section of the left side.
        cross_section2: Cross section of the right side.
        width1: Width of the core on the left side. [um] (legacy; requires ``layer``)
        width2: Width of the core on the right side. [um] (legacy; requires ``layer``)
        layer: Main layer of the taper. (legacy)
        enclosure: Definition of the slab/exclude. (legacy)
    """
    if cross_section1 is not None and cross_section2 is not None:
        return taper_dbu(
            cross_section1=cross_section1,
            cross_section2=cross_section2,
            length=demo.to_dbu(length),
        )
    if width1 is None or width2 is None or layer is None:
        raise ValueError(
            "Provide cross_section1 and cross_section2, or width1, width2 and layer"
            " (legacy call)."
        )
    return taper_dbu(
        width1=demo.to_dbu(width1),
        width2=demo.to_dbu(width2),
        length=demo.to_dbu(length),
        layer=layer,
        enclosure=enclosure,
    )