Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gdsfactory 8.13.3 #70

Merged
merged 5 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 3 additions & 47 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,15 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.1"
rev: "v0.6.9"
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: 953faa6870f6663ac0121ab4a800f1ce76bca31f
hooks:
- id: shellcheck

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: "v1.0.1"
# hooks:
# - id: mypy
# exclude: ^(docs/|example-plugin/|tests/fixtures)
# additional_dependencies:
# - "pydantic"

# - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
# rev: d2425a62376c2197448cce2f825d5a0c3926b862
# hooks:
# - id: pretty-format-toml
# args: [--autofix]

- repo: https://github.com/aristanetworks/j2lint.git
rev: 742a25ef5da996b9762f167ebae9bc8223e8382e
hooks:
- id: j2lint
types: [file]
files: \.(j2|yml|yaml)$
args: [--extensions, "j2,yml,yaml", --ignore, jinja-statements-delimiter, jinja-statements-indentation, --]
exclude: .github/.*
- repo: https://github.com/codespell-project/codespell
rev: 38bc4a97f6e22827e86526148efa38f1044a97f8
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli

# - repo: https://github.com/kynan/nbstripout
# rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde
# hooks:
# - id: nbstripout
# files: ".ipynb"
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: 7b4409161486c6956bb3206ce96db5d56731b1b9 # Use the ref you want to point at
# hooks:
# - id: python-use-type-annotations
# - repo: https://github.com/PyCQA/bandit
# rev: fe1361fdcc274850d4099885a802f2c9f28aca08
# hooks:
# - id: bandit
# args: [--exit-zero]
# # ignore all tests, not just tests data
# exclude: ^tests/
71 changes: 45 additions & 26 deletions cspdk/si220/cells/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@
@gf.cell
def straight(
length: float = 10.0,
width: float | None = None,
cross_section: CrossSectionSpec = "xs_sc",
**kwargs,
) -> Component:
"""A straight waveguide.

Args:
length: the length of the waveguide.
width: the width of the waveguide.
cross_section: a cross section or its name or a function generating a cross section.
kwargs: additional arguments to pass to the straight function.
"""
if width is not None:
kwargs["width"] = width
kwargs["npoints"] = kwargs.get("npoints", 2)
return gf.c.straight(length=length, cross_section=cross_section, **kwargs)


