Skip to content

Commit

Permalink
Merge pull request #58 from gdsfactory/update_gdsfactory
Browse files Browse the repository at this point in the history
update to gdsfactory 8.4.0
  • Loading branch information
joamatab authored Jul 1, 2024
2 parents b62ad61 + f4080b9 commit cff8f7f
Show file tree
Hide file tree
Showing 42 changed files with 318 additions and 387 deletions.
82 changes: 71 additions & 11 deletions docs/cells.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ bend_euler

import gvtt

c = gvtt.components.bend_euler(angle=90.0, p=1.0, with_arc_floorplan=False, direction='ccw', with_bbox=True, cross_section='strip')
c.plot_matplotlib()
c = gvtt.components.bend_euler(angle=90.0, p=1.0, with_arc_floorplan=False, direction='ccw', with_bbox=True)
c.plot()



Expand All @@ -33,7 +33,7 @@ die
import gvtt

c = gvtt.components.die(size=(5000.0, 9500.0), street_width=75.0, street_length=1000.0, die_name='chip99', text_size=100.0, text_location='SW', draw_corners=True, draw_dicing_lane=True)
c.plot_matplotlib()
c.plot()



Expand All @@ -48,7 +48,7 @@ edge_coupler_rib
import gvtt

c = gvtt.components.edge_coupler_rib(edge_coupling_width=3.0, polishing_length=25.0, side='W', xpos=0.0, ypos=0.0)
c.plot_matplotlib()
c.plot()



Expand All @@ -62,8 +62,8 @@ mmi1x2

import gvtt

c = gvtt.components.mmi1x2(width_taper=1.875, length_taper=1.0, length_mmi=43.25, width_mmi=6.25, gap_mmi=1.25, with_bbox=True)
c.plot_matplotlib()
c = gvtt.components.mmi1x2(width=1.874, width_taper=1.874, length_taper=1.0, length_mmi=43.25, width_mmi=6.25, gap_mmi=1.251, cross_section='xs_sc')
c.plot()



Expand All @@ -77,8 +77,8 @@ mmi2x2

import gvtt

c = gvtt.components.mmi2x2(width_taper=1.875, length_taper=1.0, length_mmi=112.0, width_mmi=5.0, gap_mmi=1.25, with_bbox=True)
c.plot_matplotlib()
c = gvtt.components.mmi2x2(width_taper=1.874, length_taper=1.0, length_mmi=112.0, width_mmi=5, gap_mmi=1.25, cross_section='xs_sc')
c.plot()



Expand All @@ -93,7 +93,7 @@ rib_taper
import gvtt

c = gvtt.components.rib_taper(width1=1, width2=1, taper_ratio=50.0)
c.plot_matplotlib()
c.plot()



Expand All @@ -108,7 +108,52 @@ rib_to_strip
import gvtt

c = gvtt.components.rib_to_strip(length=200.0, width1=3.0, width2=3.0)
c.plot_matplotlib()
c.plot()



straight
----------------------------------------------------

.. autofunction:: gvtt.components.straight

.. plot::
:include-source:

import gvtt

c = gvtt.components.straight(length=10.0, npoints=2)
c.plot()



straight_rib
----------------------------------------------------

.. autofunction:: gvtt.components.straight_rib

.. plot::
:include-source:

import gvtt

c = gvtt.components.straight_rib(length=10.0, npoints=2)
c.plot()



straight_sc
----------------------------------------------------

.. autofunction:: gvtt.components.straight_sc

.. plot::
:include-source:

import gvtt

c = gvtt.components.straight_sc(length=10.0, npoints=2)
c.plot()



Expand All @@ -123,4 +168,19 @@ strip_taper
import gvtt

c = gvtt.components.strip_taper(width1=1, width2=1, taper_ratio=25.0)
c.plot_matplotlib()
c.plot()



strip_to_rib
----------------------------------------------------

.. autofunction:: gvtt.components.strip_to_rib

.. plot::
:include-source:

import gvtt

c = gvtt.components.strip_to_rib(length=200.0, width1=3.0, width2=3.0)
c.plot()
4 changes: 2 additions & 2 deletions examples/python/tutorial-1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
s2 = c << straight

# Reverse the direction of two of the bends.
b2.mirror()
b3.mirror()
b2.dmirror()
b3.dmirror()

