gdsfactory.read.from_yaml#
- gdsfactory.read.from_yaml(yaml_str: str | ~pathlib.Path | ~typing.IO[~typing.Any] | dict[str, ~typing.Any] | ~omegaconf.dictconfig.DictConfig, routing_strategy: dict[str, ~collections.abc.Callable] | None = None, label_instance_function: ~collections.abc.Callable = <function add_instance_label>, name: str | None = None, prefix: str | None = None, validate: bool = False, **kwargs) Component [source]#
Returns Component from YAML string or file.
YAML includes instances, placements, routes, ports and connections.
- Parameters:
yaml – YAML string or file.
routing_strategy – for each route.
label_instance_function – to label each instance.
name – Optional name.
prefix – name prefix.
validate – validate component.
kwargs – function settings for creating YAML PCells.
valid variables: name: Optional Component name settings: Optional variables pdk: overrides info: Optional component info description: just a demo polarization: TE ... instances: name: component: (ComponentSpec) settings (Optional) length: 10 ... placements: x: float, str | None str can be instanceName,portName y: float, str | None rotation: float | None mirror: bool, float | None float is x mirror axis port: str | None port anchor connections (Optional): between instances ports (Optional): ports to expose routes (Optional): bundles of routes routeName: library: optical links: instance1,port1: instance2,port2
settings: length_mmi: 5 instances: mmi_bot: component: mmi1x2 settings: width_mmi: 4.5 length_mmi: 10 mmi_top: component: mmi1x2 settings: width_mmi: 4.5 length_mmi: ${settings.length_mmi} placements: mmi_top: port: o1 x: 0 y: 0 mmi_bot: port: o1 x: mmi_top,o2 y: mmi_top,o2 dx: 30 dy: -30 routes: optical: library: optical links: mmi_top,o3: mmi_bot,o1