diff --git a/docs/notebooks/12_sim_plugins_tidy3d.ipynb b/docs/notebooks/12_sim_plugins_tidy3d.ipynb index b8135467..338d512a 100644 --- a/docs/notebooks/12_sim_plugins_tidy3d.ipynb +++ b/docs/notebooks/12_sim_plugins_tidy3d.ipynb @@ -236,7 +236,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01c019da", + "id": "c4c38679", "metadata": {}, "outputs": [], "source": [] diff --git a/pyproject.toml b/pyproject.toml index fc7ad74e..f44610ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,8 +15,8 @@ classifiers = [ "Operating System :: OS Independent" ] dependencies = [ - "gdsfactory==7.17.0", - "gplugins[tidy3d,sax,schematic]>=0.10,<0.11" + "gdsfactory==7.18.0", + "gplugins[tidy3d,sax,schematic]>=0.10.2,<0.11" ] description = "ubcpdk pdk" keywords = ["python"] diff --git a/tests/ref/add_fiber_array_add_fiber_array_add_fiber_array.gds b/tests/ref/add_fiber_array_add_fiber_array_add_fiber_array.gds index 4c16225a..9b537c18 100644 Binary files a/tests/ref/add_fiber_array_add_fiber_array_add_fiber_array.gds and b/tests/ref/add_fiber_array_add_fiber_array_add_fiber_array.gds differ diff --git a/tests/ref/add_fiber_array_pads_rf.gds b/tests/ref/add_fiber_array_pads_rf.gds index 92c8c210..15acb013 100644 Binary files a/tests/ref/add_fiber_array_pads_rf.gds and b/tests/ref/add_fiber_array_pads_rf.gds differ diff --git a/tests/ref/mzi_mzi_0e264d4b.gds b/tests/ref/mzi_mzi_0e264d4b.gds new file mode 100644 index 00000000..df832edc Binary files /dev/null and b/tests/ref/mzi_mzi_0e264d4b.gds differ diff --git a/tests/ref/mzi_mzi_5a8609eb.gds b/tests/ref/mzi_mzi_5a8609eb.gds new file mode 100644 index 00000000..47fcf615 Binary files /dev/null and b/tests/ref/mzi_mzi_5a8609eb.gds differ diff --git a/tests/ref/ring_double_heater_ring_double_heater_30105b49.gds b/tests/ref/ring_double_heater_ring_double_heater_30105b49.gds new file mode 100644 index 00000000..13079457 Binary files /dev/null and b/tests/ref/ring_double_heater_ring_double_heater_30105b49.gds differ diff --git a/tests/ref/ring_double_ring_double_b0e5609f.gds b/tests/ref/ring_double_ring_double_b0e5609f.gds new file mode 100644 index 00000000..333c112e Binary files /dev/null and b/tests/ref/ring_double_ring_double_b0e5609f.gds differ diff --git a/tests/ref/ring_single_dut_ring_single_dut_ec96572d.gds b/tests/ref/ring_single_dut_ring_single_dut_ec96572d.gds new file mode 100644 index 00000000..b31cb486 Binary files /dev/null and b/tests/ref/ring_single_dut_ring_single_dut_ec96572d.gds differ diff --git a/tests/ref/ring_single_heater_ring_single_heater_2c28c6d4.gds b/tests/ref/ring_single_heater_ring_single_heater_2c28c6d4.gds new file mode 100644 index 00000000..8efa2104 Binary files /dev/null and b/tests/ref/ring_single_heater_ring_single_heater_2c28c6d4.gds differ diff --git a/tests/ref/ring_single_ring_single_f7a07c6e.gds b/tests/ref/ring_single_ring_single_f7a07c6e.gds new file mode 100644 index 00000000..b9b6dd2b Binary files /dev/null and b/tests/ref/ring_single_ring_single_f7a07c6e.gds differ diff --git a/tests/ref/straight_straight_af6b139c.gds b/tests/ref/straight_straight_af6b139c.gds new file mode 100644 index 00000000..527aa2e5 Binary files /dev/null and b/tests/ref/straight_straight_af6b139c.gds differ diff --git a/tests/test_components/test_pdk_settings_add_fiber_array_.yml b/tests/test_components/test_pdk_settings_add_fiber_array_.yml index f8f274b0..517c32f6 100644 --- a/tests/test_components/test_pdk_settings_add_fiber_array_.yml +++ b/tests/test_components/test_pdk_settings_add_fiber_array_.yml @@ -15,7 +15,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 @@ -32,6 +32,7 @@ settings: function: get_input_labels grating_coupler: function: gc_te1550 + info: null layer_label: - 10 - 0 @@ -43,7 +44,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_add_pads_dc_.yml b/tests/test_components/test_pdk_settings_add_pads_dc_.yml index c4464de8..4d025a6e 100644 --- a/tests/test_components/test_pdk_settings_add_pads_dc_.yml +++ b/tests/test_components/test_pdk_settings_add_pads_dc_.yml @@ -11,6 +11,7 @@ settings: bend: function: wire_corner cross_section: xs_metal_routing + info: null pad_array: function: pad_array module: gdsfactory.components.pad diff --git a/tests/test_components/test_pdk_settings_add_pads_rf_.yml b/tests/test_components/test_pdk_settings_add_pads_rf_.yml index a822b984..b5c91837 100644 --- a/tests/test_components/test_pdk_settings_add_pads_rf_.yml +++ b/tests/test_components/test_pdk_settings_add_pads_rf_.yml @@ -5,6 +5,7 @@ name: ring_single_heater_add_electrical_pads_top_cc2475fe settings: component: ring_single_heater direction: top + info: null layer: MTOP pad_array: function: pad_array diff --git a/tests/test_components/test_pdk_settings_dbr_cavity_te_.yml b/tests/test_components/test_pdk_settings_dbr_cavity_te_.yml index 6a10bd9b..9b41f639 100644 --- a/tests/test_components/test_pdk_settings_dbr_cavity_te_.yml +++ b/tests/test_components/test_pdk_settings_dbr_cavity_te_.yml @@ -56,6 +56,7 @@ settings: function: get_input_labels grating_coupler: function: gc_te1550 + info: null layer_label: - 10 - 0 @@ -67,7 +68,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_mzi_.yml b/tests/test_components/test_pdk_settings_mzi_.yml index 77b848c7..c0da023d 100644 --- a/tests/test_components/test_pdk_settings_mzi_.yml +++ b/tests/test_components/test_pdk_settings_mzi_.yml @@ -1,7 +1,7 @@ function: mzi info: {} module: gdsfactory.components.mzi -name: mzi_0f25a097 +name: mzi_0e264d4b settings: add_electrical_ports_bot: true add_optical_ports_arms: false @@ -13,6 +13,7 @@ settings: cross_section_x_top: null delta_length: 10.0 extend_ports_straight_x: null + info: null length_x: 0.1 length_y: 2.0 mirror_bot: false @@ -30,7 +31,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_mzi_heater_.yml b/tests/test_components/test_pdk_settings_mzi_heater_.yml index ccdd2139..dd8dd650 100644 --- a/tests/test_components/test_pdk_settings_mzi_heater_.yml +++ b/tests/test_components/test_pdk_settings_mzi_heater_.yml @@ -1,7 +1,7 @@ function: mzi info: {} module: gdsfactory.components.mzi -name: mzi_a3e473ed +name: mzi_5a8609eb settings: add_electrical_ports_bot: true add_optical_ports_arms: false @@ -13,6 +13,7 @@ settings: cross_section_x_top: null delta_length: 10.0 extend_ports_straight_x: null + info: null length_x: 200 length_y: 2.0 mirror_bot: false @@ -30,7 +31,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_pad_.yml b/tests/test_components/test_pdk_settings_pad_.yml index 9bed9e4b..85fd0d7c 100644 --- a/tests/test_components/test_pdk_settings_pad_.yml +++ b/tests/test_components/test_pdk_settings_pad_.yml @@ -16,6 +16,7 @@ settings: - 0 bbox_offsets: - -1.8 + info: null layer: - 12 - 0 diff --git a/tests/test_components/test_pdk_settings_pad_array_.yml b/tests/test_components/test_pdk_settings_pad_array_.yml index 3dd2aa40..73852c30 100644 --- a/tests/test_components/test_pdk_settings_pad_array_.yml +++ b/tests/test_components/test_pdk_settings_pad_array_.yml @@ -6,6 +6,7 @@ module: gdsfactory.components.pad name: pad_array_2e24007e settings: columns: 6 + info: null orientation: 270 pad: function: pad diff --git a/tests/test_components/test_pdk_settings_ring_double_.yml b/tests/test_components/test_pdk_settings_ring_double_.yml index ab36201e..d7a7d687 100644 --- a/tests/test_components/test_pdk_settings_ring_double_.yml +++ b/tests/test_components/test_pdk_settings_ring_double_.yml @@ -1,7 +1,7 @@ function: ring_double info: {} module: gdsfactory.components.ring_double -name: ring_double_23a77142 +name: ring_double_b0e5609f settings: bend: function: bend_euler @@ -88,7 +88,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_ring_double_heater_.yml b/tests/test_components/test_pdk_settings_ring_double_heater_.yml index ee430025..db86f3dd 100644 --- a/tests/test_components/test_pdk_settings_ring_double_heater_.yml +++ b/tests/test_components/test_pdk_settings_ring_double_heater_.yml @@ -1,7 +1,7 @@ function: ring_double_heater info: {} module: gdsfactory.components.ring_double_heater -name: ring_double_heater_084a38b9 +name: ring_double_heater_30105b49 settings: bend: function: bend_euler @@ -92,7 +92,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_ring_single_.yml b/tests/test_components/test_pdk_settings_ring_single_.yml index 0d10923f..433cd454 100644 --- a/tests/test_components/test_pdk_settings_ring_single_.yml +++ b/tests/test_components/test_pdk_settings_ring_single_.yml @@ -1,7 +1,7 @@ function: ring_single info: {} module: gdsfactory.components.ring_single -name: ring_single_a02af6db +name: ring_single_f7a07c6e settings: bend: function: bend_euler_sc @@ -90,7 +90,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_ring_single_heater_.yml b/tests/test_components/test_pdk_settings_ring_single_heater_.yml index 8592aede..8297d403 100644 --- a/tests/test_components/test_pdk_settings_ring_single_heater_.yml +++ b/tests/test_components/test_pdk_settings_ring_single_heater_.yml @@ -1,7 +1,7 @@ function: ring_single_heater info: {} module: gdsfactory.components.ring_single_heater -name: ring_single_heater_203d59fa +name: ring_single_heater_2c28c6d4 settings: bend: function: bend_euler @@ -91,7 +91,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_ring_with_crossing_.yml b/tests/test_components/test_pdk_settings_ring_with_crossing_.yml index 16197385..89e46b33 100644 --- a/tests/test_components/test_pdk_settings_ring_with_crossing_.yml +++ b/tests/test_components/test_pdk_settings_ring_with_crossing_.yml @@ -1,7 +1,7 @@ function: ring_single_dut info: {} module: gdsfactory.components.ring_single_dut -name: ring_single_dut_eae863cb +name: ring_single_dut_ec96572d settings: bend: function: bend_euler_sc @@ -58,7 +58,7 @@ settings: settings: cross_section: xs_sc post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_straight_.yml b/tests/test_components/test_pdk_settings_straight_.yml index 4b9df73d..9e8609e4 100644 --- a/tests/test_components/test_pdk_settings_straight_.yml +++ b/tests/test_components/test_pdk_settings_straight_.yml @@ -7,14 +7,14 @@ info: route_info_xs_sc_length: 10.0 width: 0.5 module: gdsfactory.components.straight -name: straight_901ddba2 +name: straight_af6b139c settings: cross_section: xs_sc info: null length: 10.0 npoints: 2 post_process: - function: add_padding + - function: add_padding module: gdsfactory.add_padding settings: bottom: 0.5 diff --git a/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml b/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml index 398cd3fa..88845eb7 100644 --- a/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml +++ b/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml @@ -12,6 +12,7 @@ module: gdsfactory.components.via_stack name: via_stack_627f28a4 settings: correct_size: true + info: null layer_offsets: null layer_port: null layers: diff --git a/ubcpdk/components.py b/ubcpdk/components.py index afd1a63b..d2c8520c 100644 --- a/ubcpdk/components.py +++ b/ubcpdk/components.py @@ -11,6 +11,7 @@ Label, LayerSpec, List, + Metadata, Optional, Port, Tuple, @@ -42,7 +43,7 @@ def bend_euler_sc(**kwargs) -> Component: straight = partial( gf.components.straight, cross_section="xs_sc", - post_process=tech.add_bbox_siepic_top_bot, + post_process=(tech.add_bbox_siepic_top_bot,), ) bend_s = partial( gf.components.bend_s, @@ -63,12 +64,6 @@ def bend_euler_sc(**kwargs) -> Component: prefix_te1550 = prefix_tm1550 = prefix_te1310 = prefix_tm1130 = "o2" -# @gf.cell -# def Packaging_FibreArray_8ch() -> gf.Component: -# """Return Packaging_FibreArray_8ch fixed cell.""" -# return import_gds("Packaging_FibreArray_8ch.gds") - - def clean_name(name: str) -> str: return name.replace("_", ".") @@ -498,7 +493,8 @@ def add_fiber_array( cross_section: CrossSectionSpec = "xs_sc", layer_label: LayerSpec = LAYER.TEXT, straight: ComponentSpec = straight, - post_process: Callable | None = None, + post_process: Callable | list[Callable] | None = None, + info: Metadata | None = None, **kwargs, ) -> Component: """Returns component with grating couplers and labels on each port. @@ -519,6 +515,7 @@ def add_fiber_array( layer_label: for label. straight: straight component. post_process: function to post process the component. + info: metadata. """ c = gf.Component() @@ -543,8 +540,9 @@ def add_fiber_array( ref.rotate(-90) c.add_ports(ref.ports) c.copy_child_info(component) - if post_process: - c = post_process(c) + + c.post_process(post_process) + c.info.update(info or {}) return c diff --git a/ubcpdk/models.py b/ubcpdk/models.py new file mode 100644 index 00000000..ffc8f8ff --- /dev/null +++ b/ubcpdk/models.py @@ -0,0 +1,51 @@ +from __future__ import annotations + +from functools import partial + +from gplugins.sax.models import ( + attenuator, + bend, + coupler, + grating_coupler, + mmi1x2, + mmi2x2, + phase_shifter, +) +from gplugins.sax.models import straight as _straight + +nm = 1e-3 + + +straight = partial(_straight, wl0=1.55, neff=2.4, ng=4.2) +bend_euler = partial(bend, loss=0.03) + +gc_te1550 = partial(grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.55) +gc_te1550_broadband = partial(grating_coupler, loss=6, bandwidth=50 * nm, wl0=1.55) +gc_tm1550 = partial(grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.55) + +gc_te1310_broadband = partial(grating_coupler, loss=6, bandwidth=50 * nm, wl0=1.31) +gc_te1310 = partial(grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.31) + + +models = dict( + attenuator=attenuator, + bend_euler=bend, + coupler=coupler, + mmi1x2=mmi1x2, + mmi2x2=mmi2x2, + phase_shifter=phase_shifter, + straight=straight, + taper=straight, + gc_te1550=gc_te1550, + gc_te1550_broadband=gc_te1550_broadband, + gc_tm1550=gc_tm1550, + gc_te1310_broadband=gc_te1310_broadband, + gc_te1310=gc_te1310, +) + + +if __name__ == "__main__": + import gplugins.sax as gs + + gs.plot_model(grating_coupler) + # gs.plot_model(coupler)