# Each component has ports defined. Connecting moves the component so the ports are matching.
b1.connect("o1", s1.ports["o2"])
Expand Down
4 changes: 2 additions & 2 deletions examples/python/tutorial-2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def arm(angle: float = 90.0) -> gf.Component:

s1.connect("o2", b1.ports["o1"])

b2.mirror()
b3.mirror()
b2.dmirror()
b3.dmirror()

b2.connect("o1", b1.ports["o2"])
b3.connect("o1", b2.ports["o2"])
Expand Down
6 changes: 3 additions & 3 deletions examples/python/tutorial-3.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def arm(angle: float = 90.0) -> gf.Component:

s1.connect("o2", b1.ports["o1"])

b2.mirror()
b3.mirror()
b2.dmirror()
b3.dmirror()

b2.connect("o1", b1.ports["o2"])
b3.connect("o1", b2.ports["o2"])
Expand All @@ -36,7 +36,7 @@ def arm(angle: float = 90.0) -> gf.Component:
c = gf.Component("training-3")
a1 = c << arm()
a2 = c << arm()
a2.mirror()
a2.dmirror()

mmi = gf.get_component("mmi1x2")

Expand Down
6 changes: 3 additions & 3 deletions examples/python/tutorial-4.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def arm(angle: float = 90.0) -> gf.Component:

s1.connect("o2", b1.ports["o1"])

b2.mirror()
b3.mirror()
b2.dmirror()
b3.dmirror()

b2.connect("o1", b1.ports["o2"])
b3.connect("o1", b2.ports["o2"])
Expand All @@ -39,7 +39,7 @@ def mzi() -> gf.Component:
c = gf.Component("mzi")
a1 = c << arm()
a2 = c << arm()
a2.mirror()
a2.dmirror()

mmi = gf.get_component("mmi1x2")

Expand Down
22 changes: 11 additions & 11 deletions examples/python/tutorial-5.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def arm():

s1.connect("o2", b1.ports["o1"])

b2.mirror()
b3.mirror()
b2.dmirror()
b3.dmirror()

b2.connect("o1", b1.ports["o2"])
b3.connect("o1", b2.ports["o2"])
Expand All @@ -39,7 +39,7 @@ def mzi():
c = gf.Component("mzi")
a1 = c << arm()
a2 = c << arm()
a2.mirror()
a2.dmirror()

mmi = gf.get_component("mmi1x2")

Expand All @@ -60,21 +60,21 @@ def mzi():
if __name__ == "__main__":
c = gf.Component(name="training-5")
mymzi = c << mzi()
mymzi.rotate(45)
mymzi.x = 0.0
mymzi.drotate(45)
mymzi.dx = 0.0

die = c << gf.get_component("die")

p1 = c << gvtt.components.edge_coupler_rib()
p1.xmin = die.xmin + die.info["frame_margin"]
p1.y = -250
p1.dxmin = die.dxmin + die.info["frame_margin"]
p1.dy = -250

p2 = c << gvtt.components.edge_coupler_rib()
p2.rotate(180)
p2.xmin = die.xmax - die.info["frame_margin"]
p2.y = 250
p2.drotate(180)
p2.dxmin = die.dxmax - die.info["frame_margin"]
p2.dy = 250

routes = gf.routing.get_bundle_all_angle(
routes = gf.routing.route_bundle_all_angle(
[mymzi.ports["o1"], mymzi.ports["o2"]], [p1.ports["o1"], p2.ports["o1"]]
)

Expand Down
20 changes: 10 additions & 10 deletions gvtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

import gdsfactory
from gdsfactory.config import PATH as GPATH
from gdsfactory.get_factories import get_cells
from gdsfactory.pdk import Pdk, constants
from gdsfactory.technology import LayerViews

from gvtt import components
from gvtt.config import PATH
from gvtt.layers import LAYER
from gvtt.xsections import cross_sections
from gvtt.tech import cross_sections

cells = get_cells([components])

Expand Down Expand Up @@ -44,13 +44,13 @@
(LAYER.TYPE_STRIP, LAYER.TYPE_RIB): "strip_to_rib",
}

LAYER_VIEWS = None # LayerViews(filepath=PATH.klayout_yaml)
LAYER_VIEWS = LayerViews(filepath=PATH.lyp_yaml)

