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

tidy3d rework #138

Merged
merged 35 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b21fb0f
Remove old code except for mode and grating coupler scripts for now
yaugenst Sep 18, 2023
66eb463
Remove everything and make a clean break, add functionality later
yaugenst Sep 18, 2023
6f040dc
Merge branch 'main' into tidy3d_rework
yaugenst Sep 18, 2023
f631216
Fix module name
yaugenst Sep 18, 2023
ff42fae
Fix import
yaugenst Sep 18, 2023
573b0e3
Adjust default wafer layer
yaugenst Sep 18, 2023
b00baf1
Merge branch 'gdsfactory:main' into tidy3d_rework
yaugenst Sep 18, 2023
d55aea4
Merge main into tidy3d_rework
yaugenst Sep 19, 2023
50a4609
Merge branch 'main' into tidy3d_rework
yaugenst Sep 20, 2023
03c04ed
Merge branch 'main' into tidy3d_rework
yaugenst Sep 20, 2023
3e4d493
Merge branch 'main' into tidy3d_rework
yaugenst Oct 10, 2023
f58f1e8
Use component from base_model instead of tidy3d/base
yaugenst Oct 10, 2023
6089aee
Fix instances where layer_stack was used instead of layerstack
yaugenst Oct 10, 2023
ea3159c
Merge branch 'fix_layerstack_names' into tidy3d_rework
yaugenst Oct 10, 2023
22a6667
Revert "Merge branch 'fix_layerstack_names' into tidy3d_rework"
yaugenst Oct 11, 2023
127ef41
Merge branch 'main' into tidy3d_rework
yaugenst Oct 13, 2023
8454cf1
Remove common types from tidy3d module
yaugenst Oct 13, 2023
f06d2bc
Fix port placement
yaugenst Oct 13, 2023
ff1d48c
Fix retrieval of port centers
yaugenst Oct 13, 2023
beea040
Allow z_padding to be negative
yaugenst Oct 13, 2023
0d536f3
Merge branch 'main' into tidy3d_rework
yaugenst Oct 16, 2023
a2027f9
Merge port fixes
yaugenst Oct 16, 2023
8fc80ac
Merge branch 'main' into tidy3d_rework
yaugenst Nov 1, 2023
c441b47
Merge branch 'main' into tidy3d_rework
yaugenst Nov 16, 2023
d0e5144
Add simulation and componentmodeler
yaugenst Nov 16, 2023
5c60b8a
Merge branch 'main' into tidy3d_rework
yaugenst Nov 16, 2023
401bcf5
Add docstrings
yaugenst Nov 16, 2023
69bd9f2
Handle 2d simulations
yaugenst Nov 16, 2023
f9d8fe5
Avoid duplicate structure names
yaugenst Nov 16, 2023
a1fc7ec
Add function to retrieve mode data from component modeler
yaugenst Nov 16, 2023
d2f64c5
Update modesolver function and docstrings
yaugenst Nov 16, 2023
70485d9
Add meshio dependency
yaugenst Nov 16, 2023
04379e8
Also needs meshwell
yaugenst Nov 16, 2023
01ea1f1
Disable tests for tidy3d for now
yaugenst Nov 16, 2023
8b2dac0
Update default padding values
yaugenst Nov 18, 2023
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
19 changes: 11 additions & 8 deletions gplugins/common/base_models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,19 @@ def port_centers(self) -> tuple[tuple[float, float, float], ...]:
return tuple(self.get_port_center(p) for p in self.ports)

def get_port_center(self, port: gf.Port) -> tuple[float, float, float]:
layer_czs = np.array(tuple(self.layer_centers.values()))
layers = self.get_layer_names_from_index(port.layer)
return (
*port.center,
np.mean(
[
layer_czs[idx, 2]
for idx, layer in enumerate(self.geometry_layers.values())
if layer.layer == port.layer
]
),
np.mean([self.get_layer_center(layer)[2] for layer in layers]),
)

def get_layer_names_from_index(
self, layer_index: tuple[int, int]
) -> tuple[str, ...]:
return tuple(
k
for k, v in self.layer_stack.layers.items()
if tuple(v.layer) == layer_index
)

def get_layer_bbox(
Expand Down
61 changes: 0 additions & 61 deletions gplugins/tidy3d/__init__.py
Original file line number Diff line number Diff line change
@@ -1,61 +0,0 @@
"""gdsfactory tidy3d plugin.

[tidy3D is a fast GPU based commercial FDTD
solver](https://simulation.cloud/)

"""

from __future__ import annotations

try:
import tidy3d as td
except ModuleNotFoundError as e:
print("You need to 'pip install tidy3d'")
raise e

from gdsfactory.config import logger

from gplugins.tidy3d import materials, modes, utils
from gplugins.tidy3d.get_results import get_results
from gplugins.tidy3d.get_simulation import (
get_simulation,
plot_simulation,
plot_simulation_xz,
plot_simulation_yz,
)
from gplugins.tidy3d.get_simulation_grating_coupler import (
get_simulation_grating_coupler,
)
from gplugins.tidy3d.write_sparameters import (
write_sparameters,
write_sparameters_1x1,
write_sparameters_batch,
write_sparameters_batch_1x1,
write_sparameters_crossing,
)
from gplugins.tidy3d.write_sparameters_grating_coupler import (
write_sparameters_grating_coupler,
write_sparameters_grating_coupler_batch,
)

__version__ = "0.0.3"
__all__ = [
"plot_simulation",
"plot_simulation_xz",
"plot_simulation_yz",
"get_simulation",
"get_simulation_grating_coupler",
"get_results",
"materials",
"modes",
"utils",
"write_sparameters",
"write_sparameters_crossing",
"write_sparameters_1x1",
"write_sparameters_batch",
"write_sparameters_batch_1x1",
"write_sparameters_grating_coupler",
"write_sparameters_grating_coupler_batch",
]

logger.info(f"Tidy3d {td.__version__!r} installed at {td.__path__!r}")
Loading
Loading