Skip to content

Commit

Permalink
Merge pull request #9 from gdsfactory/b135
Browse files Browse the repository at this point in the history
B135
  • Loading branch information
joamatab authored Mar 9, 2022
2 parents 249cfa6 + fbc8d74 commit 89ef749
Show file tree
Hide file tree
Showing 23 changed files with 115 additions and 65 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e .
lygadgets
gdsfactory[full]>=4.3.5
gdsfactory[full]==4.3.7
modes
41 changes: 0 additions & 41 deletions ubcpdk/add_pins.py

This file was deleted.

3 changes: 2 additions & 1 deletion ubcpdk/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
add_fiber_array,
)
from ubcpdk.components.cells import (
bend_euler,
dc_adiabatic,
dc_broadband_te,
dc_broadband_tm,
Expand All @@ -16,6 +15,7 @@
spiral,
y_adiabatic,
y_splitter,
bend_euler,
)
from ubcpdk.components.crossing import (
crossing,
Expand All @@ -37,6 +37,7 @@

factory = dict(
add_fiber_array=add_fiber_array,
bend_euler=bend_euler,
crossing=crossing,
dbr=dbr,
dbr_cavity=dbr_cavity,
Expand Down
1 change: 0 additions & 1 deletion ubcpdk/components/add_fiber_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,3 @@ def add_fiber_array(
c = pdk.straight()
c = add_fiber_array(component=c)
c.show()
c.pprint
22 changes: 15 additions & 7 deletions ubcpdk/components/cells.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""
Each partial function is equivalent to
""" Each partial function is equivalent to
def y_splitter() -> Component:
c = import_gds("ebeam_y_1550", rename_ports=True)
return c
"""

import gdsfactory as gf
from gdsfactory.add_pins import add_pins_bbox_siepic
from ubcpdk.import_gds import import_gds
from ubcpdk.add_pins import add_pins

from ubcpdk.components.straight import straight

Expand Down Expand Up @@ -44,7 +42,7 @@ def y_splitter() -> Component:
doc="Y junction TE1550 50/50 power.",
)

bend_euler = gf.partial(gf.components.bend_euler, decorator=add_pins)
bend_euler = gf.partial(gf.components.bend_euler, decorator=add_pins_bbox_siepic)
mzi = gf.partial(
gf.components.mzi, splitter=y_splitter, straight=straight, bend=bend_euler
)
Expand All @@ -65,6 +63,16 @@ def y_splitter() -> Component:
# print(c.ports.keys())
# c = straight()
# c = add_fiber_array(component=c)
c = mzi()
c = mzi(splitter=y_splitter)
# c = gc_te1550()
c.show()

# c = y_splitter()
# s = dc_adiabatic()

c = gf.Component()
s = y_splitter()
sp = c << s
wg = c << straight()
wg.connect("o1", sp.ports["o1"])

c.show(show_ports=False)
11 changes: 8 additions & 3 deletions ubcpdk/components/grating_couplers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import gdsfactory as gf
from ubcpdk.import_gds import import_gds, add_ports_renamed
from ubcpdk.import_gds import import_gds, add_ports_renamed_gratings


add_ports_rotate180 = gf.compose(gf.functions.rotate180, add_ports_renamed)
add_ports_rotate180 = gf.compose(gf.functions.rotate180, add_ports_renamed_gratings)


gc_te1550 = gf.partial(
import_gds,
Expand All @@ -12,6 +13,8 @@
wavelength=1.55,
)

# FIXME: move 1nm to the left, snapping issue?

gc_te1550_broadband = gf.partial(
import_gds,
"ebeam_gc_te1550_broadband.gds",
Expand Down Expand Up @@ -39,5 +42,7 @@


if __name__ == "__main__":
c = gc_te1550()
# c = gc_te1310()
c = gc_tm1550()
# c = gc_te1550()
c.show()
11 changes: 8 additions & 3 deletions ubcpdk/components/straight.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gdsfactory as gf

from ubcpdk.tech import LAYER
from ubcpdk.add_pins import add_pins
from gdsfactory.add_pins import add_pins_bbox_siepic


@gf.cell
Expand Down Expand Up @@ -36,10 +36,15 @@ def straight(

for i, text in enumerate(labels):
c.add_label(text=text, position=(length / 2, i * 0.1), layer=LAYER.DEVREC)
add_pins(c)
add_pins_bbox_siepic(c)
return c


if __name__ == "__main__":
c = straight()
c = gf.Component()
# s1 = c.add_ref(straight())

s1 = c << straight()
s2 = c << straight()
s2.connect("o2", s1.ports["o1"])
c.show(show_ports=False)
30 changes: 26 additions & 4 deletions ubcpdk/import_gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ubcpdk.tech import LAYER
from ubcpdk.config import PATH
from gdsfactory.add_pins import add_pins_bbox_siepic


layer = LAYER.WG
Expand Down Expand Up @@ -32,8 +33,19 @@ def guess_port_orientaton(position: ndarray, name: str, label: str, n: int) -> i
return 0


def remove_pins(component) -> Component:
"""Remove PINS and"""
# component.remove_labels(test=lambda x: True)
component.remove_layers(layers=(LAYER.DEVREC, LAYER.PORT))
component.paths = []
component._bb_valid = False
return component


def add_ports(component: Component) -> Component:
"""Add ports from labels."""
"""Add ports from labels.
guessing port orientaton from port location
"""

c = component
n = 0
Expand All @@ -44,6 +56,7 @@ def add_ports(component: Component) -> Component:
for label in c.get_labels():
if label.text.startswith("opt"):
port_name = label.text
print(label.position)
port = gf.Port(
name=port_name,
midpoint=label.position,
Expand All @@ -58,16 +71,25 @@ def add_ports(component: Component) -> Component:
)
if port_name not in c.ports:
c.add_port(port)

return c


add_ports_renamed = gf.compose(gf.port.auto_rename_ports, add_ports)
# gratings have a 2nm square that is sticking out 1nm
add_pins_gratings = gf.partial(add_pins_bbox_siepic, padding=-1e-3)

add_ports_renamed = gf.compose(
add_pins_bbox_siepic, gf.port.auto_rename_ports, remove_pins, add_ports
)
add_ports_renamed_gratings = gf.compose(
add_pins_gratings, gf.port.auto_rename_ports, remove_pins, add_ports
)

import_gds = gf.partial(gf.import_gds, gdsdir=PATH.gds, decorator=add_ports_renamed)


if __name__ == "__main__":
gdsname = "ebeam_y_1550.gds"
c = import_gds(gdsname)
print(c.ports)
c.show()
# print(c.ports)
c.show(show_ports=False)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/ebeam_bdc_te1550.gds
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/ebeam_bdc_tm1550.gds
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/ebeam_crossing4.gds
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/ebeam_y_1550.gds
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/ebeam_y_adiabatic.gds
Binary file not shown.
Binary file not shown.
Binary file modified ubcpdk/tests/test_components.gds/gds_ref/rotate_f258530e.gds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ settings:
changed:
bend:
decorator:
function: add_pins
- function: add_bbox_siepic
- function: add_pins_siepic
function: bend_euler
component:
function: straight
fanout_length: 0
grating_coupler:
decorator:
- - function: add_ports
- function: remove_pins
- function: auto_rename_ports
- function: add_pins_siepic_of_add_bbox_siepic
padding: -0.001
- angle: 180
function: rotate
function: import_gds
Expand Down Expand Up @@ -101,7 +105,8 @@ settings:
full:
bend:
decorator:
function: add_pins
- function: add_bbox_siepic
- function: add_pins_siepic
function: bend_euler
component:
function: straight
Expand All @@ -116,7 +121,10 @@ settings:
grating_coupler:
decorator:
- - function: add_ports
- function: remove_pins
- function: auto_rename_ports
- function: add_pins_siepic_of_add_bbox_siepic
padding: -0.001
- angle: 180
function: rotate
function: import_gds
Expand All @@ -138,7 +146,7 @@ settings:
info: {}
info_version: 2
module: gdsfactory.routing.add_fiber_array
name: straight_87bde41b_strai_326a6368
name: straight_87bde41b_strai_c1713dff
default:
component:
function: straight
Expand All @@ -150,7 +158,10 @@ settings:
grating_coupler:
decorator:
- - function: add_ports
- function: remove_pins
- function: auto_rename_ports
- function: add_pins_siepic_of_add_bbox_siepic
padding: -0.001
- angle: 180
function: rotate
function: import_gds
Expand All @@ -171,7 +182,10 @@ settings:
grating_coupler:
decorator:
- - function: add_ports
- function: remove_pins
- function: auto_rename_ports
- function: add_pins_siepic_of_add_bbox_siepic
padding: -0.001
- angle: 180
function: rotate
function: import_gds
Expand All @@ -185,5 +199,5 @@ settings:
info: {}
info_version: 2
module: ubcpdk.components.add_fiber_array
name: straight_87bde41b_strai_f2d83180
name: straight_87bde41b_strai_83238d66
version: 0.0.1
37 changes: 37 additions & 0 deletions ubcpdk/tests/test_components/test_pdk_settings_bend_euler_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
settings:
changed:
decorator:
- function: add_bbox_siepic
- function: add_pins_siepic
child: null
default:
angle: 90
cross_section:
function: cross_section
direction: ccw
npoints: 720
p: 0.5
with_arc_floorplan: true
with_cladding_box: true
full:
angle: 90
cross_section:
function: cross_section
decorator:
- function: add_bbox_siepic
- function: add_pins_siepic
direction: ccw
npoints: 720
p: 0.5
with_arc_floorplan: true
with_cladding_box: true
function_name: bend_euler
info:
dy: 10.0
length: 16.637
radius: 10.0
radius_min: 7.061
info_version: 2
module: gdsfactory.components.bend_euler
name: bend_euler_92fd2590
version: 0.0.1

0 comments on commit 89ef749

Please sign in to comment.