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

fix taper #2575

Merged
merged 2 commits into from Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 18 additions & 4 deletions gdsfactory/components/grating_coupler_rectangular.py
Expand Up @@ -19,7 +19,7 @@
polarization: str = "te",
wavelength: float = 1.55,
taper: ComponentSpec = taper_function,
layer_slab: LayerSpec | None = "SLAB150",
layer_slab: LayerSpec | None = None,
fiber_angle: float = 15,
slab_xmin: float = -1.0,
slab_offset: float = 1.0,
Expand Down Expand Up @@ -102,9 +102,23 @@
c.info["polarization"] = polarization
c.info["wavelength"] = wavelength
gf.asserts.grating_coupler(c)
slab_xmin = length_taper

for section in xs.sections[1:]:
slab_xsize = cgrating.xmax + section.width / 2
slab_ysize = cgrating.ysize + section.width
yslab = slab_ysize / 2
c.add_polygon(

Check warning on line 111 in gdsfactory/components/grating_coupler_rectangular.py

View check run for this annotation

Codecov / codecov/patch

gdsfactory/components/grating_coupler_rectangular.py#L108-L111

Added lines #L108 - L111 were not covered by tests
[
(slab_xmin, yslab),
(slab_xsize, yslab),
(slab_xsize, -yslab),
(slab_xmin, -yslab),
],
layer=section.layer,
)

if layer_slab:
slab_xmin += length_taper
slab_xsize = cgrating.xmax + slab_offset
slab_ysize = c.ysize + 2 * slab_offset
yslab = slab_ysize / 2
Expand Down Expand Up @@ -135,7 +149,7 @@

if __name__ == "__main__":
# c = grating_coupler_rectangular(name='gcu', partial_etch=True)
# c = grating_coupler_rectangular()
c = gf.routing.add_fiber_array(grating_coupler=grating_coupler_rectangular)
gc = grating_coupler_rectangular(cross_section="xs_rc")
c = gf.routing.add_fiber_array(grating_coupler=gc)
print(c.ports)
c.show(show_ports=False)
50 changes: 27 additions & 23 deletions gdsfactory/components/taper.py
Expand Up @@ -66,6 +66,8 @@
if isinstance(port, gf.Port) and width1 is None:
width1 = port.width

delta_width = width2 - width1

length = float(snap_to_grid(length))
y1 = width1 / 2
y2 = width2 / 2
Expand All @@ -80,12 +82,13 @@
layer = section.layer
if not section.offset:
y1 = section.width / 2
y2 = section.width / 2
y2 = section.width / 2 + delta_width / 2

Check warning on line 85 in gdsfactory/components/taper.py

View check run for this annotation

Codecov / codecov/patch

gdsfactory/components/taper.py#L85

Added line #L85 was not covered by tests
ypts = [y1, y2, -y2, -y1]
c.add_polygon((xpts, ypts), layer=layer)
else:
y1 = section.width / 2
y2 = section.width / 2
y2 = section.width / 2 + delta_width / 2
ypts = [y1, y2, -y2, -y1]
ypts = [y - section.offset for y in ypts]
c.add_polygon((xpts, ypts), layer=layer)
Expand Down Expand Up @@ -282,26 +285,27 @@


if __name__ == "__main__":
xs_pin_m1 = partial(
gf.cross_section.strip_auto_widen,
width=0.5,
width_wide=2,
sections=(
gf.Section(width=1, offset=2, layer=(24, 0), name="n+"),
gf.Section(width=1, offset=3, layer=(41, 0), name="m1"),
),
)
# c = taper(width2=10, length=10)
# c = taper_strip_to_ridge_trenches()
# c = taper_strip_to_ridge()
# c = taper(width1=1.5, width2=1, cross_section="xs_rc")
# c = taper_sc_nc()
c = gf.Component("taper_with_offset")
route = gf.routing.get_route_from_waypoints(
[(0, 0), (300, 0), (300, 300), (300, 600), (600, 600)],
# cross_section="xs_sc_auto_widen",
cross_section=xs_pin_m1,
radius=30,
)
c.add(route.references)
c = taper(cross_section="xs_rc", width2=1, length=1)
# xs_pin_m1 = partial(
# gf.cross_section.strip_auto_widen,
# width=0.5,
# width_wide=2,
# sections=(
# gf.Section(width=1, offset=2, layer=(24, 0), name="n+"),
# gf.Section(width=1, offset=3, layer=(41, 0), name="m1"),
# ),
# )
# # c = taper(width2=10, length=10)
# # c = taper_strip_to_ridge_trenches()
# # c = taper_strip_to_ridge()
# # c = taper(width1=1.5, width2=1, cross_section="xs_rc")
# # c = taper_sc_nc()
# c = gf.Component("taper_with_offset")
# route = gf.routing.get_route_from_waypoints(
# [(0, 0), (300, 0), (300, 300), (300, 600), (600, 600)],
# # cross_section="xs_sc_auto_widen",
# cross_section=xs_pin_m1,
# radius=30,
# )
# c.add(route.references)
c.show(show_ports=False)
Expand Up @@ -8,7 +8,7 @@ settings:
cross_section: xs_sc
fiber_angle: 15
fill_factor: 0.5
layer_slab: SLAB150
layer_slab: null
length_taper: 150.0
n_periods: 20
period: 0.75
Expand Down