Skip to content

Commit

Permalink
Merge pull request #82 from gdsfactory/update_gdsfactory825
Browse files Browse the repository at this point in the history
update to 8.25.1
  • Loading branch information
joamatab authored Dec 12, 2024
2 parents eced92e + be4d603 commit c6c8628
Show file tree
Hide file tree
Showing 225 changed files with 369 additions and 375 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test:
pytest -s tests/test_si500.py
pytest -s tests/test_sin300.py

test-force-regen:
test-force:
pytest -s tests/test_si220.py --force-regen
pytest -s tests/test_si500.py --force-regen
pytest -s tests/test_sin300.py --force-regen
Expand Down
4 changes: 2 additions & 2 deletions cspdk/si220/cells/containers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""This module contains cells that contain other cells."""

from functools import partial
from typing import Any

import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.typings import (
Any,
CellSpec,
Component,
ComponentSpec,
CrossSectionSpec,
Strs,
Expand Down
11 changes: 6 additions & 5 deletions cspdk/si220/cells/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from functools import partial

import gdsfactory as gf
from gdsfactory.cross_section import CrossSection
from gdsfactory.typings import (
ComponentSpec,
CrossSection,
CrossSectionSpec,
Ints,
LayerSpec,
Expand Down Expand Up @@ -73,7 +73,7 @@ def bend_s(


@gf.cell
def bend_euler_sc(
def bend_euler(
radius: float | None = None,
angle: float = 90.0,
p: float = 0.5,
Expand Down Expand Up @@ -102,9 +102,10 @@ def bend_euler_sc(
)


bend_euler_so = partial(bend_euler_sc, cross_section="xs_so")
bend_euler_rc = partial(bend_euler_sc, cross_section="xs_rc")
bend_euler_ro = partial(bend_euler_sc, cross_section="xs_ro")
bend_euler_sc = partial(bend_euler, cross_section="xs_sc")
bend_euler_so = partial(bend_euler, cross_section="xs_so")
bend_euler_rc = partial(bend_euler, cross_section="xs_rc")
bend_euler_ro = partial(bend_euler, cross_section="xs_ro")
bend_metal = partial(bend_euler_sc, cross_section="metal_routing")

################
Expand Down
2 changes: 1 addition & 1 deletion cspdk/si220/klayout/tech.lyt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
</writer-options>
<connectivity>
<connection>HEATER,HEATER,PAD</connection>
<symbols>HEATER='39/0'</symbols>
<symbols>PAD='41/0'</symbols>
<symbols>HEATER='39/0'</symbols>
</connectivity>
</technology>
14 changes: 7 additions & 7 deletions cspdk/si220/tech.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import gdsfactory as gf
from gdsfactory import Section
from gdsfactory.cross_section import (
CrossSectionSpec,
LayerSpec,
CrossSection,
cross_section,
port_names_electrical,
port_types_electrical,
Expand All @@ -23,9 +22,10 @@
from gdsfactory.typings import (
ComponentSpec,
ConnectivitySpec,
CrossSection,
CrossSectionSpec,
Floats,
Layer,
LayerSpec,
LayerSpecs,
)

Expand Down Expand Up @@ -124,8 +124,8 @@ class Tech:
radius_ro = 25
width_sc = 0.45
width_so = 0.40
width_rc = 0.45
width_ro = 0.40
width_rc = 0.5
width_ro = 0.5

width_slab = 5

Expand Down Expand Up @@ -173,7 +173,7 @@ def xs_so(

@xsection
def xs_rc(
width: float = 0.5,
width: float = TECH.width_rc,
layer: LayerSpec = "WG",
radius: float = TECH.radius_rc,
radius_min: float = TECH.radius_rc,
Expand All @@ -195,7 +195,7 @@ def xs_rc(

@xsection
def xs_ro(
width: float = 0.5,
width: float = TECH.width_ro,
layer: LayerSpec = "WG",
radius: float = TECH.radius_ro,
radius_min: float = TECH.radius_ro,
Expand Down
31 changes: 6 additions & 25 deletions cspdk/si500/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from functools import partial

import gdsfactory as gf
from gdsfactory.cross_section import CrossSection
from gdsfactory.typings import (
CrossSection,
CrossSectionSpec,
Ints,
LayerSpec,
Expand Down Expand Up @@ -260,30 +260,6 @@ def coupler_straight(
)


@gf.cell
def coupler_symmetric(
gap: float = 0.236,
dy: float = 4.0,
dx: float = 15.0,
cross_section: CrossSectionSpec = "xs_rc",
) -> gf.Component:
"""The part of the coupler that diverges away from each other with s-bends.
Args:
gap: the gap between the s-bends when closest together.
dy: the height of the s-bend.
dx: the length of the s-bend.
cross_section: a cross section or its name or a function generating a cross section.
"""
return gf.c.coupler_symmetric(
bend="bend_s",
gap=gap,
dy=dy,
dx=dx,
cross_section=cross_section,
)


@gf.cell
def coupler(
gap: float = 0.236,
Expand Down Expand Up @@ -662,3 +638,8 @@ def array(
centered=centered,
add_ports=add_ports,
)


if __name__ == "__main__":
c = die_rc()
c.show()
177 changes: 91 additions & 86 deletions cspdk/si500/tech.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
"""Technology definitions."""

import sys
from collections.abc import Iterable
from functools import partial
from typing import cast

import gdsfactory as gf
from gdsfactory.cross_section import CrossSectionSpec, LayerSpec, get_cross_sections
from gdsfactory.cross_section import (
CrossSection,
cross_section,
port_names_electrical,
port_types_electrical,
)
from gdsfactory.routing.route_bundle import ManhattanRoute
from gdsfactory.technology import (
LayerLevel,
Expand All @@ -15,7 +19,15 @@
LayerViews,
LogicalLayer,
)
from gdsfactory.typings import ComponentSpec, ConnectivitySpec, Layer
from gdsfactory.typings import (
ComponentSpec,
ConnectivitySpec,
CrossSectionSpec,
Floats,
Layer,
LayerSpec,
LayerSpecs,
)

from cspdk.si500.config import PATH

Expand Down Expand Up @@ -111,103 +123,96 @@ class Tech:
width_rc = 0.45
width_ro = 0.40

width_slab = 5


TECH = Tech()


############################
# Cross-sections functions
############################

# will be filled after all cross sections are defined:
DEFAULT_CROSS_SECTION_NAMES: dict[str, str] = {}
xsection = gf.xsection


@xsection
def xs_rc(
width: float = TECH.width_rc,
layer: LayerSpec = "WG",
radius: float = TECH.radius_rc,
radius_min: float = TECH.radius_rc,
bbox_layers: LayerSpecs = ("SLAB",),
bbox_offsets: Floats = (TECH.width_slab,),
**kwargs,
) -> CrossSection:
"""Return Rib cross_section."""
return gf.cross_section.cross_section(
width=width,
layer=layer,
radius=radius,
radius_min=radius_min,
bbox_layers=bbox_layers,
bbox_offsets=bbox_offsets,
**kwargs,
)


def xs_rc(width=Tech.width_rc, radius=Tech.radius_rc, **kwargs) -> gf.CrossSection:
"""Returns a rib Cband cross-section."""
kwargs["layer"] = kwargs.get("layer", LAYER.WG)
kwargs["bbox_layers"] = kwargs.get("bbox_layers", (LAYER.SLAB,))
kwargs["bbox_offsets"] = kwargs.get("bbox_offsets", (5,))
kwargs["radius_min"] = kwargs.get("radius_min", radius)
kwargs["sections"] = kwargs.get(
"sections",
(gf.Section(width=10.45, layer=LAYER.SLAB, name="slab", simplify=50 * nm),),
)
xs = gf.cross_section.strip(width=width, radius=radius, **kwargs)
if xs.name in DEFAULT_CROSS_SECTION_NAMES:
xs._name = DEFAULT_CROSS_SECTION_NAMES[xs.name]
return xs


def xs_rc_tip(width=Tech.width_rc, radius=Tech.radius_rc, **kwargs) -> gf.CrossSection:
"""Returns a rib Cband cross-section."""
kwargs["layer"] = kwargs.get("layer", LAYER.WG)
kwargs["bbox_layers"] = kwargs.get("bbox_layers", (LAYER.SLAB,))
kwargs["bbox_offsets"] = kwargs.get("bbox_offsets", (5,))
kwargs["radius_min"] = kwargs.get("radius_min", radius)
kwargs["sections"] = kwargs.get(
"sections",
(gf.Section(width=0.2, layer=LAYER.SLAB, name="slab"),),
)
xs = gf.cross_section.strip(width=width, radius=radius, **kwargs)
if xs.name in DEFAULT_CROSS_SECTION_NAMES:
xs._name = DEFAULT_CROSS_SECTION_NAMES[xs.name]
return xs


def xs_ro(width=Tech.width_ro, radius=Tech.radius_ro, **kwargs) -> gf.CrossSection:
"""Returns a rib Oband cross-section."""
kwargs["layer"] = kwargs.get("layer", LAYER.WG)
kwargs["bbox_layers"] = kwargs.get("bbox_layers", (LAYER.SLAB,))
kwargs["bbox_offsets"] = kwargs.get("bbox_offsets", (5,))
kwargs["radius_min"] = kwargs.get("radius_min", radius)
kwargs["sections"] = kwargs.get(
"sections",
(gf.Section(width=10.45, layer=LAYER.SLAB, name="slab", simplify=50 * nm),),
@xsection
def xs_ro(
width: float = TECH.width_ro,
layer: LayerSpec = "WG",
radius: float = TECH.radius_ro,
radius_min: float = TECH.radius_ro,
bbox_layers: LayerSpecs = ("SLAB",),
bbox_offsets: Floats = (TECH.width_slab,),
**kwargs,
) -> CrossSection:
"""Return Rib cross_section."""
return gf.cross_section.cross_section(
width=width,
layer=layer,
radius=radius,
radius_min=radius_min,
bbox_layers=bbox_layers,
bbox_offsets=bbox_offsets,
**kwargs,
)
xs = gf.cross_section.strip(width=width, radius=radius, **kwargs)
if xs.name in DEFAULT_CROSS_SECTION_NAMES:
xs._name = DEFAULT_CROSS_SECTION_NAMES[xs.name]
return xs


def metal_routing(width=10.0, **kwargs) -> gf.CrossSection:
"""Returns a metal routing cross-section."""
kwargs["layer"] = kwargs.get("layer", LAYER.PAD)
kwargs["port_names"] = kwargs.get(
"port_names", gf.cross_section.port_names_electrical
@xsection
def metal_routing(
width: float = 10,
layer: LayerSpec = "PAD",
radius: float | None = None,
) -> CrossSection:
"""Return Metal Strip cross_section."""
return cross_section(
width=width,
layer=layer,
radius=radius,
port_names=port_names_electrical,
port_types=port_types_electrical,
)
kwargs["port_types"] = kwargs.get(
"port_types", gf.cross_section.port_types_electrical


@xsection
def heater_metal(
width: float = 4,
layer: LayerSpec = "HEATER",
radius: float | None = None,
port_names=port_names_electrical,
port_types=port_types_electrical,
**kwargs,
) -> CrossSection:
"""Return Metal Strip cross_section."""
return gf.cross_section.cross_section(
width=width,
layer=layer,
radius=radius,
port_names=port_names,
port_types=port_types,
**kwargs,
)
kwargs["radius"] = kwargs.get("radius", 0)
kwargs["radius_min"] = kwargs.get("radius_min", kwargs["radius"])
xs = gf.cross_section.strip_heater_metal(width=width, **kwargs)
if xs.name in DEFAULT_CROSS_SECTION_NAMES:
xs._name = DEFAULT_CROSS_SECTION_NAMES[xs.name]
return xs


def heater_metal(width=4.0, **kwargs) -> gf.CrossSection:
"""Returns a heater metal cross-section."""
kwargs["layer"] = kwargs.get("layer", LAYER.HEATER)
xs = metal_routing(width=width, **kwargs).copy()
if xs.name in DEFAULT_CROSS_SECTION_NAMES:
xs._name = DEFAULT_CROSS_SECTION_NAMES[xs.name]
return xs


def populate_default_cross_section_names() -> None:
"""Populates the default cross-section names."""
xss = {k: v() for k, v in get_cross_sections(sys.modules[__name__]).items()}
for k, xs in xss.items():
xs._name = ""
_k = xs.name
xs._name = k
DEFAULT_CROSS_SECTION_NAMES[_k] = xs.name


populate_default_cross_section_names()


############################
Expand Down
Loading

0 comments on commit c6c8628

Please sign in to comment.