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

tcad scripts #382

Merged
merged 87 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
8b6a43a
pwd
simbilod Aug 3, 2023
53fcf2a
sentaurus mask from gdsfactory component
simbilod Aug 3, 2023
1a0bf36
sprocess file from ccomponent and process
simbilod Aug 3, 2023
ea0c6d1
fix mask gen syntax
simbilod Aug 4, 2023
6d24a63
fix sprocess syntax
simbilod Aug 4, 2023
3d5b32d
fix script
simbilod Aug 4, 2023
23d6bf1
fix 2D coords
simbilod Aug 4, 2023
a2fd984
save splits
simbilod Aug 4, 2023
46c6504
fix file example
simbilod Aug 4, 2023
90e22f2
define output file sprocess
simbilod Aug 6, 2023
f4b39f3
update sprocess
simbilod Aug 7, 2023
6d50f3c
update gitignore
simbilod Aug 7, 2023
1cffa02
draft sdevice
simbilod Aug 7, 2023
548a551
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 7, 2023
4207e20
parse component by layermap
simbilod Aug 7, 2023
7dc7051
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 7, 2023
e6e6b71
hardcode contacts, trim component, fix meshing
simbilod Aug 7, 2023
622a300
planarize, fix paths, better example
simbilod Aug 8, 2023
0fb1aa0
improve gitignore
simbilod Aug 8, 2023
415903c
sdevice template
simbilod Aug 8, 2023
f2eed70
fix polygons syntax
simbilod Aug 9, 2023
bd3d652
parallelization flag, more layers
simbilod Aug 9, 2023
347a973
Merge branch 'gdsfactory:main' into sentaurus
simbilod Aug 10, 2023
8bf8734
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 13, 2023
35d5ebd
round mask coordinates
simbilod Aug 13, 2023
0bd75d3
manually define contacts for now, clean up
simbilod Aug 13, 2023
22b456b
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 13, 2023
34ed69f
pltfile from pytaurus
simbilod Aug 13, 2023
6ea59dd
plot notebook example
simbilod Aug 13, 2023
b0e0209
parse svisual
simbilod Aug 13, 2023
a7a3515
utility functions
simbilod Aug 13, 2023
5ee1c75
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 13, 2023
f07e233
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 13, 2023
c4e45e6
fix mesh path
simbilod Aug 13, 2023
e8311f5
tdr to csv svisual
simbilod Aug 14, 2023
20a2fdd
don't assume python version
simbilod Aug 14, 2023
6b4b91a
move svisual+utilities to its own file, fix sprocess docs
simbilod Aug 14, 2023
c872050
Merge branch 'gdsfactory:main' into sentaurus
simbilod Aug 16, 2023
87f5b07
fi regex pytaurus
simbilod Aug 16, 2023
f0881c0
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 16, 2023
d8b3bc4
place tdr output in output directory
simbilod Aug 17, 2023
ed286d9
round planarize coord
simbilod Aug 17, 2023
facc2b9
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod Aug 25, 2023
520f703
split step litho
simbilod Aug 25, 2023
28056ab
implant rotation
simbilod Aug 25, 2023
9948877
refactor initialization
simbilod Aug 25, 2023
84f1d92
merging
simbilod Sep 21, 2023
86dd678
merge
simbilod Oct 4, 2023
2944c80
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Oct 4, 2023
a675594
Merge branch 'main' of github.com:gdsfactory/gplugins into sentaurus
simbilod Oct 6, 2023
6da4d88
example ssac device
simbilod Oct 6, 2023
a11df19
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Oct 6, 2023
8e66938
udate tcad
simbilod Oct 11, 2023
2e6e336
merge
simbilod Oct 16, 2023
a598684
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod Oct 16, 2023
4b5d26e
Merge branch 'main' of https://github.com/gdsfactory/gplugins into se…
simbilod Oct 18, 2023
2ca8602
fix sprocess and sdevice script paths
simbilod Oct 18, 2023
470ce8b
fix sdevice
simbilod Oct 18, 2023
c7c9001
better default adaptivitiy sprocess
simbilod Oct 18, 2023
89ac779
arbitrary step has newline
simbilod Oct 19, 2023
001eb07
fix capacitance
simbilod Oct 19, 2023
e444413
adjust scripts
simbilod Oct 20, 2023
e569bda
update svisual
simbilod Oct 20, 2023
a87dbc1
Merge branch 'main' of https://github.com/gdsfactory/gplugins into se…
simbilod Oct 20, 2023
b09532c
add contacts sprocess
simbilod Oct 26, 2023
6537de9
skip steps without masks
simbilod Oct 26, 2023
3149eed
fix polygons after mask prerp
simbilod Oct 31, 2023
c95ff36
ignor empty polygons
simbilod Nov 1, 2023
fbc1b7f
allow u_offset directly when getting polygon bounds, option for sprocess
simbilod Nov 1, 2023
a96cf43
allow u_offset directly when getting polygon bounds, option for sprocess
simbilod Nov 1, 2023
4d893cd
missing newline
simbilod Nov 2, 2023
fbb094b
fix offset
simbilod Nov 9, 2023
5dec07f
fix u offset
simbilod Nov 9, 2023
ec986b4
bounds
simbilod Nov 9, 2023
dc7e96e
parametrize x-cut in svisual
simbilod Nov 14, 2023
3b89674
combining
simbilod Mar 7, 2024
a9586ed
split masks
simbilod Mar 7, 2024
7376af3
sde
simbilod Mar 7, 2024
f9fd219
refinement
simbilod Mar 7, 2024
fc92838
refinement
simbilod Mar 8, 2024
2755709
contacts
simbilod Mar 8, 2024
77c6184
remesh after cut
simbilod Mar 9, 2024
572826c
slice str support
simbilod Mar 20, 2024
801987f
Merge branch 'gdsfactory:main' into sentaurus
simbilod Apr 17, 2024
1d10227
delete plotting files
simbilod Apr 17, 2024
fc5e3b5
spelling
simbilod Apr 17, 2024
6181775
spelling, ignore svisual file
simbilod Apr 17, 2024
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,12 @@ cython_debug/
*.DS_Store
.DS_Store
*Thumbs.db

