tidy3d.Structure#
- class Structure[source]#
Bases:
AbstractStructure
Defines a physical object that interacts with the electromagnetic fields. A
Structure
is a combination of a material property (AbstractMedium
) and aGeometry
.- Parameters:
geometry (Union[Box, Transformed, ClipOperation, GeometryGroup, Sphere, Cylinder, PolySlab, ComplexPolySlabBase, TriangleMesh]) – Defines geometric properties of the structure.
name (Optional[str] = None) – Optional name for the structure.
medium (Union[Medium, AnisotropicMedium, PECMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, PerturbationMedium, PerturbationPoleResidue, Medium2D]) – Defines the electromagnetic properties of the structure’s medium.
Notes
Structures can indeed be larger than the simulation domain in
tidy3d
. In such cases,tidy3d
will automatically truncate the geometry that goes beyond the domain boundaries. For best results, structures that intersect with absorbing boundaries or simulation edges should extend all the way through. In many such cases, an “infinite” sizetd.inf
can be used to define the size along that dimension.Example
>>> from tidy3d import Box, Medium >>> box = Box(center=(0,0,1), size=(2, 2, 2)) >>> glass = Medium(permittivity=3.9) >>> struct = Structure(geometry=box, medium=glass, name='glass_box')
See also
Notebooks:
Quickstart: Usage in a basic simulation flow.
First walkthrough: Usage in a basic simulation flow.
Lectures:
GUI:
Attributes
Methods
eps_comp
(row, col, frequency, coords)Single component of the complex-valued permittivity tensor as a function of frequency.
eps_diagonal
(frequency, coords)Main diagonal of the complex-valued permittivity tensor as a function of frequency.
to_gds
(cell[, x, y, z, ...])Append a structure's planar slice to a .gds cell.
to_gds_file
(fname[, x, y, z, ...])Export a structure's planar slice to a .gds file.
to_gdspy
([x, y, z, gds_layer, gds_dtype])Convert a structure's planar slice to a .gds type polygon.
to_gdstk
([x, y, z, permittivity_threshold, ...])Convert a structure's planar slice to a .gds type polygon.
- medium#
- eps_diagonal(frequency, coords)[source]#
Main diagonal of the complex-valued permittivity tensor as a function of frequency.
- Parameters:
frequency (float) – Frequency to evaluate permittivity at (Hz).
- Returns:
The diagonal elements of the relative permittivity tensor evaluated at
frequency
.- Return type:
complex
- eps_comp(row, col, frequency, coords)[source]#
Single component of the complex-valued permittivity tensor as a function of frequency.
- Parameters:
row (int) – Component’s row in the permittivity tensor (0, 1, or 2 for x, y, or z respectively).
col (int) – Component’s column in the permittivity tensor (0, 1, or 2 for x, y, or z respectively).
frequency (float) – Frequency to evaluate permittivity at (Hz).
- Returns:
Element of the relative permittivity tensor evaluated at
frequency
.- Return type:
complex
- to_gdstk(x=None, y=None, z=None, permittivity_threshold=1, frequency=0, gds_layer=0, gds_dtype=0)[source]#
Convert a structure’s planar slice to a .gds type polygon.
- Parameters:
x (float = None) – Position of plane in x direction, only one of x,y,z can be specified to define plane.
y (float = None) – Position of plane in y direction, only one of x,y,z can be specified to define plane.
z (float = None) – Position of plane in z direction, only one of x,y,z can be specified to define plane.
permittivity_threshold (float = 1.1) – Permitivitty value used to define the shape boundaries for structures with custom medim
frequency (float = 0) – Frequency for permittivity evaluaiton in case of custom medium (Hz).
gds_layer (int = 0) – Layer index to use for the shapes stored in the .gds file.
gds_dtype (int = 0) – Data-type index to use for the shapes stored in the .gds file.
- Returns:
List of
gdstk.Polygon
- Return type:
List
- to_gdspy(x=None, y=None, z=None, gds_layer=0, gds_dtype=0)[source]#
Convert a structure’s planar slice to a .gds type polygon.
- Parameters:
x (float = None) – Position of plane in x direction, only one of x,y,z can be specified to define plane.
y (float = None) – Position of plane in y direction, only one of x,y,z can be specified to define plane.
z (float = None) – Position of plane in z direction, only one of x,y,z can be specified to define plane.
gds_layer (int = 0) – Layer index to use for the shapes stored in the .gds file.
gds_dtype (int = 0) – Data-type index to use for the shapes stored in the .gds file.
- Returns:
List of
gdspy.Polygon
andgdspy.PolygonSet
.- Return type:
List
- to_gds(cell, x=None, y=None, z=None, permittivity_threshold=1, frequency=0, gds_layer=0, gds_dtype=0)[source]#
Append a structure’s planar slice to a .gds cell.
- Parameters:
cell (
gdstk.Cell
orgdspy.Cell
) – Cell object to which the generated polygons are added.x (float = None) – Position of plane in x direction, only one of x,y,z can be specified to define plane.
y (float = None) – Position of plane in y direction, only one of x,y,z can be specified to define plane.
z (float = None) – Position of plane in z direction, only one of x,y,z can be specified to define plane.
permittivity_threshold (float = 1.1) – Permitivitty value used to define the shape boundaries for structures with custom medim
frequency (float = 0) – Frequency for permittivity evaluaiton in case of custom medium (Hz).
gds_layer (int = 0) – Layer index to use for the shapes stored in the .gds file.
gds_dtype (int = 0) – Data-type index to use for the shapes stored in the .gds file.
- to_gds_file(fname, x=None, y=None, z=None, permittivity_threshold=1, frequency=0, gds_layer=0, gds_dtype=0, gds_cell_name='MAIN')[source]#
Export a structure’s planar slice to a .gds file.
- Parameters:
fname (str) – Full path to the .gds file to save the
Structure
slice to.x (float = None) – Position of plane in x direction, only one of x,y,z can be specified to define plane.
y (float = None) – Position of plane in y direction, only one of x,y,z can be specified to define plane.
z (float = None) – Position of plane in z direction, only one of x,y,z can be specified to define plane.
permittivity_threshold (float = 1.1) – Permitivitty value used to define the shape boundaries for structures with custom medim
frequency (float = 0) – Frequency for permittivity evaluaiton in case of custom medium (Hz).
gds_layer (int = 0) – Layer index to use for the shapes stored in the .gds file.
gds_dtype (int = 0) – Data-type index to use for the shapes stored in the .gds file.
gds_cell_name (str = 'MAIN') – Name of the cell created in the .gds file to store the geometry.
- __hash__()#
Hash method.