Skip to content

t_core evaluates to zero because GDS layer tuples are compared against layer objects for membership #757

Description

@Alisama20

Repo/version: gplugins 2.0.1 on gdsfactory 9.34.2

What happened: In gplugins.gmeep.get_simulation, the vertical extent is sized using

layers_thickness = [layer_to_thickness[layer] for layer in component.layers
                    if layer in layer_to_thickness]
t_core = sum(layers_thickness)

component.layers yields GDS tuples such as (3, 0), while the keys of layer_to_thickness are layer objects (LogicalLayer, and derived ones like WG - GRA). They never compare equal, so layers_thickness is empty and t_core is 0 for every Cornerstone component tried. The 220 nm core contributes nothing to the domain it is supposed to size.

Steps to reproduce:

import gdsfactory as gf
from cspdk.si220.cband import PDK

PDK.activate()
stack = PDK.get_layer_stack()

stack.get_layer_to_thickness().keys()   # LogicalLayer/DerivedLayer objects
gf.get_component("mmi2x2").layers       # [(3, 0)]

Expected: t_core should capture the 220 nm core thickness (and any other layers the component touches) to set the vertical cell extent correctly.

Actual: layers_thickness comes back empty and t_core is 0. This compounds with issue 3 in the same file's account: the ignored margin makes the cell too large, while the empty t_core makes it too small. Both are silent.

Suggested fix: Normalise both sides to the same layer representation before the membership test, and raise rather than continue when the result is empty — a zero core thickness is never a legitimate answer. Independently, sum is the wrong reduction for stacked layers that overlap in z; max(zmax) - min(zmin) over the levels the component touches would be the geometric answer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions