-
Notifications
You must be signed in to change notification settings - Fork 35
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
tcad scripts #382
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
8b6a43a
pwd
simbilod 53fcf2a
sentaurus mask from gdsfactory component
simbilod 1a0bf36
sprocess file from ccomponent and process
simbilod ea0c6d1
fix mask gen syntax
simbilod 6d24a63
fix sprocess syntax
simbilod 3d5b32d
fix script
simbilod 23d6bf1
fix 2D coords
simbilod a2fd984
save splits
simbilod 46c6504
fix file example
simbilod 90e22f2
define output file sprocess
simbilod f4b39f3
update sprocess
simbilod 6d50f3c
update gitignore
simbilod 1cffa02
draft sdevice
simbilod 548a551
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod 4207e20
parse component by layermap
simbilod 7dc7051
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod e6e6b71
hardcode contacts, trim component, fix meshing
simbilod 622a300
planarize, fix paths, better example
simbilod 0fb1aa0
improve gitignore
simbilod 415903c
sdevice template
simbilod f2eed70
fix polygons syntax
simbilod bd3d652
parallelization flag, more layers
simbilod 347a973
Merge branch 'gdsfactory:main' into sentaurus
simbilod 8bf8734
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod 35d5ebd
round mask coordinates
simbilod 0bd75d3
manually define contacts for now, clean up
simbilod 22b456b
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod 34ed69f
pltfile from pytaurus
simbilod 6ea59dd
plot notebook example
simbilod b0e0209
parse svisual
simbilod a7a3515
utility functions
simbilod 5ee1c75
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod f07e233
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod c4e45e6
fix mesh path
simbilod e8311f5
tdr to csv svisual
simbilod 20a2fdd
don't assume python version
simbilod 6b4b91a
move svisual+utilities to its own file, fix sprocess docs
simbilod c872050
Merge branch 'gdsfactory:main' into sentaurus
simbilod 87f5b07
fi regex pytaurus
simbilod f0881c0
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod d8b3bc4
place tdr output in output directory
simbilod ed286d9
round planarize coord
simbilod facc2b9
Merge branch 'main' of github.com:simbilod/gplugins into sentaurus
simbilod 520f703
split step litho
simbilod 28056ab
implant rotation
simbilod 9948877
refactor initialization
simbilod 84f1d92
merging
simbilod 86dd678
merge
simbilod 2944c80
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod a675594
Merge branch 'main' of github.com:gdsfactory/gplugins into sentaurus
simbilod 6da4d88
example ssac device
simbilod a11df19
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod 8e66938
udate tcad
simbilod 2e6e336
merge
simbilod a598684
Merge branch 'sentaurus' of github.com:simbilod/gplugins into sentaurus
simbilod 4b5d26e
Merge branch 'main' of https://github.com/gdsfactory/gplugins into se…
simbilod 2ca8602
fix sprocess and sdevice script paths
simbilod 470ce8b
fix sdevice
simbilod c7c9001
better default adaptivitiy sprocess
simbilod 89ac779
arbitrary step has newline
simbilod 001eb07
fix capacitance
simbilod e444413
adjust scripts
simbilod e569bda
update svisual
simbilod a87dbc1
Merge branch 'main' of https://github.com/gdsfactory/gplugins into se…
simbilod b09532c
add contacts sprocess
simbilod 6537de9
skip steps without masks
simbilod 3149eed
fix polygons after mask prerp
simbilod c95ff36
ignor empty polygons
simbilod fbc1b7f
allow u_offset directly when getting polygon bounds, option for sprocess
simbilod a96cf43
allow u_offset directly when getting polygon bounds, option for sprocess
simbilod 4d893cd
missing newline
simbilod fbb094b
fix offset
simbilod 5dec07f
fix u offset
simbilod ec986b4
bounds
simbilod dc7e96e
parametrize x-cut in svisual
simbilod 3b89674
combining
simbilod a9586ed
split masks
simbilod 7376af3
sde
simbilod f9fd219
refinement
simbilod fc92838
refinement
simbilod 2755709
contacts
simbilod 77c6184
remesh after cut
simbilod 572826c
slice str support
simbilod 801987f
Merge branch 'gdsfactory:main' into sentaurus
simbilod 1d10227
delete plotting files
simbilod fc5e3b5
spelling
simbilod 6181775
spelling, ignore svisual file
simbilod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,5 +56,6 @@ repos: | |
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
args: ["--skip=*svisual.py"] | ||
additional_dependencies: | ||
- tomli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
) | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.