Skip to content

extractor

Extract layer stack from gdsfactory PDK and convert to YAML format.

This module reads a PDK's LayerStack and generates a YAML stack file that can be used for Palace EM simulation.

Classes:

  • Layer –

    Layer information for Palace simulation.

  • LayerStack –

    Complete layer stack for Palace simulation.

  • ValidationResult –

    Result of stack validation.

Functions:

Layer

Bases: BaseModel

Layer information for Palace simulation.

Methods:

  • get_mesh_size –

    Get mesh size in um for this layer.

  • to_dict –

    Convert to dictionary for YAML output.

get_mesh_size

get_mesh_size(base_size: float = 1.0) -> float

Get mesh size in um for this layer.

Parameters:

  • base_size (float, default: 1.0 ) –

    Base mesh size for "medium" resolution

Returns:

  • float –

    Mesh size in um

to_dict

to_dict() -> dict

Convert to dictionary for YAML output.

LayerStack

Bases: BaseModel

Complete layer stack for Palace simulation.

Methods:

from_layer_list classmethod

from_layer_list(layerList: list[Layer]) -> LayerStack

Build a LayerStack from a list of Layer objects.

Parameters:

  • layerList (list[Layer]) –

    List of Layer definitions to include in the stack.

Returns:

  • LayerStack –

    A LayerStack with layers/materials/dielectrics assembled from layerList.

Raises:

get_conductor_layers

get_conductor_layers() -> dict[str, Layer]

Get all conductor layers.

get_via_layers

get_via_layers() -> dict[str, Layer]

Get all via layers.

get_z_range

get_z_range() -> tuple[float, float]

Get the full z-range of the stack (substrate bottom to air top).

to_dict

to_dict() -> dict

Convert to dictionary for YAML output.

to_yaml

to_yaml(path: Path | None = None) -> str

Convert to YAML string and optionally write to file.

Parameters:

  • path (Path | None, default: None ) –

    Optional path to write YAML file

Returns:

  • str –

    YAML string

validate_stack

validate_stack(tolerance: float = 0.001) -> ValidationResult

Validate the layer stack for simulation readiness.

Checks: 1. Z-axis continuity: no gaps in dielectric regions 2. Material coverage: all materials have properties defined 3. Layer coverage: all conductor/via layers are within dielectric envelope 4. No negative thicknesses

Parameters:

  • tolerance (float, default: 0.001 ) –

    Tolerance for z-coordinate comparisons (um)

Returns:

ValidationResult

Bases: BaseModel

Result of stack validation.

Attributes:

  • info (list[str]) –

    Informational notes (e.g. the active settings); not problems.

info class-attribute instance-attribute

info: list[str] = Field(default_factory=list)

Informational notes (e.g. the active settings); not problems.

extract_from_pdk

extract_from_pdk(pdk_module, output_path: Path | None = None, **kwargs) -> LayerStack

Extract layer stack from a PDK module or PDK object.

Parameters:

  • pdk_module –

    PDK module (e.g., ihp, sky130) or gdsfactory Pdk object

  • output_path (Path | None, default: None ) –

    Optional path to write YAML file

  • **kwargs –

    Additional arguments passed to extract_layer_stack

Returns:

  • LayerStack –

    LayerStack object for Palace simulation

extract_layer_stack

extract_layer_stack(
    gf_layer_stack: LayerStack,
    pdk_name: str = "unknown",
    substrate_thickness: float = 2.0,
    air_above: float = 0.0,
    air_below: float = 0.0,
    boundary_margin: float = 30.0,
    include_substrate: bool = False,
    add_oxide_dielectric: bool = True,
) -> LayerStack

Extract layer stack from a gdsfactory LayerStack.

Parameters:

  • gf_layer_stack (LayerStack) –

    gdsfactory LayerStack object

  • pdk_name (str, default: 'unknown' ) –

    Name of the PDK (for documentation)

  • substrate_thickness (float, default: 2.0 ) –

    Thickness of substrate in um (default: 2.0)

  • air_above (float, default: 0.0 ) –

    Height of air box above top dielectric in um (default: 0.0)

  • air_below (float, default: 0.0 ) –

    Height of air box below substrate/oxide in um (default: 0.0)

  • boundary_margin (float, default: 30.0 ) –

    Lateral margin from GDS bbox in um (default: 30)

  • include_substrate (bool, default: False ) –

    Whether to include lossy substrate (default: False)

  • add_oxide_dielectric (bool, default: True ) –

    Add synthetic oxide background dielectric region. Set False to rely on dielectric regions/layers provided by the PDK.

Returns:

  • LayerStack –

    LayerStack object for Palace simulation