LayerMap
Named layer definitions loaded from rosette.toml.
Provides attribute-style access to layers by semantic name, so components and designs can reference layers without hardcoded numbers.
layers = load_layer_map()
layers.silicon # -> LayerInfo('silicon', Layer(1, 0), color='#ff69b4')
layers.silicon.layer # -> Layer(1, 0)
layers.silicon.color # -> '#ff69b4'
# Use directly in component calls and cell operations
wg = waveguide(layers.silicon.layer, waveguide_width=0.5, length=10.0)
cell.add_polygon(poly, layers.silicon.layer)
# Iterate over all layers
for info in layers:
print(f"{info.name}: Layer({info.number}, {info.datatype})")
# Check if a layer exists
if "silicon" in layers:
print("has silicon layer")Methods
func__init__(layer_infos=None) -> NoneCreate a LayerMap from a list of LayerInfo objects.
Usually you don't create this directly — use load_layer_map() instead.
paramlayer_infoslist[LayerInfo] | None= NoneList of layer definitions. If None, creates an empty map.
Returns
Nonefuncget(name) -> LayerInfo | NoneGet a layer by name, or None if not found.
paramnamestrLayer name to look up.
Returns
LayerInfo | Nonefuncnames() -> list[str]Get all layer names.
Returns
list[str]functo_dict_list() -> list[dict]Export as a list of dicts for serialization.
Returns a list suitable for JSON serialization, matching the viewer's layer interface.
Returns
list[dict]Supported operations
- Attribute access:
layers.siliconreturns theLayerInfofor"silicon" - Containment:
"silicon" in layerschecks if a layer name exists - Iteration:
for info in layers:iterates over allLayerInfoobjects - Length:
len(layers)returns the number of layers