PDK = Pdk(
name="VTT-3umSOI",
cells=cells,
cross_sections=cross_sections,
layers=dict(LAYER),
layers=LAYER,
layer_stack=None,
layer_views=LAYER_VIEWS,
layer_transitions=LAYER_TRANSITIONS,
Expand All @@ -61,12 +61,12 @@

# pdk.register_cells_yaml(dirpath=pathlib.Path(__file__).parent.absolute())

gdsfactory.routing.all_angle.LOW_LOSS_CROSS_SECTIONS = [
{"cross_section": "rib", "settings": {"width": 2.5}},
{"cross_section": "xs_sc", "settings": {"width": 6.0}},
{"cross_section": "xs_sc", "settings": {"width": 3.0}},
]

# gdsfactory.routing.all_angle.LOW_LOSS_CROSS_SECTIONS = [
# {"cross_section": "rib", "settings": {"width": 2.5}},
# {"cross_section": "xs_sc", "settings": {"width": 6.0}},
# {"cross_section": "xs_sc", "settings": {"width": 3.0}},
# ]
#
PDK.activate()
__version__ = "0.0.4"

Expand Down
2 changes: 1 addition & 1 deletion gvtt/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
strip_to_rib,
xs_rib_strip,
)
from gvtt.xsections import straight, straight_rib, straight_sc
from gvtt.tech import straight, straight_rib, straight_sc

__all__ = [
"bend_euler",
Expand Down
30 changes: 15 additions & 15 deletions gvtt/components/bend_euler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from gdsfactory.path import euler
from gdsfactory.typings import CrossSectionSpec, Optional

from gvtt.tech import xs_sc


def _eulerR_1550(angle: float) -> float:
if angle == 0:
Expand All @@ -24,7 +26,7 @@ def bend_euler(
npoints: Optional[int] = None,
direction: str = "ccw",
with_bbox: bool = True,
cross_section: CrossSectionSpec = "xs_sc",
cross_section: CrossSectionSpec = xs_sc,
**kwargs,
) -> Component:
"""Returns an euler bend that transitions from straight to curved.
Expand Down Expand Up @@ -60,31 +62,31 @@ def bend_euler(
o1_____/
"""

x = gf.get_cross_section(cross_section, **kwargs)
dx = gf.get_cross_section(cross_section, **kwargs)
radius = _eulerR_1550(abs(angle))

if radius is None:
return wire_corner(cross_section=x)
return wire_corner(cross_section=dx)

c = Component()

p = euler(
radius=radius, angle=angle, p=p, use_eff=with_arc_floorplan, npoints=npoints
)

ref = c << p.extrude(x)
ref = c << p.extrude(dx)
c.info["length"] = float(np.round(p.length(), 3))
c.info["dy"] = float(np.round(abs(float(p.points[0][0] - p.points[-1][0])), 3))
c.info["radius_min"] = float(np.round(p.info["Rmin"], 3))
c.info["radius"] = float(p.xmax)
c.info["width"] = float(x.width)
c.info["radius"] = float(p.dxmax)
c.info["width"] = float(dx.width)

if with_bbox and x.bbox_layers:
if with_bbox and dx.bbox_layers:
padding = []
angle = int(angle)
for offset in x.bbox_offsets:
top = offset if angle in [180, -180, -90] else 0
bottom = 0 if angle in [-90] else offset
for offset in dx.bbox_offsets:
top = offset if angle in {180, -180, -90} else 0
bottom = 0 if angle in {-90} else offset
points = get_padding_points(
component=c,
default=0,
Expand All @@ -94,18 +96,16 @@ def bend_euler(
)
padding.append(points)

for layer, points in zip(x.bbox_layers, padding):
for layer, points in zip(dx.bbox_layers, padding):
c.add_polygon(points, layer=layer)

if direction == "cw":
ref.mirror(p1=[0, 0], p2=[1, 0])
ref.dmirror(p1=[0, 0], p2=[1, 0])

c.add_ports(ref.ports)
c.absorb(ref)

return c


if __name__ == "__main__":
c = bend_euler()
c.show(show_ports=True)
c.show()
Loading

0 comments on commit cff8f7f

Please sign in to comment.