Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more docs #2771

Merged
merged 13 commits into from
May 21, 2024
1 change: 1 addition & 0 deletions gdsfactory/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ def remap_layers(
if recursive:
for ci in self.called_cells():
self.kcl[ci].move(src_layer_index, dst_layer_index)
return self

def pprint_ports(self, **kwargs) -> None:
"""Pretty prints ports.
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/components/die_bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ def die_bbox(
if __name__ == "__main__":
mask = gf.components.array(rows=10, columns=10)
# c = die_bbox(component=mask, die_name="chip99")
c = die_bbox()
c = die_bbox(component=mask, die_name="chip99", text_anchor="se")
c.show()
2 changes: 1 addition & 1 deletion gdsfactory/components/straight_heater_doped.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,5 @@ def straight_heater_doped_strip(


if __name__ == "__main__":
c = straight_heater_doped_rib()
c = straight_heater_doped_rib(length=100)
c.show()
25 changes: 21 additions & 4 deletions gdsfactory/read/from_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import numpy as np
from omegaconf import DictConfig, OmegaConf

import gdsfactory as gf
from gdsfactory.add_pins import add_instance_label
from gdsfactory.component import Component, Instance
from gdsfactory.serialization import clean_value_json
Expand Down Expand Up @@ -276,7 +275,8 @@ def place(
elif mirror is False:
pass
elif isinstance(mirror, str):
ref.mirror_x(port_name=mirror)
x_mirror = ref.ports[mirror].x
ref.mirror_x(x_mirror)
elif isinstance(mirror, int | float):
x = to_um(ref, x)
ref.mirror_x(x=x)
Expand Down Expand Up @@ -724,7 +724,7 @@ def from_yaml(
)


@gf.cell(rec_dicts=True, set_name=False)
# @gf.cell(rec_dicts=True, set_name=False)
def _from_yaml(
conf,
routing_strategy: dict[str, Callable],
Expand Down Expand Up @@ -1462,11 +1462,28 @@ def _from_yaml(
dy: 10
"""

mirror_demo = """
name: mirror_demo
instances:
mmi_long:
component: mmi1x2
settings:
width_mmi: 4.5
length_mmi: 5
placements:
mmi_long:
x: 0
y: 0
mirror: o1
rotation: 0

"""


if __name__ == "__main__":
# c = from_yaml(sample_doe_function)
# c = from_yaml(sample_mmis)
c = from_yaml(sample_doe_function)
c = from_yaml(mirror_demo)
c.show()
# n = c.get_netlist()
# yaml_str = OmegaConf.to_yaml(n, sort_keys=True)
Expand Down
5 changes: 4 additions & 1 deletion gdsfactory/read/from_yaml_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ def get_default_settings_dict(default_settings):
settings = {}
for k, v in default_settings.items():
try:
settings[k] = v["value"]
v = v["value"]
if isinstance(v, list):
v = tuple(v)
settings[k] = v
except TypeError as te:
raise TypeError(
f'Default setting "{k}" should be a dictionary with "value" defined.'
Expand Down
Loading
Loading