diff --git a/gdsfactory/components/coupler_straight_asymmetric.py b/gdsfactory/components/coupler_straight_asymmetric.py index 95355236e6..72a89c462c 100644 --- a/gdsfactory/components/coupler_straight_asymmetric.py +++ b/gdsfactory/components/coupler_straight_asymmetric.py @@ -24,9 +24,8 @@ def coupler_straight_asymmetric( """ component = Component() - xs = gf.get_cross_section(cross_section) - xs_top = xs.copy(width=width_top) - xs_bot = xs.copy(width=width_bot) + xs_top = gf.get_cross_section(cross_section, width=width_top) + xs_bot = gf.get_cross_section(cross_section, width=width_bot) top = component << straight(length=length, cross_section=xs_top) bot = component << straight(length=length, cross_section=xs_bot) diff --git a/gdsfactory/components/dbr_tapered.py b/gdsfactory/components/dbr_tapered.py index 7cf256f65f..040c5d3a43 100644 --- a/gdsfactory/components/dbr_tapered.py +++ b/gdsfactory/components/dbr_tapered.py @@ -97,23 +97,17 @@ def dbr_tapered( c = gf.Component() xs = gf.get_cross_section(cross_section=cross_section, width=w2, **kwargs) + xs1 = gf.get_cross_section(cross_section=cross_section, width=xs.width, **kwargs) + xs2 = gf.get_cross_section(cross_section=cross_section, width=w1, **kwargs) input_taper = c << gf.components.taper( - length=taper_length, - width1=xs.width, - width2=w1, - cross_section=xs.copy(width=xs.width), + length=taper_length, width1=xs.width, width2=w1, cross_section=xs1 ) - straight = c << gf.components.straight( - length=length, cross_section=xs.copy(width=w1) - ) + straight = c << gf.components.straight(length=length, cross_section=xs2) output_taper = c << gf.components.taper( - length=taper_length, - width1=w1, - width2=xs.width, - cross_section=xs.copy(width=xs.width), + length=taper_length, width1=w1, width2=xs.width, cross_section=xs1 ) input_taper.connect("o2", straight.ports["o1"]) @@ -150,5 +144,5 @@ def dbr_tapered( if __name__ == "__main__": # c = dbr_tapered(length=10, period=0.85, dc=0.5, w2=1, w1=0.4, taper_length=20, fins=True) - c = dbr_tapered() + c = dbr_tapered(cross_section=gf.cross_section.rib) c.show(show_ports=True) diff --git a/gdsfactory/components/mmi.py b/gdsfactory/components/mmi.py index 602037d675..5438254898 100644 --- a/gdsfactory/components/mmi.py +++ b/gdsfactory/components/mmi.py @@ -66,7 +66,7 @@ def mmi( w_mmi = width_mmi w_taper = width_taper x = gf.get_cross_section(cross_section) - xs_mmi = x.copy(width=w_mmi) + xs_mmi = gf.get_cross_section(cross_section, width=w_mmi) width = width or x.width _taper = taper( diff --git a/gdsfactory/components/mmi1x2.py b/gdsfactory/components/mmi1x2.py index 7a8b915d31..d502449857 100644 --- a/gdsfactory/components/mmi1x2.py +++ b/gdsfactory/components/mmi1x2.py @@ -60,7 +60,7 @@ def mmi1x2( c = Component() gap_mmi = gf.snap.snap_to_grid(gap_mmi, grid_factor=2) x = gf.get_cross_section(cross_section, **kwargs) - xs_mmi = x.copy(width=width_mmi) + xs_mmi = gf.get_cross_section(cross_section, width=width_mmi) width = width or x.width _taper = taper( diff --git a/gdsfactory/components/mmi2x2.py b/gdsfactory/components/mmi2x2.py index bca3e94ef7..8179d545ce 100644 --- a/gdsfactory/components/mmi2x2.py +++ b/gdsfactory/components/mmi2x2.py @@ -61,7 +61,7 @@ def mmi2x2( gap_mmi = gf.snap.snap_to_grid(gap_mmi, grid_factor=2) w_taper = width_taper x = gf.get_cross_section(cross_section, **kwargs) - xs_mmi = x.copy(width=width_mmi) + xs_mmi = gf.get_cross_section(cross_section, width=width_mmi) width = width or x.width _taper = taper( diff --git a/gdsfactory/components/mzit.py b/gdsfactory/components/mzit.py index b3ce8919ad..4273a93d1e 100644 --- a/gdsfactory/components/mzit.py +++ b/gdsfactory/components/mzit.py @@ -77,8 +77,8 @@ def mzit( c = gf.Component() xs = gf.get_cross_section(cross_section) - xs1 = xs.copy(width=w1) - xs2 = xs.copy(width=w2) + xs1 = gf.get_cross_section(cross_section, width=w1) + xs2 = gf.get_cross_section(cross_section, width=w2) cp2 = c << coupler2( length=coupler_length2, diff --git a/gdsfactory/components/taper_adiabatic.py b/gdsfactory/components/taper_adiabatic.py index 1a4278855e..8a35ef3b71 100644 --- a/gdsfactory/components/taper_adiabatic.py +++ b/gdsfactory/components/taper_adiabatic.py @@ -63,6 +63,8 @@ def taper_adiabatic( npoints: number of points for sampling """ xs = gf.get_cross_section(cross_section) + xs1 = gf.get_cross_section(cross_section, width=width1) + xs2 = gf.get_cross_section(cross_section, width=width2) layer = xs.layer # Obtain optimal curve @@ -88,11 +90,6 @@ def taper_adiabatic( c.add_polygon( list(zip(x_array, y_array)) + list(zip(x_array, -y_array))[::-1], layer=layer ) - - # Define ports - xs1 = xs.copy(width=width1) - xs2 = xs.copy(width=width2) - c.add_port( name="o1", center=(0, 0), diff --git a/gdsfactory/routing/get_bundle.py b/gdsfactory/routing/get_bundle.py index d2e4d6d376..473aa7f375 100644 --- a/gdsfactory/routing/get_bundle.py +++ b/gdsfactory/routing/get_bundle.py @@ -161,8 +161,7 @@ def test_north_to_south(): xs_list = [] for element in cross_section: xs, angles = element - xs = gf.get_cross_section(xs) - xs = xs.copy(**kwargs) # Shallow copy + xs = gf.get_cross_section(xs, **kwargs) xs_list.append((xs, angles)) cross_section = xs_list diff --git a/gdsfactory/routing/get_bundle_from_waypoints.py b/gdsfactory/routing/get_bundle_from_waypoints.py index 88b65ccc43..ac0bbf4fc5 100644 --- a/gdsfactory/routing/get_bundle_from_waypoints.py +++ b/gdsfactory/routing/get_bundle_from_waypoints.py @@ -130,14 +130,12 @@ def get_bundle_from_waypoints( xs_list = [] for element in cross_section: xs, angles = element - xs = gf.get_cross_section(xs) - xs = xs.copy(**kwargs) # Shallow copy + xs = gf.get_cross_section(xs, **kwargs) xs_list.append((xs, angles)) cross_section = xs_list else: - cross_section = gf.get_cross_section(cross_section) - xs = cross_section = cross_section.copy(**kwargs) + xs = cross_section = gf.get_cross_section(cross_section, **kwargs) waypoints = [ports1[0].center] + list(waypoints) + [ports2[0].center] for p in ports1: diff --git a/gdsfactory/routing/get_route.py b/gdsfactory/routing/get_route.py index 543d5bfe4c..7f237cb994 100644 --- a/gdsfactory/routing/get_route.py +++ b/gdsfactory/routing/get_route.py @@ -110,14 +110,12 @@ def get_route( xs_list = [] for element in cross_section: xs, angles = element - xs = gf.get_cross_section(xs) - xs = xs.copy(**kwargs) # Shallow copy + xs = gf.get_cross_section(xs, **kwargs) xs_list.append((xs, angles)) cross_section = xs_list elif cross_section: - cross_section = gf.get_cross_section(cross_section) - x = cross_section = cross_section.copy(**kwargs) + x = cross_section = gf.get_cross_section(cross_section, **kwargs) else: x = cross_section = None diff --git a/gdsfactory/routing/get_route_from_steps.py b/gdsfactory/routing/get_route_from_steps.py index 6683328f04..bce89ff2c0 100644 --- a/gdsfactory/routing/get_route_from_steps.py +++ b/gdsfactory/routing/get_route_from_steps.py @@ -107,14 +107,13 @@ def get_route_from_steps( for element in cross_section: xs, angles = element xs = gf.get_cross_section(xs) - xs = xs.copy(**kwargs) # Shallow copy + xs = gf.get_cross_section(xs, **kwargs) xs_list.append((xs, angles)) cross_section = xs_list else: - cross_section = gf.get_cross_section(cross_section) - x = cross_section = cross_section.copy(**kwargs) - auto_widen = x.auto_widen + cross_section = gf.get_cross_section(cross_section, **kwargs) + auto_widen = cross_section.auto_widen if auto_widen: taper = gf.get_component(