Skip to content

Commit

Permalink
fix gdsfactory region loader
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafacc committed Mar 6, 2024
1 parent 7acbf02 commit db49e8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion gds_tidy3d/lyprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging


def dilate(vertices, extension=1):
def dilate(vertices, extension=1.3):
"""grow or shrink a rectangle defined as [[x1,y1],[x2,y2]]
Args:
Expand Down Expand Up @@ -76,6 +76,12 @@ def load_region(layout, layer=[68, 0], z_center=0, z_span=5, extension=1.3):
layout to extract the polygons from.
layer : klayout.db (pya) layout.layer() type
Layer to place detect the devrec object from.
z_center: float
Z-center of the layout. Defaults to 0 (microns).
z_span: float
Z-span of the layout. Defaults to 5 (microns).
extension: float
amount of extended region to retrieve beyond specified region.
Returns
-------
Expand Down
16 changes: 8 additions & 8 deletions gds_tidy3d/simprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import tidy3d as td
import numpy as np
from .core import structure, region, port, component
from .core import structure, region, port, component, Simulation
from .lyprocessor import (
load_structure,
load_region,
load_ports,
load_structure_from_bounds,
dilate,
dilate_1d,
)

Expand Down Expand Up @@ -309,7 +310,6 @@ def make_sim(
Returns:
simulation: Generated simulation instance.
"""
from .core import Simulation

import numpy as np
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -519,7 +519,7 @@ def build_sim_from_tech(tech, layout, in_port=0, **kwargs):
)


def from_gdsfactory(c, tech, in_port=0, **kwargs):
def from_gdsfactory(c, tech: dict, in_port: int = 0, **kwargs):
device_wg = []
ports = []

Expand All @@ -536,7 +536,7 @@ def from_gdsfactory(c, tech, in_port=0, **kwargs):
z_base=tech["device"][idx]["z_base"],
z_span=tech["device"][idx]["z_span"],
material=get_material(tech["device"][idx]),
sidewall_angle=90,
sidewall_angle=tech["device"][idx]["sidewall_angle"],
)
)

Expand Down Expand Up @@ -570,10 +570,10 @@ def min_dim(square):
else:
return "xy"

# expand the bbox region by 2 um (on each side) on the smallest dimension
bbox = dilate_1d(c.bbox.tolist(), extension=1, dim=min_dim(c.bbox.tolist()))

bounds = region(vertices=bbox, z_center=z_center, z_span=z_span)
# expand the bbox region by 1.3 um (on each side) on the smallest dimension
bbox = dilate_1d(c.bbox.tolist(), extension=0, dim=min_dim(c.bbox.tolist()))
bbox_dilated = dilate(bbox)
bounds = region(vertices=bbox_dilated, z_center=z_center, z_span=z_span)

# make the superstrate and substrate based on device bounds
# this information isn't typically captured in a 2D layer stack
Expand Down

0 comments on commit db49e8b

Please sign in to comment.