diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e113b96..e475360b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.0.0](https://github.com/gdsfactory/ubc/pull/204) + +- update to gdsfactory 7 + + ## [1.21.0](https://github.com/gdsfactory/ubc/pull/203) - use jupyterbook for docs diff --git a/docs/notebooks b/docs/notebooks new file mode 120000 index 00000000..f1ec2756 --- /dev/null +++ b/docs/notebooks @@ -0,0 +1 @@ +../ubcpdk/samples/notebooks \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 91f30f8f..60daef38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,9 +8,6 @@ name="ubcpdk" description="ubcpdk pdk" classifiers = [ "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", @@ -22,23 +19,20 @@ authors = [ keywords = ["python"] license = {file = "LICENSE"} dependencies = [ - "gdsfactory==6.115.0", - "modes", + "gdsfactory==7.0.2", + "gplugins[tidy3d]>=0.0.3,<0.1.0", ] readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.10" [project.optional-dependencies] full = [ - "gdsfactory[full]==6.115.0", - "modes", + "femwell" ] - dev = [ "pytest", "pytest-cov", "pytest_regressions", - "femwell" ] docs = [ "autodoc_pydantic", @@ -70,12 +64,12 @@ exclude = ''' # Specify the files/dirs that should be ignored by the black form ''' [tool.pytest.ini_options] -# testpaths = ["tests"] -testpaths = ["ubcpdk/samples", "tests"] +testpaths = ["tests"] +# testpaths = ["ubcpdk/samples", "tests"] # addopts = --tb=no # addopts = '--tb=short' -python_files = ["ubcpdk/samples*.py", "tests/*.py"] -# python_files = ["tests/*.py"] +# python_files = ["ubcpdk/samples*.py", "tests/*.py"] +python_files = ["tests/*.py"] # norecursedirs = ["extra/*.py", 'ubcdpk/simulations/*.py'] [tool.flake8] diff --git a/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.npz b/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.npz new file mode 100644 index 00000000..dbf73d5e Binary files /dev/null and b/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.npz differ diff --git a/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.yml b/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.yml new file mode 100644 index 00000000..56d99879 --- /dev/null +++ b/sparameters/straight_length3_d34ef86b690da3f9c50cb80b5cf3ff11.yml @@ -0,0 +1,368 @@ +component: + name: straight_length3 + ports: + o1: + center: + - 0.0 + - 0.0 + layer: + - 1 + - 0 + name: o1 + orientation: 180.0 + port_type: optical + shear_angle: null + width: 0.5 + o2: + center: + - 3.0 + - 0.0 + layer: + - 1 + - 0 + name: o2 + orientation: 0.0 + port_type: optical + shear_angle: null + width: 0.5 + settings: + changed: + length: 3 + child: null + default: + cross_section: strip + length: 10.0 + npoints: 2 + with_bbox: true + full: + cross_section: strip + length: 3 + npoints: 2 + with_bbox: true + function_name: straight + info: + cross_section: strip + function_name: cross_section + length: 3.0 + route_info: + length: 3.0 + type: + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: [] + bbox_offsets: [] + cladding_layers: + - DEVREC + cladding_offsets: + - 0.0 + cladding_simplify: null + end_straight_length: 0.01 + gap: 3.0 + info: + function_name: cross_section + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0.0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: [] + simplify: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + weight: 3.0 + ? '{''layer'': ''WG'', ''width'': 0.5, ''offset'': 0.0, ''radius'': 10.0, + ''width_wide'': None, ''simplify'': None, ''auto_widen'': False, ''auto_widen_minimum_length'': + 200.0, ''taper_length'': 10.0, ''bbox_layers'': [], ''bbox_offsets'': [], + ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0.0], ''cladding_simplify'': + None, ''sections'': [], ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''info'': {''settings'': + {''width'': 0.5, ''offset'': 0, ''layer'': ''WG'', ''width_wide'': None, + ''auto_widen'': False, ''auto_widen_minimum_length'': 200.0, ''taper_length'': + 10.0, ''radius'': 10.0, ''sections'': None, ''port_names'': [''o1'', ''o2''], + ''port_types'': [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': + 0.01, ''start_straight_length'': 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': + None, ''bbox_layers'': None, ''bbox_offsets'': None, ''cladding_layers'': + [''DEVREC''], ''cladding_offsets'': [0], ''cladding_simplify'': None, ''info'': + None, ''decorator'': None, ''add_pins'': {''function'': ''add_pins_siepic''}, + ''add_bbox'': None, ''mirror'': False, ''name'': None}, ''function_name'': + ''cross_section''}, ''name'': None, ''mirror'': False}_length' + : 3.0 + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + width: 0.5 + info_version: 2 + module: gdsfactory.components.straight + name: straight_length3 +compute_time_minutes: 0.1275598446528117 +compute_time_seconds: 7.653590679168701 +dispersive: false +is_3d: false +layer_stack: + box: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 99 + into: null + layer: !!python/tuple + - 99999 + - 0 + layer_type: grow + material: sio2 + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 0.0 + sidewall_angle_tolerance: null + thickness: 3.0 + thickness_tolerance: null + width_to_z: 0.0 + z_to_bias: null + zmin: -3.0 + zmin_tolerance: null + clad: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 100 + into: null + layer: !!python/tuple + - 99999 + - 0 + layer_type: grow + material: sio2 + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 0.0 + sidewall_angle_tolerance: null + thickness: 1.8000000000000003 + thickness_tolerance: null + width_to_z: 0.0 + z_to_bias: null + zmin: 0.0 + zmin_tolerance: null + core: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 1 + into: null + layer: !!python/tuple + - 1 + - 0 + layer_type: grow + material: si + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 10.0 + sidewall_angle_tolerance: null + thickness: 0.22 + thickness_tolerance: null + width_to_z: 0.5 + z_to_bias: null + zmin: 0.0 + zmin_tolerance: null + core2: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 1 + into: null + layer: !!python/tuple + - 31 + - 0 + layer_type: grow + material: si + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 10.0 + sidewall_angle_tolerance: null + thickness: 0.22 + thickness_tolerance: null + width_to_z: 0.5 + z_to_bias: null + zmin: 0.0 + zmin_tolerance: null + heater: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 1 + into: null + layer: !!python/tuple + - 11 + - 0 + layer_type: grow + material: TiN + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 0.0 + sidewall_angle_tolerance: null + thickness: 0.75 + thickness_tolerance: null + width_to_z: 0.0 + z_to_bias: null + zmin: 1.1 + zmin_tolerance: null + metal2: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 2 + into: null + layer: !!python/tuple + - 12 + - 0 + layer_type: grow + material: Aluminum + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 0.0 + sidewall_angle_tolerance: null + thickness: 0.7000000000000001 + thickness_tolerance: null + width_to_z: 0.0 + z_to_bias: null + zmin: 1.8000000000000003 + zmin_tolerance: null + substrate: + background_doping_concentration: null + background_doping_ion: null + bias: null + derived_layer: null + info: + mesh_order: 99 + into: null + layer: !!python/tuple + - 99999 + - 0 + layer_type: grow + material: si + mesh_order: 3 + mode: null + orientation: '100' + resistivity: null + sidewall_angle: 0.0 + sidewall_angle_tolerance: null + thickness: 10.0 + thickness_tolerance: null + width_to_z: 0.0 + z_to_bias: null + zmin: -13.0 + zmin_tolerance: null +port_margin: 2 +port_monitor_offset: -0.1 +port_source_offset: -0.1 +port_symmetries: + o2@0,o1@0: + - o1@0,o2@0 +resolution: 30 +wavelength_points: 50 +wavelength_start: 1.5 +wavelength_stop: 1.6 +xmargin_left: 0 +xmargin_right: 0 +ymargin_bot: 3 +ymargin_top: 3 diff --git a/test.schem.yml b/test.schem.yml new file mode 100644 index 00000000..6db43a95 --- /dev/null +++ b/test.schem.yml @@ -0,0 +1,12 @@ +instances: + s1: + component: straight + settings: {length: 20} + s2: + component: straight + settings: {length: 40} +schematic_placements: + s1: {x: null, y: null, port: null, rotation: 0, dx: null, dy: null, mirror: null} + s2: {x: null, y: null, port: null, rotation: 0, dx: null, dy: null, mirror: null} +nets: [] +ports: {} diff --git a/tests/ref/dbg.gds b/tests/ref/dbg.gds index b60200fa..991818e0 100644 Binary files a/tests/ref/dbg.gds and b/tests/ref/dbg.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 0a5ad43a..c4d7994b 100644 --- a/tests/test_components/test_pdk_settings_add_fiber_array_.yml +++ b/tests/test_components/test_pdk_settings_add_fiber_array_.yml @@ -62,6 +62,96 @@ settings: cross_section: strip function_name: cross_section length: 10.0 + route_info: + length: 10.0 + type: + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: [] + bbox_offsets: [] + cladding_layers: + - DEVREC + cladding_offsets: + - 0.0 + cladding_simplify: null + end_straight_length: 0.01 + gap: 3.0 + info: + function_name: cross_section + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0.0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: [] + simplify: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + weight: 10.0 + ? '{''layer'': ''WG'', ''width'': 0.5, ''offset'': 0.0, ''radius'': 10.0, + ''width_wide'': None, ''simplify'': None, ''auto_widen'': False, ''auto_widen_minimum_length'': + 200.0, ''taper_length'': 10.0, ''bbox_layers'': [], ''bbox_offsets'': + [], ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0.0], ''cladding_simplify'': + None, ''sections'': [], ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''info'': + {''settings'': {''width'': 0.5, ''offset'': 0, ''layer'': ''WG'', ''width_wide'': + None, ''auto_widen'': False, ''auto_widen_minimum_length'': 200.0, ''taper_length'': + 10.0, ''radius'': 10.0, ''sections'': None, ''port_names'': [''o1'', ''o2''], + ''port_types'': [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': + 0.01, ''start_straight_length'': 0.01, ''end_straight_length'': 0.01, + ''snap_to_grid'': None, ''bbox_layers'': None, ''bbox_offsets'': None, + ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0], ''cladding_simplify'': + None, ''info'': None, ''decorator'': None, ''add_pins'': {''function'': + ''add_pins_siepic''}, ''add_bbox'': None, ''mirror'': False, ''name'': + None}, ''function_name'': ''cross_section''}, ''name'': None, ''mirror'': + False}_length' + : 10.0 settings: add_bbox: null add_pins: @@ -158,6 +248,95 @@ settings: polarization: te wavelength: 1.55 length: 10.0 + route_info: + length: 10.0 + type: + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: [] + bbox_offsets: [] + cladding_layers: + - DEVREC + cladding_offsets: + - 0.0 + cladding_simplify: null + end_straight_length: 0.01 + gap: 3.0 + info: + function_name: cross_section + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0.0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: [] + simplify: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + weight: 10.0 + ? '{''layer'': ''WG'', ''width'': 0.5, ''offset'': 0.0, ''radius'': 10.0, + ''width_wide'': None, ''simplify'': None, ''auto_widen'': False, ''auto_widen_minimum_length'': + 200.0, ''taper_length'': 10.0, ''bbox_layers'': [], ''bbox_offsets'': [], + ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0.0], ''cladding_simplify'': + None, ''sections'': [], ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''info'': {''settings'': + {''width'': 0.5, ''offset'': 0, ''layer'': ''WG'', ''width_wide'': None, + ''auto_widen'': False, ''auto_widen_minimum_length'': 200.0, ''taper_length'': + 10.0, ''radius'': 10.0, ''sections'': None, ''port_names'': [''o1'', ''o2''], + ''port_types'': [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': + 0.01, ''start_straight_length'': 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': + None, ''bbox_layers'': None, ''bbox_offsets'': None, ''cladding_layers'': + [''DEVREC''], ''cladding_offsets'': [0], ''cladding_simplify'': None, ''info'': + None, ''decorator'': None, ''add_pins'': {''function'': ''add_pins_siepic''}, + ''add_bbox'': None, ''mirror'': False, ''name'': None}, ''function_name'': + ''cross_section''}, ''name'': None, ''mirror'': False}_length' + : 10.0 settings: add_bbox: null add_pins: @@ -243,6 +422,95 @@ settings: polarization: te wavelength: 1.55 length: 10.0 + route_info: + length: 10.0 + type: + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: [] + bbox_offsets: [] + cladding_layers: + - DEVREC + cladding_offsets: + - 0.0 + cladding_simplify: null + end_straight_length: 0.01 + gap: 3.0 + info: + function_name: cross_section + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0.0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: [] + simplify: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + weight: 10.0 + ? '{''layer'': ''WG'', ''width'': 0.5, ''offset'': 0.0, ''radius'': 10.0, ''width_wide'': + None, ''simplify'': None, ''auto_widen'': False, ''auto_widen_minimum_length'': + 200.0, ''taper_length'': 10.0, ''bbox_layers'': [], ''bbox_offsets'': [], + ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0.0], ''cladding_simplify'': + None, ''sections'': [], ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''info'': {''settings'': + {''width'': 0.5, ''offset'': 0, ''layer'': ''WG'', ''width_wide'': None, ''auto_widen'': + False, ''auto_widen_minimum_length'': 200.0, ''taper_length'': 10.0, ''radius'': + 10.0, ''sections'': None, ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''bbox_layers'': + None, ''bbox_offsets'': None, ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': + [0], ''cladding_simplify'': None, ''info'': None, ''decorator'': None, ''add_pins'': + {''function'': ''add_pins_siepic''}, ''add_bbox'': None, ''mirror'': False, + ''name'': None}, ''function_name'': ''cross_section''}, ''name'': None, ''mirror'': + False}_length' + : 10.0 settings: add_bbox: null add_pins: diff --git a/tests/test_components/test_pdk_settings_bend_.yml b/tests/test_components/test_pdk_settings_bend_.yml index 675ff83e..8e42f93a 100644 --- a/tests/test_components/test_pdk_settings_bend_.yml +++ b/tests/test_components/test_pdk_settings_bend_.yml @@ -50,6 +50,12 @@ settings: length: 16.637 radius: 10.0 radius_min: 7.061 + route_info: + length: 16.637 + n_bend_90: 1.0 + strip_length: 16.637 + type: strip + weight: 16.637 settings: add_bbox: null add_pins: diff --git a/tests/test_components/test_pdk_settings_bend_euler_.yml b/tests/test_components/test_pdk_settings_bend_euler_.yml index 829f150c..8db1f09a 100644 --- a/tests/test_components/test_pdk_settings_bend_euler_.yml +++ b/tests/test_components/test_pdk_settings_bend_euler_.yml @@ -51,6 +51,12 @@ settings: length: 16.637 radius: 10.0 radius_min: 7.061 + route_info: + length: 16.637 + n_bend_90: 1.0 + strip_length: 16.637 + type: strip + weight: 16.637 settings: add_bbox: null add_pins: diff --git a/tests/test_components/test_pdk_settings_ebeam_adiabatic_te1550_.yml b/tests/test_components/test_pdk_settings_ebeam_adiabatic_te1550_.yml index e2697596..4e933811 100644 --- a/tests/test_components/test_pdk_settings_ebeam_adiabatic_te1550_.yml +++ b/tests/test_components/test_pdk_settings_ebeam_adiabatic_te1550_.yml @@ -8,7 +8,7 @@ ports: - 1 - 0 name: o1 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -20,7 +20,7 @@ ports: - 1 - 0 name: o2 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -32,7 +32,7 @@ ports: - 1 - 0 name: o3 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 @@ -44,7 +44,7 @@ ports: - 1 - 0 name: o4 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 diff --git a/tests/test_components/test_pdk_settings_ebeam_bdc_te1550_.yml b/tests/test_components/test_pdk_settings_ebeam_bdc_te1550_.yml index 9303b83e..7ed22a05 100644 --- a/tests/test_components/test_pdk_settings_ebeam_bdc_te1550_.yml +++ b/tests/test_components/test_pdk_settings_ebeam_bdc_te1550_.yml @@ -8,7 +8,7 @@ ports: - 1 - 0 name: o1 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -20,7 +20,7 @@ ports: - 1 - 0 name: o2 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -32,7 +32,7 @@ ports: - 1 - 0 name: o3 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 @@ -44,7 +44,7 @@ ports: - 1 - 0 name: o4 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 diff --git a/tests/test_components/test_pdk_settings_ebeam_crossing4_.yml b/tests/test_components/test_pdk_settings_ebeam_crossing4_.yml index c0e9a864..1ea02118 100644 --- a/tests/test_components/test_pdk_settings_ebeam_crossing4_.yml +++ b/tests/test_components/test_pdk_settings_ebeam_crossing4_.yml @@ -8,7 +8,7 @@ ports: - 1 - 0 name: o1 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -20,7 +20,7 @@ ports: - 1 - 0 name: o2 - orientation: 90.0 + orientation: 90 port_type: optical shear_angle: null width: 0.5 @@ -32,7 +32,7 @@ ports: - 1 - 0 name: o3 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 @@ -44,7 +44,7 @@ ports: - 1 - 0 name: o4 - orientation: 270.0 + orientation: 270 port_type: optical shear_angle: null width: 0.5 diff --git a/tests/test_components/test_pdk_settings_ebeam_y_1550_.yml b/tests/test_components/test_pdk_settings_ebeam_y_1550_.yml index ea29508b..0aa5240e 100644 --- a/tests/test_components/test_pdk_settings_ebeam_y_1550_.yml +++ b/tests/test_components/test_pdk_settings_ebeam_y_1550_.yml @@ -8,7 +8,7 @@ ports: - 1 - 0 name: o1 - orientation: 180.0 + orientation: 180 port_type: optical shear_angle: null width: 0.5 @@ -20,7 +20,7 @@ ports: - 1 - 0 name: o2 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 0.5 @@ -32,7 +32,7 @@ ports: - 1 - 0 name: o3 - orientation: 0.0 + orientation: 0 port_type: optical shear_angle: null width: 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 d72dea04..8b931a9b 100644 --- a/tests/test_components/test_pdk_settings_ring_double_heater_.yml +++ b/tests/test_components/test_pdk_settings_ring_double_heater_.yml @@ -98,7 +98,7 @@ ports: width: 0.5 r_e1: center: - - 0.0 + - -0.0 - 0.0 layer: - 12 diff --git a/tests/test_components/test_pdk_settings_straight_.yml b/tests/test_components/test_pdk_settings_straight_.yml index 1acbea1e..711745bf 100644 --- a/tests/test_components/test_pdk_settings_straight_.yml +++ b/tests/test_components/test_pdk_settings_straight_.yml @@ -42,6 +42,95 @@ settings: cross_section: strip function_name: cross_section length: 10.0 + route_info: + length: 10.0 + type: + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: [] + bbox_offsets: [] + cladding_layers: + - DEVREC + cladding_offsets: + - 0.0 + cladding_simplify: null + end_straight_length: 0.01 + gap: 3.0 + info: + function_name: cross_section + settings: + add_bbox: null + add_pins: + function: add_pins_siepic + auto_widen: false + auto_widen_minimum_length: 200.0 + bbox_layers: null + bbox_offsets: null + cladding_layers: + - DEVREC + cladding_offsets: + - 0 + cladding_simplify: null + decorator: null + end_straight_length: 0.01 + gap: 3.0 + info: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + layer: WG + min_length: 0.01 + mirror: false + name: null + offset: 0.0 + port_names: + - o1 + - o2 + port_types: + - optical + - optical + radius: 10.0 + sections: [] + simplify: null + snap_to_grid: null + start_straight_length: 0.01 + taper_length: 10.0 + width: 0.5 + width_wide: null + weight: 10.0 + ? '{''layer'': ''WG'', ''width'': 0.5, ''offset'': 0.0, ''radius'': 10.0, ''width_wide'': + None, ''simplify'': None, ''auto_widen'': False, ''auto_widen_minimum_length'': + 200.0, ''taper_length'': 10.0, ''bbox_layers'': [], ''bbox_offsets'': [], + ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': [0.0], ''cladding_simplify'': + None, ''sections'': [], ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''info'': {''settings'': + {''width'': 0.5, ''offset'': 0, ''layer'': ''WG'', ''width_wide'': None, ''auto_widen'': + False, ''auto_widen_minimum_length'': 200.0, ''taper_length'': 10.0, ''radius'': + 10.0, ''sections'': None, ''port_names'': [''o1'', ''o2''], ''port_types'': + [''optical'', ''optical''], ''gap'': 3.0, ''min_length'': 0.01, ''start_straight_length'': + 0.01, ''end_straight_length'': 0.01, ''snap_to_grid'': None, ''bbox_layers'': + None, ''bbox_offsets'': None, ''cladding_layers'': [''DEVREC''], ''cladding_offsets'': + [0], ''cladding_simplify'': None, ''info'': None, ''decorator'': None, ''add_pins'': + {''function'': ''add_pins_siepic''}, ''add_bbox'': None, ''mirror'': False, + ''name'': None}, ''function_name'': ''cross_section''}, ''name'': None, ''mirror'': + False}_length' + : 10.0 settings: add_bbox: null add_pins: diff --git a/ubcpdk/circuits/grating.pic.yml b/ubcpdk/circuits/grating.pic.yml deleted file mode 100644 index cdf5f9a4..00000000 --- a/ubcpdk/circuits/grating.pic.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: sample_different_factory - -settings: - taper_length: -50 - -instances: - bl: - component: pad - tl: - component: pad - br: - component: pad - tr: - component: pad - -placements: - tl: - x: 0 - y: 200 - - br: - x: 400 - y: 400 - - tr: - x: 400 - y: 600 - -routes: - electrical: - settings: - separation: 20 - layer: [31, 0] - width: 10 - links: - tl,e3: tr,e1 - bl,e3: br,e1 - optical: - settings: - radius: 100 - links: - bl,e4: br,e3 diff --git a/ubcpdk/circuits/mask.pic.yml b/ubcpdk/circuits/mask.pic.yml deleted file mode 100644 index 120ca7f1..00000000 --- a/ubcpdk/circuits/mask.pic.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: mask_compact -pdk: ubcpdk - -instances: - rings: - component: pack_doe - settings: - doe: ring_single - settings: - radius: [30, 50, 20, 40] - length_x: [1, 2, 3] - do_permutations: True - function: - function: add_fiber_array - settings: - fanout_length: 200 - - mzis: - component: pack_doe_grid - settings: - doe: mzi - settings: - delta_length: [10, 100, 300, 500, 600] - do_permutations: True - spacing: [10, 10] - function: add_fiber_single - - mmis: - component: pack_doe_grid - settings: - doe: dbr_cavity - settings: - n: [10, 100] - do_permutations: True - spacing: [10, 10] - function: add_fiber_single - -placements: - rings: - xmin: 50 - - mzis: - xmin: rings,east - - mmis: - xmin: mzis,east diff --git a/ubcpdk/circuits/mzi_lattice_filter.pic.yml b/ubcpdk/circuits/mzi_lattice_filter.pic.yml deleted file mode 100644 index b63edb97..00000000 --- a/ubcpdk/circuits/mzi_lattice_filter.pic.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: mzi_lattice_ubcpdk -pdk: ubcpdk - -instances: - mzi1: - component: mzi_ubcpdk - settings: - dy: -100 - - mzi2: - component: mzi_ubcpdk - settings: - dy: -500 - - gc1: - component: ebeam_gc_te1550 - - gc2: - component: ebeam_gc_te1550 - -placements: - mzi2: - ymax: mzi1,north - dy: 100 - xmin: mzi1,east - dx: 50 - - gc1: - xmax: mzi1,west - mirror: True - dx: -100 - dy: -20 - - gc2: - xmin: mzi2,east - dx: 100 - dy: 100 - -routes: - optical: - links: - mzi1,o2: mzi2,o1 - settings: - auto_widen: True - - gc1: - links: - gc1,o1: mzi1,o1 - - gc2: - links: - gc2,o1: mzi2,o2 diff --git a/ubcpdk/circuits/mzi_ubcpdk.pic.yml b/ubcpdk/circuits/mzi_ubcpdk.pic.yml deleted file mode 100644 index 36a123af..00000000 --- a/ubcpdk/circuits/mzi_ubcpdk.pic.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: mzi_ubcpdk -pdk: ubcpdk - -settings: - dy: -100 - -info: - polarization: te - wavelength: 1.55 - description: mzi for ubcpdk - -instances: - yr: - component: ebeam_y_1550 - yl: - component: ebeam_y_1550 - -placements: - yr: - rotation: 180 - x: 100 - y: 0 - -routes: - route_top: - links: - yl,o2: yr,o3 - settings: - cross_section: strip - route_bot: - links: - yl,o3: yr,o2 - routing_strategy: get_bundle_from_steps - settings: - steps: [dx: 30, dy: "${settings.dy}", dx: 20] - cross_section: strip - -ports: - o1: yl,o1 - o2: yr,o1 diff --git a/ubcpdk/circuits/pads.pic.yml b/ubcpdk/circuits/pads.pic.yml deleted file mode 100644 index adfcf160..00000000 --- a/ubcpdk/circuits/pads.pic.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: sample_different_factory -pdk: ubcpdk - -instances: - bl: - component: pad - tl: - component: pad - br: - component: pad - tr: - component: pad - -placements: - tl: - x: -100 - y: 200 - - br: - x: 400 - y: 400 - - tr: - x: 400 - y: 600 - - -routes: - electrical: - settings: - separation: 20 - layer: M2_ROUTER - width: 10 - links: - tl,e3: tr,e1 - bl,e3: br,e1 - optical: - settings: - radius: 10 - links: - bl,e4: br,e3 diff --git a/docs/notebooks/00_layout.py b/ubcpdk/samples/notebooks/00_layout.py similarity index 100% rename from docs/notebooks/00_layout.py rename to ubcpdk/samples/notebooks/00_layout.py diff --git a/docs/notebooks/11_sparameters.py b/ubcpdk/samples/notebooks/11_sparameters.py similarity index 80% rename from docs/notebooks/11_sparameters.py rename to ubcpdk/samples/notebooks/11_sparameters.py index 1bd1a949..9f596423 100644 --- a/docs/notebooks/11_sparameters.py +++ b/ubcpdk/samples/notebooks/11_sparameters.py @@ -1,58 +1,71 @@ # --- # jupyter: # jupytext: +# custom_cell_magics: kql # text_representation: # extension: .py -# format_name: light -# format_version: '1.5' -# jupytext_version: 1.14.5 +# format_name: percent +# format_version: '1.3' +# jupytext_version: 1.11.2 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- +# %% [markdown] # # Component FDTD simulations # # Thanks to the GDSFactory plugin you can directly run simulations in different FDTD solvers. # # See [tutorial](https://gdsfactory.github.io/gdsfactory/plugins_fdtd.html) +# %% [markdown] # ## Tidy3d # # You can read about the [tidy3d gdsfactory plugin](https://gdsfactory.github.io/gdsfactory/notebooks/plugins/tidy3d/00_tidy3d.html) -# + -import gdsfactory.simulation as sim -import gdsfactory.simulation.gtidy3d as gt +# %% +import gplugins as sim +import gplugins.gtidy3d as gt import ubcpdk import ubcpdk.components as pdk +from ubcpdk.config import PATH -# - +# %% c = pdk.ebeam_y_1550() -c +c.plot() +# %% sp = gt.write_sparameters(c) +# %% sp.keys() +# %% sim.plot.plot_sparameters(sp) +# %% sim.plot.plot_loss1x2(sp) +# %% sim.plot.plot_imbalance1x2(sp) +# %% [markdown] # ## Lumerical FDTD # # You can write the [Sparameters](https://en.wikipedia.org/wiki/Scattering_parameters) for all components in the UBC `ubcpdk.components` PDK using lumerical FDTD plugin in gdsfactory +# %% [markdown] # To run simulations uncomment the following lines -import gdsfactory.simulation as sim +# %% +import gplugins as sim import ubcpdk.components as pdk +# %% for f in [ pdk.bend_euler, pdk.coupler, @@ -65,13 +78,13 @@ # ls.write_sparameters_lumerical(component=component) -# + +# %% # sp = ls.read.read_sparameters_lumerical(component=ubcpdk.components.straight()) -# + +# %% # sim.plot_sparameters(sp) -# - +# %% [markdown] # ## MEEP FDTD # # Meep in an open source FDTD library developed at MIT. @@ -81,25 +94,29 @@ # # The resolution is in pixels/um so you need to run with at least `resolution=100` for 1/100 um/pixel (10 nm/ pixel). +# %% import gdsfactory as gf -import gdsfactory.simulation.gmeep as gm +import gplugins.gmeep as gm +# %% c = ubcpdk.components.straight(length=3) -c +c.plot() +# %% df = gm.write_sparameters_meep_1x1(component=c, run=False) -df = gm.write_sparameters_meep_1x1(component=c, run=True) +# %% +df = gm.write_sparameters_meep_1x1(component=c, run=True, dirpath=PATH.sparameters) +# %% gm.plot.plot_sparameters(df) +# %% gm.plot.plot_sparameters(df, logscale=False) +# %% c = ubcpdk.components.ebeam_y_1550() c +# %% df = gm.write_sparameters_meep(component=c, run=False) # lr stands for left-right ports - -df = gm.write_sparameters_meep( - gf.components.coupler_ring(), xmargin=3, ymargin_bot=3, run=False -) # lr stands for left-right ports diff --git a/docs/notebooks/11_sparameters_gratings.py b/ubcpdk/samples/notebooks/11_sparameters_gratings.py similarity index 83% rename from docs/notebooks/11_sparameters_gratings.py rename to ubcpdk/samples/notebooks/11_sparameters_gratings.py index f872fdf3..8cff546a 100644 --- a/docs/notebooks/11_sparameters_gratings.py +++ b/ubcpdk/samples/notebooks/11_sparameters_gratings.py @@ -26,11 +26,12 @@ import numpy as np import matplotlib.pyplot as plt -import gdsfactory.simulation.gtidy3d as gt +import gplugins.gtidy3d as gt import ubcpdk.components as pdk +from ubcpdk.config import PATH c = pdk.gc_te1550() -c +c.plot() # %% fiber_angle_deg = -31 @@ -50,6 +51,7 @@ is_3d=False, fiber_angle_deg=fiber_angle_deg, fiber_xoffset=fiber_xoffset, + dirpath=PATH.sparameters, ) for fiber_xoffset in offsets ] @@ -64,7 +66,7 @@ def log(x): # %% for offset in offsets: sp = gt.write_sparameters_grating_coupler( - c, is_3d=False, fiber_angle_deg=fiber_angle_deg, fiber_xoffset=offset + c, is_3d=False, fiber_angle_deg=fiber_angle_deg, fiber_xoffset=offset, dirpath=PATH.sparameters ) plt.plot( sp["wavelengths"], @@ -78,15 +80,4 @@ def log(x): plt.legend() # %% -# gt.write_sparameters_grating_coupler? - -# %% -sparams = [ - gt.write_sparameters_grating_coupler( - component=c, - is_3d=False, - fiber_angle_deg=fiber_angle_deg, - fiber_xoffset=fiber_xoffset, - ) - for fiber_xoffset in offsets -] +help(gt.write_sparameters_grating_coupler) diff --git a/docs/notebooks/12_sim_plugins_tidy3d.py b/ubcpdk/samples/notebooks/12_sim_plugins_tidy3d.py similarity index 87% rename from docs/notebooks/12_sim_plugins_tidy3d.py rename to ubcpdk/samples/notebooks/12_sim_plugins_tidy3d.py index beb07d8f..8de5814c 100644 --- a/docs/notebooks/12_sim_plugins_tidy3d.py +++ b/ubcpdk/samples/notebooks/12_sim_plugins_tidy3d.py @@ -27,13 +27,6 @@ # # We will be using SAX which is open source and tidy3d which requires you to create an account to run simulations in tidy3d cloud. # -# -# ``` -# set PIP_FIND_LINKS="https://whls.blob.core.windows.net/unstable/index.html" -# pip install sax jax sklearn -# pip install "jaxlib[cuda111]" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver -# pip install "gdsfactory[tidy3d,sax]" -# ``` # %% [markdown] # ## tidy3d FDTD simulations @@ -47,15 +40,16 @@ # ![cloud_model](https://i.imgur.com/5VTCPLR.png) # %% -import gdsfactory.simulation as sim +import gplugins as sim import gdsfactory as gf -import gdsfactory.simulation.gtidy3d as gt +import gplugins.gtidy3d as gt import ubcpdk.components as pdk +from ubcpdk.config import PATH # %% c = pdk.ebeam_y_1550() -c +c.plot() # %% sp = gt.write_sparameters(c) @@ -72,7 +66,7 @@ # %% mzi10 = gf.components.mzi(splitter=c, delta_length=10) -mzi10 +mzi10.plot() # %% import matplotlib.pyplot as plt @@ -81,7 +75,7 @@ import sax import gdsfactory as gf -import gdsfactory.simulation.sax as gsax +import gplugins.sax as gsax # %% @@ -121,7 +115,7 @@ def bend_euler(wl=1.5, length=20.0): # %% mzi20 = gf.components.mzi(splitter=c, delta_length=20) -mzi20 +mzi20.plot() # %% netlist = mzi20.get_netlist() @@ -144,5 +138,3 @@ def bend_euler(wl=1.5, length=20.0): plt.ylabel("T") plt.grid(True) plt.show() - -# %% diff --git a/docs/notebooks/13_sim_plugins.py b/ubcpdk/samples/notebooks/13_sim_plugins.py similarity index 95% rename from docs/notebooks/13_sim_plugins.py rename to ubcpdk/samples/notebooks/13_sim_plugins.py index 1443641f..3c07d340 100644 --- a/docs/notebooks/13_sim_plugins.py +++ b/ubcpdk/samples/notebooks/13_sim_plugins.py @@ -25,8 +25,8 @@ # ## MEEP FDTD # + -import gdsfactory.simulation.gmeep as gm -import gdsfactory.simulation as sim +import gplugins.gmeep as gm +import gplugins as sim import gdsfactory as gf import ubcpdk as pdk @@ -130,7 +130,7 @@ # ## 3D rendering # + -from gdsfactory.simulation.add_simulation_markers import add_simulation_markers +from gplugins.add_simulation_markers import add_simulation_markers import ubcpdk as pdk y = pdk.components.ebeam_y_1550() @@ -163,8 +163,8 @@ import sax import gdsfactory as gf -import gdsfactory.simulation.sax as gsax -import gdsfactory.simulation.gmeep as gm +import gplugins.sax as gsax +import gplugins.gmeep as gm import ubcpdk as pdk diff --git a/docs/notebooks/14_sax_tidy3d.py b/ubcpdk/samples/notebooks/14_sax_tidy3d.py similarity index 92% rename from docs/notebooks/14_sax_tidy3d.py rename to ubcpdk/samples/notebooks/14_sax_tidy3d.py index e7d2d21d..5072e53a 100644 --- a/docs/notebooks/14_sax_tidy3d.py +++ b/ubcpdk/samples/notebooks/14_sax_tidy3d.py @@ -1,17 +1,20 @@ +# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: +# custom_cell_magics: kql # text_representation: # extension: .py -# format_name: light -# format_version: '1.5' -# jupytext_version: 1.14.5 +# format_name: percent +# format_version: '1.3' +# jupytext_version: 1.11.2 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- +# %% [markdown] # # SAX circuit simulator # # [SAX](https://flaport.github.io/sax/) is a circuit solver written in JAX, writing your component models in SAX enables you not only to get the function values but the gradients, this is useful for circuit optimization. @@ -21,24 +24,22 @@ # You can install sax with pip (read the SAX install instructions [here](https://github.com/flaport/sax#installation)) # # ``` -# pip install 'gdsfactory[sax]' +# pip install 'gplugins[sax]' # ``` -# + +# %% from pprint import pprint import numpy as np import matplotlib.pyplot as plt import jax.numpy as jnp import gdsfactory as gf -import gdsfactory.simulation.sax as gs +import gplugins.sax as gs import sax -import gdsfactory.simulation.gtidy3d as gt - -gf.config.set_plot_options(show_subports=False) -# - +import gplugins.gtidy3d as gt +# %% [markdown] # ## Scatter *dictionaries* # # The core datastructure for specifying scatter parameters in SAX is a dictionary... more specifically a dictionary which maps a port combination (2-tuple) to a scatter parameter (or an array of scatter parameters when considering multiple wavelengths for example). Such a specific dictionary mapping is called ann `SDict` in SAX (`SDict ≈ Dict[Tuple[str,str], float]`). @@ -53,6 +54,7 @@ # o1 o4 # ``` +# %% nm = 1e-3 coupling = 0.5 kappa = coupling**0.5 @@ -69,9 +71,10 @@ } coupler_dict +# %% [markdown] # it can still be tedious to specify every port in the circuit manually. SAX therefore offers the `reciprocal` function, which auto-fills the reverse connection if the forward connection exist. For example: -# + +# %% coupler_dict = sax.reciprocal( { ("o1", "o4"): tau, @@ -83,16 +86,14 @@ coupler_dict - -# - - +# %% [markdown] # ## Parametrized Models # # Constructing such an `SDict` is easy, however, usually we're more interested in having parametrized models for our components. To parametrize the coupler `SDict`, just wrap it in a function to obtain a SAX `Model`, which is a keyword-only function mapping to an `SDict`: # -# + +# %% def coupler(coupling=0.5) -> sax.SDict: kappa = coupling**0.5 tau = (1 - coupling) ** 0.5 @@ -109,9 +110,7 @@ def coupler(coupling=0.5) -> sax.SDict: coupler(coupling=0.3) -# - - - +# %% def waveguide(wl=1.55, wl0=1.55, neff=2.34, ng=3.4, length=10.0, loss=0.0) -> sax.SDict: dwl = wl - wl0 dneff_dwl = (ng - neff) / wl0 @@ -125,12 +124,15 @@ def waveguide(wl=1.55, wl0=1.55, neff=2.34, ng=3.4, length=10.0, loss=0.0) -> sa ) +# %% [markdown] # ### Waveguide model # # You can create a dispersive waveguide model in SAX. +# %% [markdown] # Lets compute the effective index `neff` and group index `ng` for a 1550nm 500nm straight waveguide +# %% strip = gt.modes.Waveguide( wavelength=1.55, core_width=0.5, @@ -140,27 +142,37 @@ def waveguide(wl=1.55, wl0=1.55, neff=2.34, ng=3.4, length=10.0, loss=0.0) -> sa clad_material="sio2", group_index_step=10 * nm, ) -strip.plot_field(mode_index=0, field_type="Ex") # TE +strip.plot_field(field_name="Ex", mode_index=0) # TE -neff = strip.neffs[0].real -neff +# %% +neff = strip.n_eff[0] +print(neff) + +# %% ng = strip.n_group[0] +print(ng) +# %% straight_sc = gf.partial(gs.models.straight, neff=neff, ng=ng) +# %% gs.plot_model(straight_sc) plt.ylim(-1, 1) +# %% gs.plot_model(straight_sc, phase=True) +# %% [markdown] # ### Coupler model # # Lets define the model for an evanescent coupler +# %% c = gf.components.coupler(length=10, gap=0.2) -c +c.plot() +# %% nm = 1e-3 cp = gt.modes.WaveguideCoupler( wavelength=1.55, @@ -171,29 +183,38 @@ def waveguide(wl=1.55, wl0=1.55, neff=2.34, ng=3.4, length=10.0, loss=0.0) -> sa core_material="si", clad_material="sio2", ) -cp.plot_field(mode_index=0, field_type="Ex") # even mode -cp.plot_field(mode_index=1, field_type="Ex") # odd mode + +cp.plot_field(field_name="Ex", mode_index=0) # even mode +cp.plot_field(field_name="Ex", mode_index=1) # odd mode + +# %% [markdown] # For a 200nm gap the effective index difference `dn` is `0.026`, which means that there is 100% power coupling over 29.4 +# %% [markdown] # If we ignore the coupling from the bend `coupling0 = 0` we know that for a 3dB coupling we need half of the `lc` length, which is the length needed to coupler `100%` of power. +# %% coupler_sc = gf.partial(gs.models.coupler, dn=0.026, length=29.4 / 2, coupling0=0) gs.plot_model(coupler_sc) +# %% [markdown] # ## SAX gdsfactory Compatibility # > From Layout to Circuit Model # # If you define your SAX S parameter models for your components, you can directly simulate your circuits from gdsfactory +# %% mzi = gf.components.mzi(delta_length=10) -mzi +mzi.plot() +# %% netlist = mzi.get_netlist() pprint(netlist["connections"]) +# %% [markdown] # The netlist has three different components: # # 1. straight @@ -203,7 +224,7 @@ def waveguide(wl=1.55, wl0=1.55, neff=2.34, ng=3.4, length=10.0, loss=0.0) -> sa # You need models for each subcomponents to simulate the Component. -# + +# %% def straight(wl=1.5, length=10.0, neff=2.4) -> sax.SDict: return sax.reciprocal({("o1", "o2"): jnp.exp(2j * jnp.pi * neff * length / wl)}) @@ -228,11 +249,11 @@ def bend_euler(wl=1.5, length=20.0): "mmi1x2": mmi1x2, "straight": straight, } -# - +# %% circuit, _ = sax.circuit(netlist=netlist, models=models) -# + +# %% circuit, _ = sax.circuit(netlist=netlist, models=models) wl = np.linspace(1.5, 1.6) S = circuit(wl=wl) @@ -244,12 +265,12 @@ def bend_euler(wl=1.5, length=20.0): plt.ylabel("T") plt.grid(True) plt.show() -# - +# %% mzi = gf.components.mzi(delta_length=20) # Double the length, reduces FSR by 1/2 -mzi +mzi.plot() -# + +# %% circuit, _ = sax.circuit(netlist=mzi.get_netlist(), models=models) wl = np.linspace(1.5, 1.6, 256) @@ -262,20 +283,21 @@ def bend_euler(wl=1.5, length=20.0): plt.ylabel("T") plt.grid(True) plt.show() -# - +# %% [markdown] # ## Heater model # # You can make a phase shifter model that depends on the applied volage. For that you need first to figure out what's the model associated to your phase shifter, and what is the parameter that you need to tune. +# %% delta_length = 10 mzi_component = gf.components.mzi_phase_shifter_top_heater_metal( delta_length=delta_length ) -fig = mzi_component.plot() +mzi_component.plot() -# + +# %% def straight(wl=1.5, length=10.0, neff=2.4) -> sax.SDict: return sax.reciprocal({("o1", "o2"): jnp.exp(2j * jnp.pi * neff * length / wl)}) @@ -320,8 +342,8 @@ def phase_shifter_heater( "straight": straight, "straight_heater_metal_undercut": phase_shifter_heater, } -# - +# %% mzi_component = gf.components.mzi_phase_shifter_top_heater_metal( delta_length=delta_length ) @@ -330,7 +352,7 @@ def phase_shifter_heater( S = mzi_circuit(wl=1.55) S -# + +# %% wl = np.linspace(1.5, 1.6, 256) S = mzi_circuit(wl=wl) @@ -341,26 +363,30 @@ def phase_shifter_heater( plt.ylabel("T") plt.grid(True) plt.show() -# - +# %% [markdown] # Now you can tune the phase shift applied to one of the arms. # # How do you find out what's the name of the netlist component that you want to tune? # # You can backannotate the netlist and read the labels on the backannotated netlist or you can plot the netlist +# %% mzi_component.plot_netlist() +# %% [markdown] # As you can see the top phase shifter instance `sxt` is hard to see on the netlist. # You can also reconstruct the component using the netlist and look at the labels in klayout. +# %% mzi_yaml = mzi_component.get_netlist_yaml() mzi_component2 = gf.read.from_yaml(mzi_yaml) fig = mzi_component2.plot(label_aliases=True) +# %% [markdown] # The best way to get a deterministic name of the `instance` is naming the reference on your Pcell. -# + +# %% voltages = np.linspace(-1, 1, num=5) voltages = [-0.5, 0, 0.5] @@ -378,9 +404,7 @@ def phase_shifter_heater( plt.title("MZI vs voltage") plt.legend() - -# - - +# %% [markdown] # ## Variable splitter # # You can build a variable splitter by adding a delta length between two 50% power splitters @@ -390,7 +414,7 @@ def phase_shifter_heater( # For example adding a 60um delta length you can build a 90% power splitter -# + +# %% @gf.cell def variable_splitter(delta_length: float, splitter=gf.c.mmi2x2): return gf.c.mzi2x2_2x2(splitter=splitter, delta_length=delta_length) @@ -398,9 +422,9 @@ def variable_splitter(delta_length: float, splitter=gf.c.mmi2x2): nm = 1e-3 c = variable_splitter(delta_length=60 * nm, cache=False) -c +c.plot() -# + +# %% models = { "bend_euler": gs.models.bend, "mmi2x2": gs.models.mmi2x2, @@ -419,25 +443,28 @@ def variable_splitter(delta_length: float, splitter=gf.c.mmi2x2): plt.ylabel("T") plt.grid(True) plt.show() -# - +# %% [markdown] # ## Coupler sim # # Lets compare one coupler versus two coupler +# %% c = gf.components.coupler(length=29.4, gap=0.2) -c +c.plot() +# %% coupler50 = gf.partial(gs.models.coupler, dn=0.026, length=29.4 / 2, coupling0=0) gs.plot_model(coupler50) +# %% [markdown] # As you can see the 50% coupling is only at one wavelength (1550nm) # # You can chain two couplers to increase the wavelength range for 50% operation. -# + +# %% @gf.cell def broadband_coupler(delta_length=0, splitter=gf.c.coupler): return gf.c.mzi2x2_2x2( @@ -446,9 +473,9 @@ def broadband_coupler(delta_length=0, splitter=gf.c.coupler): c = broadband_coupler(delta_length=120 * nm, cache=False) -c +c.plot() -# + +# %% c = broadband_coupler(delta_length=164 * nm, cache=False) models = { "bend_euler": gs.models.bend, @@ -470,6 +497,6 @@ def broadband_coupler(delta_length=0, splitter=gf.c.coupler): plt.ylabel("T") plt.legend() plt.grid(True) -# - +# %% [markdown] # As you can see two couplers have more broadband response diff --git a/docs/notebooks/21_schematic_driven_layout.py b/ubcpdk/samples/notebooks/21_schematic_driven_layout.py similarity index 98% rename from docs/notebooks/21_schematic_driven_layout.py rename to ubcpdk/samples/notebooks/21_schematic_driven_layout.py index 3bdcc488..5d926e87 100644 --- a/docs/notebooks/21_schematic_driven_layout.py +++ b/ubcpdk/samples/notebooks/21_schematic_driven_layout.py @@ -25,7 +25,7 @@ from bokeh.io import output_notebook import gdsfactory as gf -from gdsfactory.schematic_editor import SchematicEditor +from gplugins.schematic_editor import SchematicEditor from gdsfactory.config import rich_output # %env BOKEH_ALLOW_WS_ORIGIN=localhost:8888 @@ -161,7 +161,7 @@ # %% import numpy as np import matplotlib.pyplot as plt -import gdsfactory.simulation.sax as gs +import gplugins.sax as gs import jax.numpy as jnp import sax diff --git a/docs/notebooks/31_data_analysis_mzi.py b/ubcpdk/samples/notebooks/31_data_analysis_mzi.py similarity index 93% rename from docs/notebooks/31_data_analysis_mzi.py rename to ubcpdk/samples/notebooks/31_data_analysis_mzi.py index 75fc905d..59afcd6b 100644 --- a/docs/notebooks/31_data_analysis_mzi.py +++ b/ubcpdk/samples/notebooks/31_data_analysis_mzi.py @@ -1,17 +1,19 @@ # --- # jupyter: # jupytext: +# custom_cell_magics: kql # text_representation: # extension: .py -# format_name: light -# format_version: '1.5' -# jupytext_version: 1.14.5 +# format_name: percent +# format_version: '1.3' +# jupytext_version: 1.11.2 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- +# %% [markdown] # # Data analysis MZI # # We analyze the following MZI samples from the edx course @@ -63,35 +65,42 @@ # dL_wg = dL_path + 2*pi*r - 4*2*r ; dL_wg # = 219.366 +# %% import matplotlib.pyplot as plt import numpy as np import ubcpdk from ubcpdk.simulation.circuits.mzi_spectrum import mzi_spectrum +# %% w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi1, port=0) plt.plot(w, p) +# %% [markdown] # For some reason this MZI has an interference pattern. This is strange because the lengths of both arms are the same. This means that there was a strong height variation on the chip. +# %% w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi3, port=0) plt.plot(w, p) +# %% wr = np.linspace(1520, 1580, 1200) * 1e-3 pr = mzi_spectrum(L1_um=0, L2_um=214.215, wavelength_um=wr) plt.plot(wr * 1e3, 10 * np.log10(pr)) +# %% w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi3, port=0) pb = ubcpdk.data.remove_baseline(w, p) plt.plot(w, pb) +# %% plt.plot(w, pb, label="measurement") plt.plot(wr * 1e3, 10 * np.log10(pr), label="analytical") plt.legend() -# + +# %% # ms.sweep_wavelength? -# + +# %% from scipy.optimize import curve_fit L1_um = 40 @@ -120,17 +129,19 @@ def mzi_logscale(wavelength_um, alpha, n1, n2, n3): plt.plot(w, pb, label="data") plt.plot(w, mzi_logscale(wum, *p0), label="initial condition") plt.legend() -# - +# %% params, params_covariance = curve_fit(mzi_logscale, wum, pb, p0=[1e-3, 2.4, -1, 0]) +# %% params +# %% plt.plot(w, pb, label="data") plt.plot(w, mzi_logscale(wum, *params), label="fit") plt.legend() -# + +# %% L1_um = 40 L2_um = L1_um + 215.932 @@ -156,10 +167,11 @@ def mzi(wavelength_um, alpha, n1, n2, n3): plt.plot(w, pb_linear, label="data") plt.plot(w, mzi(wum, *p0), label="initial condition") plt.legend() -# - +# %% params, params_covariance = curve_fit(mzi, wum, pb, p0=p0) +# %% plt.plot(w, pb_linear, label="data") plt.plot(w, mzi(wum, *params), label="fit") plt.legend() diff --git a/docs/notebooks/32_data_analysis_ring.py b/ubcpdk/samples/notebooks/32_data_analysis_ring.py similarity index 100% rename from docs/notebooks/32_data_analysis_ring.py rename to ubcpdk/samples/notebooks/32_data_analysis_ring.py diff --git a/docs/notebooks/33_data_analysis_dbr.py b/ubcpdk/samples/notebooks/33_data_analysis_dbr.py similarity index 100% rename from docs/notebooks/33_data_analysis_dbr.py rename to ubcpdk/samples/notebooks/33_data_analysis_dbr.py diff --git a/docs/notebooks/Makefile b/ubcpdk/samples/notebooks/Makefile similarity index 100% rename from docs/notebooks/Makefile rename to ubcpdk/samples/notebooks/Makefile diff --git a/docs/notebooks/sdl_demo.pic.yml b/ubcpdk/samples/notebooks/sdl_demo.pic.yml similarity index 100% rename from docs/notebooks/sdl_demo.pic.yml rename to ubcpdk/samples/notebooks/sdl_demo.pic.yml diff --git a/docs/notebooks/test.schem.yml b/ubcpdk/samples/notebooks/test.schem.yml similarity index 100% rename from docs/notebooks/test.schem.yml rename to ubcpdk/samples/notebooks/test.schem.yml diff --git a/ubcpdk/samples/report/EBeam_JoaquinMatres.ipynb b/ubcpdk/samples/report/EBeam_JoaquinMatres.ipynb deleted file mode 100644 index d61eb0ba..00000000 --- a/ubcpdk/samples/report/EBeam_JoaquinMatres.ipynb +++ /dev/null @@ -1,472 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "---\n", - "title: Process control monitors\n", - "author: \"Joaquin Matres\"\n", - "numbersections: true\n", - "autoEqnLabels: true\n", - "geometry:\n", - "- top=30mm\n", - "- left=20mm\n", - "- right=20mm\n", - "- bottom=30mm\n", - "bibliography: library.bib\n", - "header-includes:\n", - " - \\usepackage{float}\n", - "\n", - "---\n", - "\n", - "# Report\n", - "\n", - "## Motivation\n", - "\n", - "As we build more complex photonic systems we need to understand how the\n", - "variability of each component affects the performance of the overall system. In\n", - "this paper we add process control monitor the width and height control for the\n", - "Ebeam process.\n", - "\n", - "Here is a list of components included in the mask\n", - "\n", - "- low and high order MZI to extract group index and effective index\n", - "- different length spirals to extract propagation loss (dB/cm) versus wavelength\n", - "- ring resonators to extract group and effective index variations\n", - "\n", - "\n", - "All the code used, included this report can be found in [this github\n", - "repo](https://github.com/gdsfactory/ubc), which contains:\n", - "\n", - "- GDS layout and circuit models for the components\n", - "- mask code to build GDS, together with JSON metadata\n", - "\n", - "Links:\n", - "\n", - "- [gdsfactory documentation](https://gdsfactory.readthedocs.io/en/latest/)\n", - "[@gdsfactory]\n", - "- [simphony](https://simphonyphotonics.readthedocs.io/en/latest/) for circuit\n", - "simulation.[@simphony]\n", - "- [SiPANN](https://sipann.readthedocs.io/en/latest/) which uses a neural network\n", - "to fit the component models. [@sipann]\n", - "- [modes](https://modes.readthedocs.io/en/latest/index.html)\n", - "\n", - "\n", - "## MZI interferometers\n", - "\n", - "We follow the method described in [@Xing2018] to extract the group index and\n", - "effective index, where we use a low (m=15) and high order (m=150) MZI to extract\n", - "the group and effective index of the waveguide, from which we can extract the\n", - "waveguide width and height.\n", - "\n", - "\n", - "$$m \\lambda_{res} = n_{eff} \\Delta L$$\n", - "\n", - "$$\\Delta L = m \\lambda_{res} / n_{eff}$$\n", - "\n", - "\n", - "According to the ANT [website](https://www.appliednt.com/), waveguides have a\n", - "sidewall angle of 82°. The fabricated 500x220 nm waveguides neff is 2.495 and\n", - "group index 4.12" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import modes\n", - "import gdsfactory as gf\n", - "import ubcpdk.simulation.circuits_simphony as cm\n", - "import gdsfactory.simulation.simphony as gs\n", - "import ubcpdk" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "s = modes.mode_solver_full(angle=82,\n", - " width=500e-3,\n", - " thickness=220e-3,\n", - " plot=True,\n", - " fields_to_write=('Ex',),\n", - " n_modes=1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "ng = modes.group_index(thickness=220e-3, width=470e-3, angle=82)\n", - "print(f'group index ng = {ng[0]:.2f}')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "neff = 2.495\n", - "delta_length_short = 15 * 1.55 / neff\n", - "delta_length_long = 150 * 1.55 / neff\n", - "print(f'MZI short = {delta_length_short:.2f} MZI long = {delta_length_long:.2f}')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can now layout and simulate the MZI responses together with grating couplers." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "ubcpdk.components.mzi(delta_length=delta_length_long)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "ubcpdk.components.mzi(delta_length=delta_length_short)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "attributes": { - "classes": [], - "id": "", - "n": "1" - } - }, - "outputs": [], - "source": [ - "\n", - "mzi_circuit_short = cm.mzi(delta_length=delta_length_short)\n", - "gs.plot_circuit(mzi_circuit_short)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mzi_circuit_long = cm.mzi(delta_length=delta_length_long)\n", - "gs.plot_circuit(mzi_circuit_long)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Ring resonators\n", - "\n", - "We add another method to extract group and effective index using Ring resonators\n", - "as described in [@Lu2017].\n", - "\n", - "The ring resonators from the paper had 500 x 220nm waveguides, 4.5um coupler\n", - "length, 200nm gap and 12um bend radius." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "ubcpdk.components.ring_single(length_x=4.5, gap=0.2, radius=12)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import ubcpdk.simulation.circuits_simphony as siepic\n", - "import matplotlib.pyplot as plt\n", - "\n", - "c = siepic.ebeam_dc_halfring_straight(\n", - " gap=200e-9,\n", - " radius=12e-6,\n", - " width=500e-9,\n", - " thickness=220e-9,\n", - " couple_length=4e-6\n", - ")\n", - "gs.plot_model(c, pin_in='o1', pins=('o2', 'o3', 'o4'))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We use [simphony](https://simphonyphotonics.readthedocs.io/en/latest/) for\n", - "circuit simulation. As simphony misses Sparameters for some coupler designs, we\n", - "use [SiPANN](https://sipann.readthedocs.io/en/latest/) which uses a neural\n", - "network to interpolate missing Sparameter values." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "from SiPANN import nn\n", - "\n", - "\n", - "def f(radius,\n", - " couplerLength,\n", - " gap,\n", - " width,\n", - " thickness,\n", - " sw_angle,\n", - " couplerWidth,\n", - " wavelength=np.squeeze(np.linspace(1.5,1.6,5000))):\n", - " \"\"\" units in um\n", - " \"\"\" \n", - " E, alpha, t, alpha_s, _ = nn.racetrack_AP_RR_TF(wavelength,\n", - " widthCoupler=couplerWidth,\n", - " radius=radius,\n", - " sw_angle=sw_angle,\n", - " couplerLength=couplerLength,\n", - " gap=gap,\n", - " width=width,\n", - " thickness=thickness)\n", - " \n", - " input = np.squeeze([1,0])\n", - " throughPort = 10*np.log10(np.abs(np.squeeze(E)) ** 2)\n", - " #throughPort = np.unwrap(np.angle(np.squeeze(E)))\n", - "\n", - " plt.figure()\n", - " plt.plot(wavelength, (throughPort), label='Through Port')\n", - " plt.xlabel('Wavelength ($\\mu$m)')\n", - " plt.ylabel('Power (a.u.)')\n", - " plt.grid(True)\n", - " plt.title(f'couplerLength = {couplerLength}')\n", - " plt.legend()\n", - " #plt.ylim(-30, 0.1)\n", - " #plt.xlim(1.55,1.56)\n", - " plt.tight_layout()\n", - " plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=4.5, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=6, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=2.5, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "As we can see it's hard to distinguish undercoupled from overcoupled regimes, so\n", - "we plot both amplitude and phase." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "from SiPANN import nn\n", - "\n", - "wavelength = np.squeeze(np.linspace(1.5,1.6,5000))\n", - "\n", - "def f(radius,couplerLength,gap,width,thickness,sw_angle,couplerWidth):\n", - " \"\"\" units in um\n", - " \"\"\"\n", - " E, alpha, t, alpha_s, _ = nn.racetrack_AP_RR_TF(wavelength,\n", - " widthCoupler=couplerWidth,\n", - " radius=radius,\n", - " sw_angle=sw_angle,\n", - " couplerLength=couplerLength,\n", - " gap=gap,\n", - " width=width,\n", - " thickness=thickness)\n", - "\n", - "\n", - " f, (ax1, ax2) = plt.subplots(2, 1, sharex=True)\n", - " # Evaluate response\n", - " input = np.squeeze([1,0])\n", - " throughPort = 10*np.log10(np.abs(np.squeeze(E)) ** 2)\n", - " throughPort_angle = np.unwrap(np.angle(np.squeeze(E)))\n", - "\n", - " ax1.plot(wavelength, (throughPort), label='Through Port')\n", - " ax1.set_ylabel('Power (dB)')\n", - " ax1.grid()\n", - " \n", - " ax2.plot(wavelength, (throughPort_angle), label='Through Port')\n", - " \n", - " plt.xlabel('Wavelength ($\\mu$m)')\n", - " plt.ylabel('Angle (rad)')\n", - " plt.grid(True)\n", - " #plt.legend()\n", - " ax1.set_ylim(-30, 0.1)\n", - " #plt.xlim(1.55,1.56)\n", - " plt.tight_layout()\n", - " ax1.set_title(f'couplerLength = {couplerLength}')\n", - "\n", - " plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=4.5, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=2.5, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f(radius=12, couplerLength=6.5, gap=0.2, width=0.5, thickness=.22, sw_angle=82, couplerWidth=.5)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Spirals for waveguide loss\n", - "\n", - "For measuring waveguide loss for different wavelengths we added 3 spirals with\n", - "different length" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "N = 15\n", - "radius = 15\n", - "\n", - "s1 = gf.components.spiral_external_io(\n", - " N=N,\n", - " radius=radius,\n", - " y_straight_inner_top=0,\n", - " x_inner_length_cutback=0,\n", - ")\n", - "\n", - "s2 = gf.components.spiral_external_io(\n", - " N=N,\n", - " radius=radius,\n", - " y_straight_inner_top=30,\n", - " x_inner_length_cutback=85,\n", - ")\n", - "\n", - "print(f\"spiral 1 length = {s1.info['length']/1e4:.2f} cm\")\n", - "s1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "print(f\"spiral 2 length = {s2.info['length']/1e4:.2f} cm\")\n", - "s2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## References\n", - "\n", - "- [1] “Gdsfactory — gdsfactory documentation.” [Online]. Available:\n", - "https://gdsfactory.readthedocs.io/en/latest/.\n", - "- [2] “Simphony Documentation — Simphony Manual.” [Online]. Available:\n", - "https://simphonyphotonics.readthedocs/io/en/latest/.\n", - "- [3] “SiPANN documentation.” [Online]. Available:\n", - "https://sipann.readthedocs.io/en/latest/.\n", - "- [4] Y. Xing, J. Dong, S. Dwivedi, U. Khan, and W. Bogaerts, “Accurate\n", - "extraction of fabricated geometry using optical measurement,” Photonics\n", - "Research, vol. 6, no. 11, p. 1008, 2018, doi: 10.1364/prj.6.001008.\n", - "- [5] Z. Lu et al., “Performance prediction for silicon photonics integrated\n", - "circuits with layout-dependent correlated manufacturing variability,” Optics\n", - "Express, vol. 25, no. 9, p. 9712, 2017, doi: 10.1364/oe.25.009712.\n", - "- [6] [Modes documentation](https://modes.readthedocs.io/en/latest/index.html)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/ubcpdk/samples/report/Makefile b/ubcpdk/samples/report/Makefile deleted file mode 100644 index 619f4143..00000000 --- a/ubcpdk/samples/report/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -md: - jupyter nbconvert --to markdown report.ipynb - -pdf: - pandoc --highlight=tango --filter pandoc-crossref --filter pandoc-citeproc --csl ieee.csl --bibliography=library.bib JoaquinMatres.md -o JoaquinMatres.pdf - -open: - zathura report.pdf - -pdfc: - jupyter nbconvert --to pdf report.ipynb - -bib: - cp $(HOME)/wikis/library.bib . - - -execute: - jupyter nbconvert --to notebook --execute my_notebook.ipynb - - -clean: - rm *.aux *.tex *.log *.odt *.blg *.out *.html *.json *.epub *.docx *.latex - - -.PHONY: all clean paper diff --git a/ubcpdk/samples/report/ieee.csl b/ubcpdk/samples/report/ieee.csl deleted file mode 100644 index 861bf350..00000000 --- a/ubcpdk/samples/report/ieee.csl +++ /dev/null @@ -1,387 +0,0 @@ - - - diff --git a/ubcpdk/samples/report/requirements.txt b/ubcpdk/samples/report/requirements.txt deleted file mode 100644 index d20f11cc..00000000 --- a/ubcpdk/samples/report/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -modes -SiPANN diff --git a/ubcpdk/samples/report/splitter_length.py b/ubcpdk/samples/report/splitter_length.py deleted file mode 100644 index d0d9ceeb..00000000 --- a/ubcpdk/samples/report/splitter_length.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Equations for MZI. - -w = 1.55 -io/ii = 1/2*(1+cos(beta*dl)) -beta = 2*np.pi*n/w - -beta*l = np.pi -beta = 2*np.pi*n/w - -2*np.pi*n*l/w = np.pi -l = w/2/n -l = np.pi/beta -""" -import numpy as np - - -def get_pi_length(w: float = 1.55, n: float = 2.4) -> float: - return w / 2 / n - - -def get_length(power_per_cent: float = 80, w: float = 1.55, n: float = 2.4) -> float: - """Returns length for a MZI based variable. - - io/ii = 1/2*(1+cos(beta*dl)) = sqrt(power_per_cent) - 1+cos(beta*dl) = 2* power_per_cent - cos(beta*dl) = 2* power_per_cent - 1 - beta*dl = np.arcos(2* power_per_cent - 1) - dl = (np.arcos(2* power_per_cent - 1))/beta - - .. code:: - L+dl - ______ - input __| |__ output - ===____________== - L - """ - beta = 2 * np.pi * n / w - return (np.arccos(2 * power_per_cent / 100 - 1)) / beta - - -if __name__ == "__main__": - # print(get_pi_length()) - print(get_length() * 1e3) diff --git a/ubcpdk/simulation/circuits_simphony.py b/ubcpdk/simulation/circuits_simphony.py deleted file mode 100644 index c640ab6c..00000000 --- a/ubcpdk/simulation/circuits_simphony.py +++ /dev/null @@ -1,68 +0,0 @@ -from functools import partial - -import gdsfactory.simulation.simphony as gs -from simphony.libraries import siepic - - -def ebeam_y_1550(**kwargs): - c = siepic.YBranch(**kwargs) - c.rename_pins("o1", "o2", "o3") - return c - - -def ebeam_bdc_te1550(**kwargs): - c = siepic.BidirectionalCoupler(**kwargs) - c.rename_pins("o1", "o2", "o4", "o3") - return c - - -def ebeam_dc_halfring_straight(**kwargs): - c = siepic.HalfRing(**kwargs) - c.rename_pins("o1", "o2", "o4", "o3") - return c - - -def ebeam_dc_te1550(**kwargs): - c = siepic.DirectionalCoupler(**kwargs) - c.rename_pins("o1", "o2", "o4", "o3") - return c - - -def ebeam_gc_te1550(**kwargs): - c = siepic.GratingCoupler(**kwargs) - c.rename_pins("o1", "o2") - return c - - -def ebeam_terminator_te1550(**kwargs): - c = siepic.Terminator(**kwargs) - c.rename_pins( - "o1", - ) - return c - - -mzi = partial( - gs.components.mzi, - splitter=ebeam_y_1550, -) - - -model_factory = dict( - ebeam_y_1550=ebeam_y_1550, - ebeam_bdc_te1550=ebeam_bdc_te1550, - ebeam_dc_halfring_straight=ebeam_dc_halfring_straight, - ebeam_dc_te1550=ebeam_dc_te1550, - ebeam_gc_te1550=ebeam_gc_te1550, - ebeam_terminator_te1550=ebeam_terminator_te1550, -) - -circuit_factory = dict(mzi=mzi) - - -if __name__ == "__main__": - # from gdsfactory.simulation.simphony.plot_circuit import plot_circuit - # c = mzi() - # plot_circuit(c) - - gs.plot_model(ebeam_gc_te1550) diff --git a/ubcpdk/simulation/modes_waveguide.py b/ubcpdk/simulation/modes_waveguide.py index 09c1aef1..1526624b 100644 --- a/ubcpdk/simulation/modes_waveguide.py +++ b/ubcpdk/simulation/modes_waveguide.py @@ -1,7 +1,7 @@ """MPB mode simulations.""" import gdsfactory as gf -import gdsfactory.simulation.modes as gm +import gplugins.modes as gm from ubcpdk.config import PATH