Expand Down Expand Up @@ -313,8 +308,8 @@ def coupler_straight(
"""The straight part of a coupler.

Args:
length: the length of the straight part of the coupler
gap: the gap between the waveguides forming the straight part of the coupler
length: the length of the straight part of the coupler.
gap: the gap between the waveguides forming the straight part of the coupler.
cross_section: a cross section or its name or a function generating a cross section.
"""
return gf.c.coupler_straight(
Expand All @@ -334,10 +329,10 @@ def coupler_symmetric(
"""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.
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",
Expand Down Expand Up @@ -829,6 +824,7 @@ def grating_coupler_array(
with_loopback=False,
rotation=-90,
straight_to_grating_spacing=10.0,
radius: float | None = None,
cross_section="xs_sc",
) -> Component:
"""An array of grating couplers.
Expand All @@ -842,6 +838,7 @@ def grating_coupler_array(
with_loopback: if True, adds a loopback between edge GCs. Only works for rotation = 90 for now.
rotation: rotation angle for each reference.
straight_to_grating_spacing: spacing between the last grating coupler and the loopback.
radius: optional radius for routing the loopback.
cross_section: a cross section or its name or a function generating a cross section.
"""
if grating_coupler is None:
Expand Down Expand Up @@ -873,14 +870,37 @@ def grating_coupler_array(
port_name=port_name,
centered=centered,
cross_section=cross_section,
radius=radius,
)


@gf.cell
def die(cross_section="xs_sc") -> Component:
def die(
size=(11470.0, 4900.0),
edge_to_grating_distance=150.0,
edge_to_pad_distance=150.0,
grating_coupler=None,
grating_pitch=250.0,
layer_floorplan=LAYER.FLOORPLAN,
ngratings=14,
npads=31,
pad="pad",
pad_pitch=300.0,
cross_section="xs_sc",
) -> Component:
"""A die template.

Args:
size: the size of the die.
edge_to_grating_distance: the distance from the edge to the grating couplers.
edge_to_pad_distance: the distance from the edge to the pads.
grating_coupler: the name of the grating coupler to use in the array.
grating_pitch: the pitch of the grating couplers.
layer_floorplan: the layer to use for the floorplan.
ngratings: the number of grating couplers.
npads: the number of pads.
pad: the name of the pad to use in the array.
pad_pitch: the pitch of the pads.
cross_section: a cross section or its name or a function generating a cross section.
"""
if isinstance(cross_section, str):
Expand All @@ -897,19 +917,19 @@ def die(cross_section="xs_sc") -> Component:
"xs_rc": "grating_coupler_rectangular_rc",
"xs_ro": "grating_coupler_rectangular_ro",
}
grating_coupler = gcs.get(xs, "grating_coupler_rectangular")
grating_coupler = grating_coupler or gcs.get(xs, "grating_coupler_rectangular")
return gf.c.die_with_pads(
cross_section=cross_section,
edge_to_grating_distance=150.0,
edge_to_pad_distance=150.0,
size=size,
edge_to_grating_distance=edge_to_grating_distance,
edge_to_pad_distance=edge_to_pad_distance,
grating_coupler=grating_coupler,
grating_pitch=250.0,
layer_floorplan=LAYER.FLOORPLAN,
ngratings=14,
npads=31,
pad="pad",
pad_pitch=300.0,
size=(11470.0, 4900.0),
grating_pitch=grating_pitch,
layer_floorplan=layer_floorplan,
ngratings=ngratings,
npads=npads,
pad=pad,
pad_pitch=pad_pitch,
cross_section=cross_section,
)


Expand All @@ -927,8 +947,7 @@ def die(cross_section="xs_sc") -> Component:
@gf.cell
def heater() -> Component:
"""Heater fixed cell."""
heater = gf.import_gds(PATH.gds / "Heater.gds")
return heater
return gf.import_gds(PATH.gds / "Heater.gds")


@gf.cell
Expand Down Expand Up @@ -1028,5 +1047,5 @@ def array(


if __name__ == "__main__":
c = coupler_symmetric()
c = grating_coupler_array()
c.show()
8 changes: 3 additions & 5 deletions cspdk/si500/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@
@gf.cell
def straight(
length: float = 10.0,
width: float | None = None,
cross_section: CrossSectionSpec = "xs_rc",
**kwargs,
) -> Component:
"""A straight waveguide.

Args:
length: the length of the waveguide.
width: the width of the waveguide.
cross_section: a cross section or its name or a function generating a cross section.
kwargs: additional arguments to pass to the straight function.
"""
if width is not None:
kwargs["width"] = width
kwargs["npoints"] = kwargs.get("npoints", 2)
return gf.c.straight(length=length, cross_section=cross_section, **kwargs)


Expand Down Expand Up @@ -519,6 +514,7 @@ def grating_coupler_array(
with_loopback=False,
rotation=-90,
straight_to_grating_spacing=10.0,
radius: float | None = None,
) -> Component:
"""An array of grating couplers.

Expand All @@ -532,6 +528,7 @@ def grating_coupler_array(
rotation: rotation angle for each reference.
straight_to_grating_spacing: spacing between the last grating coupler and the loopback.
cross_section: a cross section or its name or a function generating a cross section.
radius: optional radius for routing the loopback.
"""
if grating_coupler is None:
if isinstance(cross_section, str):
Expand All @@ -558,6 +555,7 @@ def grating_coupler_array(
port_name=port_name,
centered=centered,
cross_section=cross_section,
radius=radius,
)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
"Operating System :: OS Independent"
]
dependencies = [
"gdsfactory~=8.8.9",
"gdsfactory~=8.13.3",
"gplugins[sax]>=1,<2"
]
description = "CornerStone PDK"
Expand Down
6 changes: 0 additions & 6 deletions tests/test_si220/test_netlists_array_.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,3 @@ ports:
e4_1_4: pad_0_0<3.0>,e4
e4_1_5: pad_0_0<4.0>,e4
e4_1_6: pad_0_0<5.0>,e4
pad_1_1: pad_0_0<0.0>,pad
pad_1_2: pad_0_0<1.0>,pad
pad_1_3: pad_0_0<2.0>,pad
pad_1_4: pad_0_0<3.0>,pad
pad_1_5: pad_0_0<4.0>,pad
pad_1_6: pad_0_0<5.0>,pad
Loading