# Possible generated files
*.cmd
*.tcl
*.tdr
*.log
*.BAK
*.sav
*.plt
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ repos:
rev: v2.2.6
hooks:
- id: codespell
args: ["--skip=*svisual.py"]
additional_dependencies:
- tomli
19 changes: 19 additions & 0 deletions gplugins/gmsh/parse_gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ def cleanup_component(component, layer_stack, round_tol=2, simplify_tol=1e-2):
}


def cleanup_component_layermap(component, layermap, round_tol=2, simplify_tol=1e-2):
"""Process component polygons before processing.

Uses layermap (design layers) names.
"""
layer_dict = vars(layermap)

return {
layer: fuse_polygons(
component,
layername,
layer,
round_tol=round_tol,
simplify_tol=simplify_tol,
)
for layername, layer in layer_dict.items()
}
Comment on lines +64 to +80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Consider renaming cleanup_component_layermap to reflect its specific functionality.

The function name could be more descriptive regarding its operation on layer maps specifically, which might help in distinguishing it from other cleanup functions.



def to_polygons(geometries):
for geometry in geometries:
if isinstance(geometry, Polygon):
Expand Down
9 changes: 8 additions & 1 deletion gplugins/gmsh/uz_xsection_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
def get_u_bounds_polygons(
polygons: MultiPolygon | list[Polygon],
xsection_bounds: tuple[tuple[float, float], tuple[float, float]],
u_offset: float = 0.0,
):
"""Performs the bound extraction given a (Multi)Polygon or [Polygon] and cross-sectional line coordinates.

Args:
layer_polygons_dict: dict containing layernames: shapely polygons pairs
xsection_bounds: ( (x1,y1), (x2,y2) ), with x1,y1 beginning point of cross-sectional line and x2,y2 the end.
u_offset: amount to offset the returned polygons in the lateral dimension

Returns: list of bounding box coordinates (u1,u2)) in xsection line coordinates (distance from xsection_bounds[0]).
"""
Expand All @@ -51,7 +53,12 @@ def get_u_bounds_polygons(
bounds = entry.bounds
p1 = Point([bounds[0], bounds[1]])
p2 = Point([bounds[2], bounds[3]])
return_list.append([linestart.distance(p1), linestart.distance(p2)])
return_list.append(
[
linestart.distance(p1) + u_offset,
linestart.distance(p2) + u_offset,
]
)
return return_list


Expand Down
119 changes: 119 additions & 0 deletions gplugins/sentaurus/mask_sde.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import operator
from functools import reduce

import shapely
from gdsfactory.typings import Layer, LayerSpecs, List


def get_mask_polygons(
layer_polygons_dict,
layer,
layers_or,
layers_and,
layers_diff,
layers_xor,
buffer_tol=1e-3,
):
"""(3D simulations) Returns mask polygons for the combination of layers."""
layer_polygons = layer_polygons_dict[layer]

for or_layer in layers_or:
layer_polygons = layer_polygons | layer_polygons_dict[or_layer]
for and_layer in layers_and:
layer_polygons = layer_polygons & layer_polygons_dict[and_layer]
for diff_layer in layers_diff:
layer_polygons = layer_polygons - layer_polygons_dict[diff_layer]
for xor_layer in layers_xor:
layer_polygons = layer_polygons ^ layer_polygons_dict[xor_layer]

return layer_polygons.buffer(-buffer_tol, join_style=2).buffer(
buffer_tol, join_style=2
)


def add_mask_polygons(layer_polygons):
"""Returns polygons strings for 3D masks."""
return_str_lines = []
for _i, polygon in enumerate(
layer_polygons.geoms if hasattr(layer_polygons, "geoms") else [layer_polygons]
):
if not polygon.is_empty:
coordinates_x = [x for x, y in polygon.exterior.coords][:-1]
coordinates_y = [y for x, y in polygon.exterior.coords][:-1]
coordinates = reduce(operator.add, zip(coordinates_x, coordinates_y))
segments = ""
for coordinate in coordinates:
segments += f"{coordinate:1.3f} "
line = f"(list {segments})"
return_str_lines.append(line)
return return_str_lines


def get_sentaurus_mask_3D(
layer_polygons_dict,
name: str,
layer: Layer = None,
layers_or: LayerSpecs = None,
layers_and: LayerSpecs = None,
layers_diff: LayerSpecs = None,
layers_xor: LayerSpecs = None,
) -> List[str]:
"""Returns the 3D Sentaurus mask script line for the given layer + extra layers.

Arguments:
layer_polygons_dict: dict of layernames --> shapely (multi)polygons
name: name of the mask
layer: main layer for this mask
layers_or: other layers' polygons to union with layer polygons
layers_diff: other layers' polygons to diff with layer polygons
layers_and: other layers' polygons to intersect with layer polygons
layers_xor: other layers' polygons to exclusive or with layer polygons
"""

return_str = ""

layers_or = layers_or or []
layers_and = layers_and or []
layers_diff = layers_diff or []
layers_xor = layers_xor or []

if layer is None:
return []
else:
layer_polygons = get_mask_polygons(
layer_polygons_dict=layer_polygons_dict,
layer=layer,
layers_or=layers_or,
layers_and=layers_and,
layers_diff=layers_diff,
layers_xor=layers_xor,
)

# Add mask step
return_str += f'(sdepe:generate-mask "{name}" (list\n'
polygon_strings = add_mask_polygons(layer_polygons)
for i, polygon_string in enumerate(polygon_strings):
return_str += polygon_string
if i < len(polygon_strings):
return_str += "\n"
return_str += "))\n"

if layer_polygons:
exists = True
else:
exists = False

return return_str, exists


if __name__ == "__main__":
test_polygon = shapely.Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])

test_layer_polygons_dict = {}
test_layer_polygons_dict[(10, 0)] = test_polygon

print(
get_sentaurus_mask_3D(
test_layer_polygons_dict, layer=(10, 0), name="test_layer"
)
)
Loading
Loading