Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update component.py #315

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gplugins/tidy3d/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import time
from collections.abc import Awaitable
from functools import cached_property
from typing import Any
from typing import Any, Literal

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -66,6 +66,8 @@ class Tidy3DComponent(LayeredComponentBase):
dilation (float): Dilation of the polygon in the base by shifting each edge along its
normal outwards direction by a distance;
a negative value corresponds to erosion. Defaults to zero.
reference_plane (Literal["bottom", "middle", "top"]): the reference plane
used by tidy3d's PolySlab when applying sidewall_angle to a layer
"""

material_mapping: dict[str, Tidy3DMedium] = material_name_to_medium
Expand All @@ -76,6 +78,7 @@ class Tidy3DComponent(LayeredComponentBase):
pad_z_inner: float = 0.0
pad_z_outer: NonNegativeFloat = 0.0
dilation: float = 0.0
reference_plane: Literal["bottom", "middle", "top"] = "middle"

@cached_property
def polyslabs(self) -> dict[str, tuple[td.PolySlab, ...]]:
Expand All @@ -96,7 +99,7 @@ def polyslabs(self) -> dict[str, tuple[td.PolySlab, ...]]:
axis=2,
slab_bounds=(bbox[0][2], bbox[1][2]),
sidewall_angle=np.deg2rad(layer.sidewall_angle),
reference_plane="middle",
reference_plane=self.reference_plane,
dilation=self.dilation,
)
for v in self.get_vertices(name)
Expand Down
Loading