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:
-
extract_from_pdk–Extract layer stack from a PDK module or PDK object.
-
extract_layer_stack–Extract layer stack from a gdsfactory LayerStack.
Attributes:
-
DEFAULT_SUBSTRATE_THICKNESS–Depth below
z=0(um) used whensubstrate_thicknessis not given.
DEFAULT_SUBSTRATE_THICKNESS
module-attribute
¶
Depth below z=0 (um) used when substrate_thickness is not given.
Layer
¶
Bases: BaseModel
Layer information for Palace simulation.
- API Guides
-
API Reference
gsim
Methods:
-
get_mesh_size–Get mesh size in um for this layer.
-
to_dict–Convert to dictionary for YAML output.
LayerStack
¶
Bases: BaseModel
Complete layer stack for Palace simulation.
- API Guides
-
API Reference
gsim
-
API Reference
gsim-
common -
femwell -
meep -
palace-
extract_nets -
extract_ports -
generate_mesh -
basePalaceSimMixinset_stack -
boundarymodeBoundaryModeSimset_stack -
current_sources -
drivenDrivenSimset_stack -
eigenmodeEigenmodeSimset_stack -
electrostaticElectrostaticSimset_stack -
magnetostaticMagnetostaticSimset_stack -
mesh -
ports
-
-
Methods:
-
from_layer_list–Build a LayerStack from a list of Layer objects.
-
get_conductor_layers–Get all conductor layers.
-
get_via_layers–Get all via layers.
-
get_z_range–Get the full z-range of the stack (substrate bottom to air top).
-
record_omitted_substrate_layers–Remember substrate layers left out of the stack (informational).
-
to_dict–Convert to dictionary for YAML output.
-
to_yaml–Convert to YAML string and optionally write to file.
-
validate_stack–Validate the layer stack for simulation readiness.
Attributes:
-
omitted_substrate_layers(list[dict]) –Substrate layers dropped from the stack (
include_substrate=False).
omitted_substrate_layers
property
¶
Substrate layers dropped from the stack (include_substrate=False).
Each entry has name, material, zmin, zmax and
thickness (um). Empty when the substrate was included or the
source stack had none.
from_layer_list
classmethod
¶
from_layer_list(layerList: list[Layer]) -> LayerStack
Build a LayerStack from a list of Layer objects.
Parameters:
Returns:
-
LayerStack–A LayerStack with layers/materials/dielectrics assembled from
layerList.
Raises:
-
ValueError–If
layerListis None or empty.
get_z_range
¶
Get the full z-range of the stack (substrate bottom to air top).
record_omitted_substrate_layers
¶
Remember substrate layers left out of the stack (informational).
to_yaml
¶
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–ValidationResult with valid flag, errors, and warnings
ValidationResult
¶
Bases: BaseModel
Result of stack validation.
Attributes:
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 | None = None,
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 | None, default:None) –Depth below
z=0(um), default 2.0 when omitted. Withinclude_substrate=Falseit is the depth of the synthetic oxide fill (the bottom of the stack), and the PDK's substrate layer is left out of the stack altogether (seeinclude_substrate). That needsadd_oxide_dielectric=True: withadd_oxide_dielectric=Falsenothing is built from it, the stack bottom comes from the PDK's dielectric layers, and a warning is logged when the value was given explicitly. Withinclude_substrate=Trueit is the thickness of the silicon substrate; for a stack with shaped (photonic) dielectrics it can only deepen the PDK's substrate, never make it shallower. A warning is logged when the value (or the 2.0 um default) and the PDK's substrate layer disagree. -
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). When False, the PDK's substrate layer (and its thickness) does not enter the stack: changing the Si thickness in the PDK stack changes nothing. The omitted layers are listed in :attr:
LayerStack.omitted_substrate_layers. -
add_oxide_dielectric(bool, default:True) –Add synthetic oxide background dielectric region. Set False to rely on dielectric regions/layers provided by the PDK. The oxide fill is what carries
substrate_thicknesswhen the substrate is omitted, so withinclude_substrate=Falsethe bottom of the stack then comes from the PDK's layers instead.
Returns:
-
LayerStack–LayerStack object for Palace simulation