Skip to content

Commit

Permalink
simpler component_factory thanks to import_module_factories functio…
Browse files Browse the repository at this point in the history
…n from gf.cell
  • Loading branch information
joamatab committed Apr 6, 2022
1 parent 38104b9 commit bd4929d
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.4.0]

- simpler component_factory thanks to `import_module_factories` function from gf.cell

## [1.3.9](https://github.com/gdsfactory/ubc/pull/17)

- add circuit samples
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e .
lygadgets
gdsfactory[full]==4.5.3
gdsfactory[full]==4.6.1
modes
12 changes: 10 additions & 2 deletions ubcpdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
"""UBC Siepic Ebeam PDK from edx course"""
import gdsfactory as gf
from gdsfactory.config import logger
from gdsfactory.cell import get_module_factories


from ubcpdk.config import CONFIG, PATH, module
from ubcpdk.tech import LAYER, strip
from ubcpdk import components
from ubcpdk import tech
from ubcpdk import data

from ubcpdk.components import component_factory
from ubcpdk.tech import cross_section_factory


gf.asserts.version(">=4.2.1")
gf.asserts.version(">=4.6.1")
lys = gf.layers.load_lyp(PATH.lyp)
__version__ = "1.3.9"

Expand All @@ -30,3 +32,9 @@


logger.info(f"Found UBCpdk {__version__!r} installed at {module!r}")
component_factory = get_module_factories(components)


if __name__ == "__main__":
f = component_factory
print(f.keys())
20 changes: 0 additions & 20 deletions ubcpdk/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,6 @@
straight,
)

component_factory = dict(
add_fiber_array=add_fiber_array,
bend_euler=bend_euler,
crossing=crossing,
dbr=dbr,
dbr_cavity=dbr_cavity,
dc_adiabatic=dc_adiabatic,
dc_broadband_te=dc_broadband_te,
dc_broadband_tm=dc_broadband_tm,
gc_te1310=gc_te1310,
gc_te1550=gc_te1550,
gc_te1550_broadband=gc_te1550_broadband,
gc_tm1550=gc_tm1550,
ring_with_crossing=ring_with_crossing,
spiral=spiral,
straight=straight,
y_adiabatic=y_adiabatic,
y_splitter=y_splitter,
)


__all__ = [
"add_fiber_array",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion ubcpdk/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from gdsfactory.component import Component
from gdsfactory.difftest import difftest
from pytest_regressions.data_regression import DataRegressionFixture
from ubcpdk.components import component_factory
from ubcpdk import component_factory


component_names = component_factory.keys()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
settings:
changed: {}
child: null
default:
coupler_straight:
function: coupler_straight
coupler_symmetric:
function: coupler_symmetric
cross_section:
function: cross_section
dx: 10
dy: 5
gap: 0.236
length: 20
full:
coupler_straight:
function: coupler_straight
coupler_symmetric:
function: coupler_symmetric
cross_section:
function: cross_section
dx: 10
dy: 5
gap: 0.236
length: 20
function_name: coupler
info:
length: 10.314
min_bend_radius: 9.451
info_version: 2
module: gdsfactory.components.coupler
name: coupler
version: 0.0.1
95 changes: 95 additions & 0 deletions ubcpdk/tests/test_components/test_pdk_settings_mzi_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
settings:
changed:
bend:
decorator:
- function: add_bbox_siepic
- function: add_pins_siepic
function: bend_euler
port_e0_combiner: opt3
port_e0_splitter: opt3
port_e1_combiner: opt2
port_e1_splitter: opt2
splitter:
decorator:
- function: add_ports_from_siepic_pins
- function: remove_pins
- - function: add_bbox_siepic
- function: add_pins_siepic
- function: add_siepic_labels_and_simulation_info
doc: Y junction TE1550 50/50 power.
function: import_gds
gdsdir: gds
gdspath: ebeam_y_1550.gds
model: ebeam_y_1550
name: ebeam_y_1550
opt1: opt_a1
opt2: opt_b1
opt3: opt_b2
child: null
default:
bend:
function: bend_euler
combiner: null
cross_section:
function: cross_section
delta_length: 10
length_x: 0.1
length_y: 2
nbends: 2
port_e0_combiner: o3
port_e0_splitter: o3
port_e1_combiner: o2
port_e1_splitter: o2
splitter:
function: mmi1x2
straight:
function: straight
straight_x_bot: null
straight_x_top: null
straight_y: null
with_splitter: true
full:
bend:
decorator:
- function: add_bbox_siepic
- function: add_pins_siepic
function: bend_euler
combiner: null
cross_section:
function: cross_section
delta_length: 10
length_x: 0.1
length_y: 2
nbends: 2
port_e0_combiner: opt3
port_e0_splitter: opt3
port_e1_combiner: opt2
port_e1_splitter: opt2
splitter:
decorator:
- function: add_ports_from_siepic_pins
- function: remove_pins
- - function: add_bbox_siepic
- function: add_pins_siepic
- function: add_siepic_labels_and_simulation_info
doc: Y junction TE1550 50/50 power.
function: import_gds
gdsdir: gds
gdspath: ebeam_y_1550.gds
model: ebeam_y_1550
name: ebeam_y_1550
opt1: opt_a1
opt2: opt_b1
opt3: opt_b2
straight:
function: straight
straight_x_bot: null
straight_x_top: null
straight_y: null
with_splitter: true
function_name: mzi
info: {}
info_version: 2
module: gdsfactory.components.mzi
name: mzi_f9d34325
version: 0.0.1
35 changes: 35 additions & 0 deletions ubcpdk/tests/test_components/test_pdk_settings_ring_single_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
settings:
changed: {}
child: null
default:
bend:
function: bend_euler
coupler_ring:
function: coupler_ring
cross_section:
function: cross_section
gap: 0.2
length_x: 4
length_y: 0.6
radius: 10
straight:
function: straight
full:
bend:
function: bend_euler
coupler_ring:
function: coupler_ring
cross_section:
function: cross_section
gap: 0.2
length_x: 4
length_y: 0.6
radius: 10
straight:
function: straight
function_name: ring_single
info: {}
info_version: 2
module: gdsfactory.components.ring_single
name: ring_single
version: 0.0.1

0 comments on commit bd4929d

Please sign in to comment.