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) -> None

Create a LayerMap from a list of LayerInfo objects.

Usually you don't create this directly — use load_layer_map() instead.

paramlayer_infoslist[LayerInfo] | None
= None

List of layer definitions. If None, creates an empty map.

Returns

None
funcget(name) -> LayerInfo | None

Get a layer by name, or None if not found.

paramnamestr

Layer name to look up.

Returns

LayerInfo | None
funcnames() -> 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.silicon returns the LayerInfo for "silicon"
  • Containment: "silicon" in layers checks if a layer name exists
  • Iteration: for info in layers: iterates over all LayerInfo objects
  • Length: len(layers) returns the number of layers

On this page