API Design¶
Meshing¶
gplugins.meshwell.get_meshwell_prisms(component, layer_stack, wafer_layer=LAYER.WAFER, wafer_padding=0.0, name_by='layer')
¶
Convert LayerStack + Component to meshwell PolyPrism objects.
Source code in gplugins/meshwell/get_meshwell_3D.py
Mode Solvers¶
Mode solver tidy3d¶
gplugins.tidy3d.modes.Waveguide
¶
Bases: BaseModel
Waveguide Model.
All dimensions must be specified in μm (1e-6 m).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength
|
wavelength in free space. |
required | |
core_width
|
waveguide core width. |
required | |
core_thickness
|
waveguide core thickness (height). |
required | |
core_material
|
core material. One of: - string: material name. - float: refractive index. - float, float: refractive index real and imaginary part. - td.Medium: tidy3d medium. - function: function of wavelength. |
required | |
clad_material
|
top cladding material. |
required | |
box_material
|
bottom cladding material. |
required | |
slab_thickness
|
thickness of the slab region in a rib waveguide. |
required | |
clad_thickness
|
thickness of the top cladding. |
required | |
box_thickness
|
thickness of the bottom cladding. |
required | |
side_margin
|
domain extension to the side of the waveguide core. |
required | |
sidewall_angle
|
angle of the core sidewall w.r.t. the substrate normal. |
required | |
sidewall_thickness
|
thickness of a layer on the sides of the waveguide core to model side-surface losses. |
required | |
sidewall_k
|
absorption coefficient added to the core material index on the side-surface layer. |
required | |
surface_thickness
|
thickness of a layer on the top of the waveguide core and slabs to model top-surface losses. |
required | |
surface_k
|
absorption coefficient added to the core material index on the top-surface layer. |
required | |
bend_radius
|
radius to simulate circular bend. |
required | |
target_neff
|
target effective index for the mode solver. Defaults to the real part of the core refractive index if not specified. |
required | |
num_modes
|
number of modes to compute. |
required | |
group_index_step
|
if set to |
required | |
precision
|
computation precision. |
required | |
grid_resolution
|
wavelength resolution of the computation grid. |
required | |
max_grid_scaling
|
grid scaling factor in cladding regions. |
required | |
cache_path
|
Optional path to the cache directory. None disables cache. |
required | |
overwrite
|
overwrite cache. |
required |
::
________________________________________________
^
¦
¦
clad_thickness
|<--core_width-->| ¦
¦
.________________. _v_
| ^ |
<-side_margin->| ¦ |
| ¦ |
_______________' ¦ '_______________
^ core_thickness
¦ ¦
slab_thickness ¦
¦ ¦
v v
________________________________________________
^
¦
box_thickness
¦
v
________________________________________________
Source code in gplugins/tidy3d/modes.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
filepath
property
¶
Cache file path.
waveguide
property
¶
Tidy3D waveguide used by this instance.
fraction_te
property
¶
Fraction of TE polarization.
fraction_tm
property
¶
Fraction of TM polarization.
n_eff
property
¶
Effective propagation index.
n_group
property
¶
Group index.
This is only present it the parameter group_index_step is set.
mode_area
property
¶
Effective mode area.
loss_dB_per_cm
property
¶
Propagation loss for computed modes in dB/cm.
index
property
¶
Refractive index distribution on the simulation domain.
overlap(waveguide, conjugate=True)
¶
Calculate the mode overlap between waveguide modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveguide
|
Waveguide
|
waveguide with which to overlap modes. |
required |
conjugate
|
bool
|
use the conjugate form of the overlap integral. |
True
|
Source code in gplugins/tidy3d/modes.py
plot_grid()
¶
plot_index(**kwargs)
¶
Plot the waveguide index distribution.
Keyword arguments are passed to xarray.DataArray.plot.
plot_field(field_name, value='real', mode_index=0, wavelength=None, **kwargs)
¶
Plot the selected field distribution from a waveguide mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field_name
|
str
|
one of 'Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz'. |
required |
value
|
str
|
component of the field to plot. One of 'real', 'imag', 'abs', 'phase', 'dB'. |
'real'
|
mode_index
|
int
|
mode selection. |
0
|
wavelength
|
float | None
|
wavelength selection. |
None
|
kwargs
|
keyword arguments passed to xarray.DataArray.plot. |
{}
|
Source code in gplugins/tidy3d/modes.py
__repr__()
¶
Show waveguide representation.
gplugins.tidy3d.modes.WaveguideCoupler
¶
Bases: Waveguide
Waveguide coupler Model.
All dimensions must be specified in μm (1e-6 m).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength
|
wavelength in free space. |
required | |
core_width
|
with of each core. |
required | |
gap
|
inter-core separation. |
required | |
core_thickness
|
waveguide core thickness (height). |
required | |
core_material
|
core material. One of: - string: material name. - float: refractive index. - float, float: refractive index real and imaginary part. - function: function of wavelength. |
required | |
clad_material
|
top cladding material. |
required | |
box_material
|
bottom cladding material. |
required | |
slab_thickness
|
thickness of the slab region in a rib waveguide. |
required | |
clad_thickness
|
thickness of the top cladding. |
required | |
box_thickness
|
thickness of the bottom cladding. |
required | |
side_margin
|
domain extension to the side of the waveguide core. |
required | |
sidewall_angle
|
angle of the core sidewall w.r.t. the substrate normal. |
required | |
sidewall_thickness
|
thickness of a layer on the sides of the waveguide core to model side-surface losses. |
required | |
sidewall_k
|
absorption coefficient added to the core material index on the side-surface layer. |
required | |
surface_thickness
|
thickness of a layer on the top of the waveguide core and slabs to model top-surface losses. |
required | |
surface_k
|
absorption coefficient added to the core material index on the top-surface layer. |
required | |
bend_radius
|
radius to simulate circular bend. |
required | |
num_modes
|
number of modes to compute. |
required | |
group_index_step
|
if set to |
required | |
target_neff
|
target effective index for the mode solver. Defaults to the real part of the core refractive index if not specified. |
required | |
precision
|
computation precision. |
required | |
grid_resolution
|
wavelength resolution of the computation grid. |
required | |
max_grid_scaling
|
grid scaling factor in cladding regions. |
required | |
cache
|
controls the use of cached results. |
required |
::
_____________________________________________________________
._________________. ._________________.
| | | |
|<-core_width[0]->| |<-core_width[1]->|
| |<-gap->| |
________' '_______' '________
_____________________________________________________________
_____________________________________________________________
Source code in gplugins/tidy3d/modes.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | |
waveguide
property
¶
Tidy3D waveguide used by this instance.
coupling_length(power_ratio=1.0)
¶
Coupling length calculated from the effective mode indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
power_ratio
|
float
|
desired coupling power ratio. |
1.0
|
Source code in gplugins/tidy3d/modes.py
gplugins.tidy3d.modes.sweep_n_eff(waveguide, **sweep_kwargs)
¶
Return the effective index for a range of waveguide geometries.
The returned array uses the sweep arguments and the mode index as coordinates to organize the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveguide
|
Waveguide
|
base waveguide geometry. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
sweep_kwargs |
Waveguide arguments and values to sweep. |
|
wavelength |
wavelength in free space. |
|
core_width |
waveguide core width. |
|
core_thickness |
waveguide core thickness (height). |
|
core_material |
core material. One of: - string: material name. - float: refractive index. - float, float: refractive index real and imaginary part. - function: function of wavelength. |
|
clad_material |
top cladding material. |
|
box_material |
bottom cladding material. |
|
slab_thickness |
thickness of the slab region in a rib waveguide. |
|
clad_thickness |
thickness of the top cladding. |
|
box_thickness |
thickness of the bottom cladding. |
|
side_margin |
domain extension to the side of the waveguide core. |
|
sidewall_angle |
angle of the core sidewall w.r.t. the substrate normal. |
|
sidewall_thickness |
thickness of a layer on the sides of the waveguide core to model side-surface losses. |
|
sidewall_k |
absorption coefficient added to the core material index on the side-surface layer. |
|
surface_thickness |
thickness of a layer on the top of the waveguide core and slabs to model top-surface losses. |
|
surface_k |
absorption coefficient added to the core material index on the top-surface layer. |
|
bend_radius |
radius to simulate circular bend. |
|
num_modes |
number of modes to compute. |
|
group_index_step |
if set to |
|
precision |
computation precision. |
|
grid_resolution |
wavelength resolution of the computation grid. |
|
max_grid_scaling |
grid scaling factor in cladding regions. |
Example
sweep_n_eff( ... my_waveguide, ... core_width=[0.40, 0.45, 0.50], ... core_thickness=[0.22, 0.25], ... )
Source code in gplugins/tidy3d/modes.py
gplugins.tidy3d.modes.sweep_n_group(waveguide, **sweep_kwargs)
¶
Return the group index for a range of waveguide geometries.
The returned array uses the sweep arguments and the mode index as coordinates to organize the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveguide
|
Waveguide
|
base waveguide geometry. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
sweep_kwargs |
Waveguide arguments and values to sweep. |
|
wavelength |
wavelength in free space. |
|
core_width |
waveguide core width. |
|
core_thickness |
waveguide core thickness (height). |
|
core_material |
core material. One of: - string: material name. - float: refractive index. - float, float: refractive index real and imaginary part. - function: function of wavelength. |
|
clad_material |
top cladding material. |
|
box_material |
bottom cladding material. |
|
slab_thickness |
thickness of the slab region in a rib waveguide. |
|
clad_thickness |
thickness of the top cladding. |
|
box_thickness |
thickness of the bottom cladding. |
|
side_margin |
domain extension to the side of the waveguide core. |
|
sidewall_angle |
angle of the core sidewall w.r.t. the substrate normal. |
|
sidewall_thickness |
thickness of a layer on the sides of the waveguide core to model side-surface losses. |
|
sidewall_k |
absorption coefficient added to the core material index on the side-surface layer. |
|
surface_thickness |
thickness of a layer on the top of the waveguide core and slabs to model top-surface losses. |
|
surface_k |
absorption coefficient added to the core material index on the top-surface layer. |
|
bend_radius |
radius to simulate circular bend. |
|
num_modes |
number of modes to compute. |
|
group_index_step |
if set to |
|
precision |
computation precision. |
|
grid_resolution |
wavelength resolution of the computation grid. |
|
max_grid_scaling |
grid scaling factor in cladding regions. |
Example
sweep_n_group( ... my_waveguide, ... core_width=[0.40, 0.45, 0.50], ... core_thickness=[0.22, 0.25], ... )
Source code in gplugins/tidy3d/modes.py
gplugins.tidy3d.modes.sweep_bend_mismatch(waveguide, bend_radii, track_modes=False, modes_to_track=(0,))
¶
Overlap integral squared for the bend mode mismatch loss.
The loss is squared because you hit the bend loss twice (from bend to straight and from straight to bend).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveguide
|
Waveguide
|
base waveguide geometry. |
required |
bend_radii
|
tuple[float, ...]
|
radii values to sweep. |
required |
track_modes
|
bool
|
if True, for each radius select the bend mode with the best overlap for each tracked straight mode. |
False
|
modes_to_track
|
Sequence[int]
|
straight mode indices to track. Required when track_modes is True. |
(0,)
|
Source code in gplugins/tidy3d/modes.py
gplugins.tidy3d.modes.sweep_coupling_length(coupler, gaps, power_ratio=1.0)
¶
Calculate coupling length for a series of gap sizes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coupler
|
WaveguideCoupler
|
base waveguide coupler geometry. |
required |
gaps
|
tuple[float, ...]
|
gap values to use for coupling length calculation. |
required |
power_ratio
|
float
|
desired coupling power ratio. |
1.0
|
Source code in gplugins/tidy3d/modes.py
Mode solver Femwell¶
gplugins.femwell.mode_solver.compute_cross_section_modes(cross_section, layer_stack, wavelength=1.55, num_modes=4, order=1, radius=np.inf, wafer_padding=2.0, **kwargs)
¶
Calculate effective index of a cross-section.
Defines a "straight" component of the cross_section, and calls compute_component_slice_modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cross_section
|
CrossSectionSpec
|
gdsfactory cross_section. |
required |
layer_stack
|
LayerStack
|
gdsfactory layer_stack. |
required |
wavelength
|
float
|
in um. |
1.55
|
num_modes
|
int
|
to compute. |
4
|
order
|
int
|
order of the mesh elements. 1: linear, 2: quadratic. |
1
|
radius
|
float
|
defaults to inf. |
inf
|
wafer_padding
|
float
|
in um. |
2.0
|
kwargs
|
Any
|
kwargs for compute_component_slice_modes |
{}
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
solver |
can be slepc or scipy. |
|
resolution_specs |
Dict
|
meshwell resolution specifications. Format: {"layername": [ConstantInField(resolution=float, apply_to="surfaces")]} |
default_characteristic_length |
float
|
default gmsh characteristic length. |
background_tag |
str
|
name of the background layer to add (default: no background added). |
background_remeshing_file |
Path
|
optional background mesh file for refinement. |
global_scaling |
float
|
global scaling factor. |
verbosity |
int
|
GMSH verbosity level. |
Source code in gplugins/femwell/mode_solver.py
Mode solver EMode¶
gplugins.emode.EMode
¶
Bases: EMode
EMode session with gdsfactory geometry helpers.
Creating an instance launches the EMode application and connects to it,
so it requires a local EMode installation and license (the
emodeconnection client alone is not enough). Any EMode function can
be called as a method, e.g. FDM(), EME(), report(),
plot(); see https://docs.emodephotonix.com for the full API.
Source code in gplugins/emode/emode.py
build_waveguide(cross_section, layer_stack, **settings)
¶
Build a waveguide in this EMode session from gdsfactory geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cross_section
|
CrossSectionSpec
|
gdsfactory cross-section (or spec) defining mask widths and offsets. |
required |
layer_stack
|
LayerStack
|
gdsfactory LayerStack defining layer materials, thicknesses, and vertical placement. |
required |
settings
|
Any
|
forwarded to EMode's |
{}
|
Source code in gplugins/emode/emode.py
gplugins.emode.get_emode_settings(**settings)
¶
Convert gdsfactory-style settings to EMode units.
gdsfactory uses microns for all dimensions while EMode defaults to
nanometers. Settings named in DIMENSIONAL_SETTINGS are converted from
um to nm; all other settings pass through unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Any
|
keyword arguments for EMode's |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The same settings with dimensional values converted to nm. |
Source code in gplugins/emode/emode.py
gplugins.emode.get_shapes_from_layer_stack(cross_section, layer_stack, materials=())
¶
Translate a gdsfactory layer stack and cross-section into EMode shapes.
Each :class:~gdsfactory.technology.LayerLevel becomes one EMode shape.
A layer whose layer (or derived_layer) matches a section of the
cross-section is patterned: it takes its mask width and offset from that
section and is etched through its full thickness. Layers without a
matching section become blanket layers (no mask or etch, following the
defaults of EMode's shape() function). Vertical positions are
referenced to the bottom of the layer stack, and gdsfactory mesh order
(lower = higher priority) is converted to EMode shape priority (higher =
higher priority).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cross_section
|
CrossSectionSpec
|
gdsfactory cross-section (or spec) defining mask widths and offsets. |
required |
layer_stack
|
LayerStack
|
gdsfactory LayerStack defining layer materials, thicknesses, and vertical placement. |
required |
materials
|
Sequence[str]
|
available EMode material names used to match gdsfactory
material names case-insensitively, typically from
|
()
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
One dict of keyword arguments for EMode's |
list[dict[str, Any]]
|
layer, in layer-stack order, with dimensions in nm. |
Source code in gplugins/emode/emode.py
EME (Eigen Mode Expansion)¶
gplugins.meow.MEOW
¶
Source code in gplugins/meow/meow_eme.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
__init__(component, layer_stack, wavelength=1.55, temperature=25.0, num_modes=4, cell_length=0.5, spacing_x=2.0, center_x=None, resolution_x=100, spacing_y=2.0, center_y=None, resolution_y=100, material_to_color=material_to_color_default, dirpath=PATH.sparameters, filepath=None, overwrite=False)
¶
Computes multimode 2-port S-parameters for a gdsfactory component.
assumes port 1 is at the left boundary and port 2 at the right boundary.
Note coordinate systems
gdsfactory uses x,y in the plane to represent components, with the layer_stack existing in z meow uses x,y to represent a cross-section, with propagation in the z-direction hence we have [x,y,z] <--> [y,z,x] for gdsfactory <--> meow
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
gdsfactory component. |
required |
layer_stack
|
gdsfactory layer_stack. |
required | |
wavelength
|
float
|
wavelength in microns (for FDE, and for material properties). |
1.55
|
temperature
|
float
|
temperature in C (for material properties). Unused now. |
25.0
|
num_modes
|
int
|
number of modes to compute for the eigenmode expansion. |
4
|
cell_length
|
float
|
in un. |
0.5
|
spacing_x
|
float
|
at beginning and end of the simulation region. |
2.0
|
center_x
|
float | None
|
in um. |
None
|
resolution_x
|
int
|
pixels in horizontal region. |
100
|
spacing_y
|
float
|
at the beginning and end of simulation region. |
2.0
|
center_y
|
float | None
|
in um. |
None
|
resolution_y
|
int
|
pixels in vertical direction. |
100
|
material_to_color
|
dict[str, ColorRGB]
|
dict of materials colors for struct plot |
material_to_color_default
|
dirpath
|
PathType | None
|
directory to store Sparameters. |
sparameters
|
filepath
|
PathType | None
|
to store pandas Dataframe with Sparameters in npz format. Defaults to dirpath/component_.npz. |
None
|
overwrite
|
bool
|
overwrites stored Sparameter npz results. |
False
|
Returns:
| Type | Description |
|---|---|
None
|
S-parameters in form o1@0,o2@0 at wavelength. |
::
cross_section view:
________________________________
| |
| |
| spacing_x spacing_x | spacing_y
|<---------> <-------->|
| ___________ _ _ _ |
| | | |
| | |_ _ _ _ _ |_ center_y
| | | |
| |___________| |
| | |
| |
| | | spacing_y
| |
|_______________|________________|
center_x
top side view:
________________________________
| |
| |
|cell_length |
|<--------> |
|_____________________ __________|
| | | |
| | | |
| cell0 | cell1 | cell2 |
|_________|___________|__________|
| |
| |
| |
| |
|________________________________|
Source code in gplugins/meow/meow_eme.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
gf_material_to_meow_material(material_name='si', wavelengths=None, color=None)
¶
Converts a gdsfactory material into a MEOW material.
Source code in gplugins/meow/meow_eme.py
add_global_layers(component, layer_stack, buffer_y=1, global_layer_index=10000, layer_wafer='WAFER')
¶
Adds bbox polygons for global layers.
LAYER.WAFER layers are represented as polygons of size [bbox.x, xspan (meow coords)]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
gdsfactory component. |
required | |
layer_stack
|
gdsfactory LayerStack. |
required | |
buffer_y
|
float
|
float, y-buffer to add to box. |
1
|
xspan
|
from eme setup. |
required | |
global_layer_index
|
int
|
int, layer index at which to starting adding the global layers. Default 10000 with +1 increments to avoid clashing with physical layers. |
10000
|
layer_wafer
|
LayerSpec
|
LayerSpec, layer to represent the wafer. |
'WAFER'
|
Source code in gplugins/meow/meow_eme.py
layer_stack_to_extrusion()
¶
Convert LayerStack to meow extrusions.
Source code in gplugins/meow/meow_eme.py
create_cells()
¶
Get meow cells from extruded component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_length
|
in um. |
required |
Source code in gplugins/meow/meow_eme.py
compute_sparameters()
¶
Returns Sparameters using EME.
Source code in gplugins/meow/meow_eme.py
FDTD Simulation¶
S-parameter utils¶
gplugins.common.utils.plot.plot_sparameters(sp, logscale=True, plot_phase=False, keys=None, with_simpler_input_keys=False, with_simpler_labels=True, units=1000.0)
¶
Plots Sparameters from a dict of np.ndarrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sp
|
dict[str, NDArray[floating[Any]]]
|
Sparameters np.ndarray. |
required |
logscale
|
bool
|
plots 20*log10(S). |
True
|
plot_phase
|
bool
|
plots angle of Sparameters in degrees. |
False
|
keys
|
tuple[str, ...] | None
|
list of keys to plot, plots all by default. |
None
|
with_simpler_input_keys
|
bool
|
You can use S12 keys instead of o1@0,o2@0. |
False
|
with_simpler_labels
|
bool
|
uses S11, S12 in plot labels instead of o1@0,o2@0. |
True
|
units
|
float
|
wavelength units. Default is 1e3 to convert um to nm. |
1000.0
|
Source code in gplugins/common/utils/plot.py
gplugins.common.utils.plot.plot_imbalance2x2 = partial(plot_imbalance, ports=['o1@0,o3@0', 'o1@0,o4@0'])
module-attribute
¶
gplugins.common.utils.plot.plot_loss2x2 = partial(plot_loss, ports=['o1@0,o3@0', 'o1@0,o4@0'])
module-attribute
¶
Common FDTD functions¶
gplugins.common.utils.get_effective_indices.get_effective_indices(core_material, nsubstrate, clad_materialding, thickness, wavelength, polarization)
¶
Returns the effective refractive indices for a 1D mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
core_material
|
float
|
Refractive index of the core material. |
required |
nsubstrate
|
float
|
Refractive index of the substrate. |
required |
clad_materialding
|
float
|
Refractive index of the cladding. |
required |
thickness
|
float
|
Thickness of the film in um. |
required |
wavelength
|
float
|
Wavelength in um. |
required |
polarization
|
Literal['te', 'tm']
|
Either "te" or "tm". |
required |
.. code::
----------------- |
clad_materialding inf
----------------- |
core_material thickness
----------------- |
nsubstrate inf
----------------- |
.. code::
import gplugins as sim
neffs = sim.get_effective_indices(
core_material=3.4777,
clad_materialding=1.444,
nsubstrate=1.444,
thickness=0.22,
wavelength=1.55,
polarization="te",
)
Source code in gplugins/common/utils/get_effective_indices.py
S-parameter conversion¶
gplugins.common.utils.convert_sparameters.pandas_to_float64(df, magnitude_suffix='m', phase_suffix='a')
¶
Converts a pandas CSV sparameters from complex128 format to 2x float64 format.
Adds magnitude_suffix (default m) and phase_suffix (default a) to original keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
pandas DataFrame. |
required |
magnitude_suffix
|
str
|
m for module. |
'm'
|
phase_suffix
|
str
|
a for angle. |
'a'
|
Source code in gplugins/common/utils/convert_sparameters.py
gplugins.common.utils.convert_sparameters.pandas_to_numpy(df, port_map=None)
¶
Converts a pandas CSV sparameters into a numpy array.
Fundamental mode starts at 0.
Source code in gplugins/common/utils/convert_sparameters.py
gplugins.common.utils.convert_sparameters.csv_to_npz(filepath)
¶
Convert CSV files into numpy.
Source code in gplugins/common/utils/convert_sparameters.py
gplugins.common.utils.convert_sparameters.convert_directory_csv_to_npz(dirpath)
¶
Convert CSV files from directory dirpath into numpy.
Source code in gplugins/common/utils/convert_sparameters.py
FDTD tidy3d¶
gplugins.tidy3d.write_sparameters(component, layer_stack=None, material_mapping=material_name_to_medium, extend_ports=0.5, port_offset=0.2, pad_xy_inner=2.0, pad_xy_outer=2.0, pad_z_inner=0.0, pad_z_outer=0.0, dilation=0.0, wavelength=1.55, bandwidth=0.2, num_freqs=21, min_steps_per_wvl=30, center_z=None, sim_size_z=4.0, port_size_mult=(4.0, 3.0), run_only=None, element_mappings=(), extra_monitors=None, mode_spec=td.ModeSpec(num_modes=1), boundary_spec=td.BoundarySpec.all_sides(boundary=(td.PML())), symmetry=(0, 0, 0), run_time=1e-12, shutoff=1e-05, folder_name='default', dirpath=dirpath_default, verbose=True, plot_simulation_layer_name=None, plot_simulation_port_index=0, plot_simulation_z=None, plot_simulation_x=None, plot_mode_index=0, plot_mode_port_name=None, plot_epsilon=False, filepath=None, overwrite=False, **kwargs)
¶
Writes the S-parameters for a component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
gdsfactory component to write the S-parameters for. |
required |
layer_stack
|
LayerStack | None
|
The layer stack for the component. If None, uses active pdk layer_stack. |
None
|
material_mapping
|
dict[str, Tidy3DMedium]
|
A mapping of material names to Tidy3DMedium instances. Defaults to material_name_to_medium. |
material_name_to_medium
|
extend_ports
|
NonNegativeFloat
|
The extension length for ports. |
0.5
|
port_offset
|
float
|
The offset for ports. Defaults to 0.2. |
0.2
|
pad_xy_inner
|
NonNegativeFloat
|
The inner padding in the xy-plane. Defaults to 2.0. |
2.0
|
pad_xy_outer
|
NonNegativeFloat
|
The outer padding in the xy-plane. Defaults to 2.0. |
2.0
|
pad_z_inner
|
float
|
The inner padding in the z-direction. Defaults to 0.0. |
0.0
|
pad_z_outer
|
NonNegativeFloat
|
The outer padding in the z-direction. Defaults to 0.0. |
0.0
|
dilation
|
float
|
Dilation of the polygon in the base by shifting each edge along its normal outwards direction by a distance; |
0.0
|
wavelength
|
float
|
The wavelength for the ModalComponentModeler. Defaults to 1.55. |
1.55
|
bandwidth
|
float
|
The bandwidth for the ModalComponentModeler. Defaults to 0.2. |
0.2
|
num_freqs
|
int
|
The number of frequencies for the ModalComponentModeler. Defaults to 21. |
21
|
min_steps_per_wvl
|
int
|
The minimum number of steps per wavelength for the ModalComponentModeler. Defaults to 30. |
30
|
center_z
|
float | str | None
|
The z-coordinate for the center of the ModalComponentModeler. If None, the z-coordinate of the component is used. Defaults to None. |
None
|
sim_size_z
|
float
|
simulation size um in the z-direction for the ModalComponentModeler. Defaults to 4. |
4.0
|
port_size_mult
|
float | tuple[float, float]
|
The size multiplier for the ports in the ModalComponentModeler. Defaults to (4.0, 3.0). |
(4.0, 3.0)
|
run_only
|
tuple[tuple[str, int], ...] | None
|
The run only specification for the ModalComponentModeler. Defaults to None. |
None
|
element_mappings
|
Tidy3DElementMapping
|
The element mappings for the ModalComponentModeler. Defaults to (). |
()
|
extra_monitors
|
tuple[Any, ...] | None
|
The extra monitors for the ModalComponentModeler. Defaults to None. |
None
|
mode_spec
|
ModeSpec
|
The mode specification for the ModalComponentModeler. Defaults to td.ModeSpec(num_modes=1). |
ModeSpec(num_modes=1)
|
boundary_spec
|
BoundarySpec
|
The boundary specification for the ModalComponentModeler. Defaults to td.BoundarySpec.all_sides(boundary=td.PML()). |
all_sides(boundary=PML())
|
symmetry
|
tuple[Symmetry, Symmetry, Symmetry]
|
The symmetry for the simulation. Defaults to (0,0,0). |
(0, 0, 0)
|
run_time
|
float
|
The run time for the ModalComponentModeler. |
1e-12
|
shutoff
|
float
|
The shutoff value for the ModalComponentModeler. Defaults to 1e-5. |
1e-05
|
folder_name
|
str
|
The folder name for the ModalComponentModeler in flexcompute website. Defaults to "default". |
'default'
|
dirpath
|
PathType
|
Optional directory path for writing the Sparameters. Defaults to "~/.gdsfactory/sparameters". |
dirpath_default
|
verbose
|
bool
|
Whether to print verbose output for the ModalComponentModeler. Defaults to True. |
True
|
plot_simulation_layer_name
|
str | None
|
Optional layer name to plot. Defaults to None. |
None
|
plot_simulation_port_index
|
int
|
which port index to plot. Defaults to 0. |
0
|
plot_simulation_z
|
float | None
|
which z coordinate to plot. Defaults to None. |
None
|
plot_simulation_x
|
float | None
|
which x coordinate to plot. Defaults to None. |
None
|
plot_mode_index
|
int | None
|
which mode index to plot. Defaults to 0. |
0
|
plot_mode_port_name
|
str | None
|
which port name to plot. Defaults to None. |
None
|
plot_epsilon
|
bool
|
whether to plot epsilon. Defaults to False. |
False
|
filepath
|
PathType | None
|
Optional file path for the S-parameters. If None, uses hash of simulation. |
None
|
overwrite
|
bool
|
Whether to overwrite existing S-parameters. Defaults to False. |
False
|
kwargs
|
Any
|
Additional keyword arguments for the tidy3d Simulation constructor. |
{}
|
Source code in gplugins/tidy3d/component.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
gplugins.tidy3d.write_sparameters_grating_coupler
¶
plot_simulation(sim, z=0.0, y=0.0, wavelength=1.55, figsize=(11, 4))
¶
Returns Simulation visual representation. Returns two views for 3D component and one view for 2D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
simulation object. |
required |
z
|
float
|
(um). |
0.0
|
y
|
float
|
(um). |
0.0
|
wavelength
|
float | None
|
(um) for epsilon plot. None plot structures only. |
1.55
|
figsize
|
tuple[float, float]
|
figure size. |
(11, 4)
|
Source code in gplugins/tidy3d/write_sparameters_grating_coupler.py
write_sparameters_grating_coupler(component, dirpath=None, filepath=None, overwrite=False, port_waveguide_name='o1', fiber_port_prefix='o2', verbose=False, run=True, **kwargs)
¶
Get sparameter matrix from a gdsfactory grating coupler.
Assumes grating coupler waveguide port is facing to the left (west).
TODO: add a fiber model (more realistic than a gaussian_beam).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
ComponentSpec
|
grating coupler gdsfactory Component to simulate. |
required |
dirpath
|
PathType | None
|
directory to store sparameters in npz. Defaults to active Pdk.sparameters_path. |
None
|
filepath
|
PathType | None
|
optional sparameters file. |
None
|
overwrite
|
bool
|
overwrites stored Sparameter npz results. |
False
|
verbose
|
bool
|
prints info messages and progressbars. |
False
|
run
|
bool
|
runs simulation, if False, only plots simulation. |
True
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
port_extension |
extend ports beyond the PML. |
|
layer_stack |
contains layer to thickness, zmin and material. Defaults to active pdk.layer_stack. |
|
thickness_pml |
PML thickness (um). |
|
xmargin |
left/right distance from component to PML. |
|
xmargin_left |
left distance from component to PML. |
|
xmargin_right |
right distance from component to PML. |
|
ymargin |
left/right distance from component to PML. |
|
ymargin_top |
top distance from component to PML. |
|
ymargin_bot |
bottom distance from component to PML. |
|
zmargin |
thickness for cladding above and below core. |
|
clad_material |
material for cladding. |
|
box_material |
for bottom cladding. |
|
substrate_material |
for substrate. |
|
box_thickness |
bottom cladding thickness in (um). |
|
substrate_thickness |
(um). |
|
port_waveguide_name |
str
|
input port name. |
port_margin |
margin on each side of the port. |
|
distance_source_to_monitors |
in (um) source goes before monitors. |
|
port_waveguide_offset |
mode solver workaround. positive moves source forward, negative moves source backward. |
|
wavelength |
source center wavelength (um). if None takes mean between wavelength_start, wavelength_stop. |
|
wavelength_start |
in (um). |
|
wavelength_stop |
in (um). |
|
wavelength_points |
number of wavelengths. |
|
plot_modes |
plot source modes. |
|
num_modes |
number of modes to plot. |
|
run_time_ps |
make sure it's sufficient for the fields to decay. defaults to 10ps and counts on the automatic shutoff to stop earlier if needed. |
|
fiber_port_prefix |
str
|
port prefix to place fiber source. |
fiber_xoffset |
fiber center xoffset to fiber_port_name. |
|
fiber_z |
fiber zoffset from grating zmax. |
|
fiber_mfd |
fiber mode field diameter (um). |
|
fiber_angle_deg |
fiber_angle in degrees with respect to normal. |
|
material_name_to_tidy3d |
dispersive materials have a wavelength dependent index. Maps layer_stack names with tidy3d material database names. |
|
is_3d |
True by default runs in 3D. |
|
with_all_monitors |
stores all monitor fields. |
|
kwargs |
simulation settings. |
Source code in gplugins/tidy3d/write_sparameters_grating_coupler.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
write_sparameters_grating_coupler_batch(jobs, **kwargs)
¶
Returns Sparameters for a list of write_sparameters.
Each job runs in separate thread and is non blocking. You need to get the results using sp.result().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
list[dict[str, Any]]
|
list of kwargs for write_sparameters_grating_coupler. |
required |
kwargs
|
simulation settings. |
{}
|
Source code in gplugins/tidy3d/write_sparameters_grating_coupler.py
gplugins.tidy3d.write_sparameters_grating_coupler_batch(jobs, **kwargs)
¶
Returns Sparameters for a list of write_sparameters.
Each job runs in separate thread and is non blocking. You need to get the results using sp.result().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
list[dict[str, Any]]
|
list of kwargs for write_sparameters_grating_coupler. |
required |
kwargs
|
simulation settings. |
{}
|
Source code in gplugins/tidy3d/write_sparameters_grating_coupler.py
FDTD lumerical¶
gplugins.lumerical.write_sparameters_lumerical
¶
Write Sparameters with Lumerical FDTD.
set_material(session, structure, material)
¶
Sets the material of a structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
lumerical session. |
required | |
structure
|
str
|
name of the lumerical structure. |
required |
material
|
MaterialSpec
|
material spec, can be a string from lumerical database materials. a float or int, representing refractive index. a complex for n, k materials. |
required |
Source code in gplugins/lumerical/write_sparameters_lumerical.py
write_sparameters_lumerical(component, session=None, run=True, overwrite=False, dirpath=None, layer_stack=None, simulation_settings=SIMULATION_SETTINGS_LUMERICAL_FDTD, material_name_to_lumerical=None, delete_fsp_files=True, xmargin=0, ymargin=3, xmargin_left=None, xmargin_right=None, ymargin_top=None, ymargin_bot=None, zmargin=1.0, exclude_layers=None, **settings)
¶
Returns and writes component Sparameters using Lumerical FDTD.
If simulation exists it returns the Sparameters directly unless overwrite=True which forces a re-run of the simulation
Writes Sparameters both in .npz and .DAT (interconnect format) as well as simulation settings in .YAML
In the npz format you can see S12m where m stands for magnitude
and S12a where a stands for angle in radians
Your components need to have ports, that will extend over the PML.
.. image:: https://i.imgur.com/dHAzZRw.png
For your Fab technology you can overwrite
- simulation_settings
- dirpath
- layerStack
converts gdsfactory units (um) to Lumerical units (m)
Disclaimer: This function tries to extract Sparameters automatically is hard to make a function that will fit all your possible simulation settings. You can use this function for inspiration to create your own.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
ComponentSpec
|
Component to simulate. |
required |
session
|
object | None
|
you can pass a session=lumapi.FDTD() or it will create one. |
None
|
run
|
bool
|
True runs Lumerical, False only draws simulation. |
True
|
overwrite
|
bool
|
run even if simulation results already exists. |
False
|
dirpath
|
PathType | None
|
directory to store sparameters in npz. Defaults to active Pdk.sparameters_path. |
None
|
layer_stack
|
LayerStack | None
|
contains layer to thickness, zmin and material. Defaults to active pdk.layer_stack. |
None
|
simulation_settings
|
SimulationSettingsLumericalFdtd
|
dataclass with all simulation_settings. |
SIMULATION_SETTINGS_LUMERICAL_FDTD
|
material_name_to_lumerical
|
dict[str, MaterialSpec] | None
|
alias to lumerical material's database name or refractive index. translate material name in LayerStack to lumerical's database name. |
None
|
delete_fsp_files
|
bool
|
deletes lumerical fsp files after simulation. |
True
|
xmargin
|
float
|
left/right distance from component to PML. |
0
|
xmargin_left
|
float | None
|
left distance from component to PML. |
None
|
xmargin_right
|
float | None
|
right distance from component to PML. |
None
|
ymargin
|
float
|
left/right distance from component to PML. |
3
|
ymargin_top
|
float | None
|
top distance from component to PML. |
None
|
ymargin_bot
|
float | None
|
bottom distance from component to PML. |
None
|
zmargin
|
float
|
thickness for cladding above and below core. |
1.0
|
exclude_layers
|
list[int] | None
|
list of layer indices to exclude from simulation. |
None
|
settings
|
additional simulation settings to overwrite |
{}
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
background_material |
for the background. |
|
port_margin |
on both sides of the port width (um). |
|
port_height |
port height (um). |
|
port_extension |
port extension (um). |
|
mesh_accuracy |
2 (1: coarse, 2: fine, 3: superfine). |
|
wavelength_start |
1.2 (um). |
|
wavelength_stop |
1.6 (um). |
|
wavelength_points |
500. |
|
simulation_time |
(s) related to max path length 3e8/2.410e-121e6 = 1.25mm. |
|
simulation_temperature |
in kelvin (default = 300). |
|
frequency_dependent_profile |
computes mode profiles for different wavelengths. |
|
field_profile_samples |
number of wavelengths to compute field profile. |
.. code::
top view
________________________________
| |
| xmargin | port_extension
|<------> port_margin ||<-->
o2_|___________ _________||_o3
| \ / |
| \ / |
| ====== |
| / \ |
o1_|___________/ \__________|_o4
| | |
| |ymargin |
| | |
|___|___________________________|
side view
________________________________
| |
| |
| |
|ymargin |
|<---> _____ _____ |
| | | | | |
| | | | | |
| |_____| |_____| |
| | |
| | |
| |zmargin |
| | |
|_______|_______________________|
Return
Sparameters np.ndarray (wavelengths, o1@0,o1@0, o1@0,o2@0 ...)
suffix a for angle in radians and m for module.
Source code in gplugins/lumerical/write_sparameters_lumerical.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
Circuit Solver¶
SAX¶
gplugins.sax.read.model_from_csv(filepath, xkey='wavelengths', xunits=1, prefix='s')
¶
Returns a SAX Sparameters Model from a CSV file.
The SAX Model is a function that returns a SAX SDict interpolated over wavelength.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
PathType | DataFrame
|
CSV Sparameters path or pandas DataFrame. |
required |
xkey
|
str
|
key for wavelengths in file. |
'wavelengths'
|
xunits
|
float
|
x units in um from the loaded file (um). 1 means 1um. |
1
|
prefix
|
str
|
for the sparameters column names in file. |
's'
|
Source code in gplugins/sax/read.py
gplugins.sax.read.model_from_component(component, simulator, **kwargs)
¶
Returns SAX model from lumerical FDTD simulations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
to simulate. |
required | |
simulator
|
Simulator
|
meep, lumerical or tidy3d. |
required |
kwargs
|
simulator settings. |
{}
|
Source code in gplugins/sax/read.py
gplugins.sax.plot_model
¶
Useful plot functions.
plot_model(model, port1='o1', ports2=None, logscale=True, min_db_range=0.5, fig=None, wavelength_start=1.5, wavelength_stop=1.6, wavelength_points=2000, phase=False, title=None)
¶
Plot Model Sparameters Magnitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
function that returns SDict as function of wavelength. |
required |
port1
|
str
|
input port name. |
'o1'
|
ports2
|
tuple[str, ...] | None
|
list of ports. |
None
|
logscale
|
bool
|
plots in dB logarithmic scale. |
True
|
min_db_range
|
float
|
minimum dB range. Set to 0 to disable. |
0.5
|
fig
|
matplotlib figure. |
None
|
|
wavelength_start
|
float
|
wavelength min (µm). |
1.5
|
wavelength_stop
|
float
|
wavelength max (µm). |
1.6
|
wavelength_points
|
int
|
number of wavelength steps. |
2000
|
phase
|
bool
|
plot phase instead of magnitude. |
False
|
title
|
str | None
|
plot title. |
None
|
.. plot:: :include-source:
import gplugins.sax as gs
gs.plot_model(gs.models.straight, phase=True, port1="o1")
Source code in gplugins/sax/plot_model.py
gplugins.sax.models
¶
Electrostatics¶
Elmer¶
gplugins.elmer.run_capacitive_simulation_elmer(component, element_order=1, n_processes=1, layer_stack=None, material_spec=None, simulation_folder=None, simulator_params=None, mesh_parameters=None, mesh_file=None)
¶
Run electrostatic finite element method simulations using
Elmer_. Returns the field solution and resulting capacitance matrix.
.. note:: You should have ElmerGrid, ElmerSolver and ElmerSolver_mpi and in your PATH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
Simulation environment as a gdsfactory component. |
required |
element_order
|
int
|
Order of polynomial basis functions. Higher is more accurate but takes more memory and time to run. |
1
|
n_processes
|
int
|
Number of processes to use for parallelization |
1
|
layer_stack
|
LayerStack | None
|
:class: |
None
|
material_spec
|
RFMaterialSpec | None
|
:class: |
None
|
simulation_folder
|
Path | str | None
|
Directory for storing the simulation results. Default is a temporary directory. |
None
|
simulator_params
|
Mapping[str, Any] | None
|
Elmer-specific parameters. See template file for more details. |
None
|
mesh_parameters
|
dict[str, Any] | None
|
Keyword arguments to provide to :func: |
None
|
mesh_file
|
Path | str | None
|
Path to a ready mesh to use. Useful for reusing one mesh file.
By default a mesh is generated according to |
None
|
.. _Elmer: https://github.com/ElmerCSC/elmerfem
Source code in gplugins/elmer/get_capacitance.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
Palace¶
gplugins.palace.run_capacitive_simulation_palace(component, n_processes=1, layer_stack=None, material_spec=None, simulation_folder=None, solver_config=None, mesh_parameters=None, mesh_file=None)
¶
Run electrostatic finite element method simulations using
Palace_.
Returns the field solution and resulting capacitance matrix.
.. note:: You should have palace in your PATH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
Simulation environment as a gdsfactory component. |
required |
n_processes
|
int
|
Number of processes to use for parallelization |
1
|
layer_stack
|
LayerStack | None
|
:class: |
None
|
material_spec
|
RFMaterialSpec | None
|
:class: |
None
|
simulation_folder
|
Path | str | None
|
Directory for storing the simulation results. Default is a temporary directory. |
None
|
solver_config
|
Mapping[str, Any] | None
|
Palace-specific parameters. This will be expanded to |
None
|
mesh_parameters
|
dict[str, Any] | None
|
Keyword arguments to provide to :func: |
None
|
mesh_file
|
Path | str | None
|
Path to a ready mesh to use. Useful for reusing one mesh file.
By default a mesh is generated according to |
None
|
.. _Palace: https://github.com/awslabs/palace
Source code in gplugins/palace/get_capacitance.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
Full-wave RF¶
Palace¶
gplugins.palace.run_scattering_simulation_palace(component, element_order=1, n_processes=1, layer_stack=None, material_spec=None, simulation_folder=None, simulator_params=None, driven_settings=None, mesh_refinement_levels=None, only_one_port=True, mesh_parameters=None, mesh_file=None)
¶
Run full-wave finite element method simulations using Palace.
Returns the field solution and resulting scattering matrix.
.. note:: You should have palace in your PATH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
Component
|
Simulation environment as a gdsfactory component. |
required |
element_order
|
int
|
Order of polynomial basis functions. Higher is more accurate but takes more memory and time to run. |
1
|
n_processes
|
int
|
Number of processes to use for parallelization |
1
|
layer_stack
|
LayerStack | None
|
:class: |
None
|
material_spec
|
RFMaterialSpec | None
|
:class: |
None
|
simulation_folder
|
Path | str | None
|
Directory for storing the simulation results. Default is a temporary directory. |
None
|
simulator_params
|
Mapping[str, Any] | None
|
Palace-specific parameters. This will be expanded to |
None
|
driven_settings
|
Mapping[str, float | int | bool] | None
|
Driven full-wave parameters in Palace. This will be expanded to |
None
|
mesh_refinement_levels
|
int | None
|
Refine mesh this many times, see Palace for details. |
None
|
only_one_port
|
bool | None
|
Whether to solve only scattering from the first port to other ports, e.g., |
True
|
mesh_parameters
|
dict[str, Any] | None
|
Keyword arguments to provide to :func: |
None
|
mesh_file
|
Path | str | None
|
Path to a ready mesh to use. Useful for reusing one mesh file.
By default a mesh is generated according to |
None
|
.. _Palace https://github.com/awslabs/palace
Source code in gplugins/palace/get_scattering.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |