tidy3d.MeshOverrideStructure
tidy3d.MeshOverrideStructure#
- class tidy3d.MeshOverrideStructure#
Bases:
tidy3d.components.structure.AbstractStructure
Defines an object that is only used in the process of generating the mesh. A
MeshOverrideStructure
is a combination of geometryGeometry
, grid size along x,y,z directions, and a boolean on whether the override will be enforced.- Parameters
geometry (Union[Box, Sphere, Cylinder, PolySlab, TriangleMesh, GeometryGroup]) – Defines geometric properties of the structure.
name (Optional[str] = None) – Optional name for the structure.
dl (Tuple[PositiveFloat, PositiveFloat, PositiveFloat]) – [units = um]. Grid size along x, y, z directions.
enforce (bool = False) – If
True
, enforce the grid size setup inside the structure even if the structure is inside a structure of smaller grid size. In the intersection region of multiple structures ofenforce=True
, grid size is decided by the last added structure ofenforce=True
.
Example
>>> from tidy3d import Box >>> box = Box(center=(0,0,1), size=(2, 2, 2)) >>> struct_override = MeshOverrideStructure(geometry=box, dl=(0.1,0.2,0.3), name='override_box')
Show JSON schema
{ "title": "MeshOverrideStructure", "description": "Defines an object that is only used in the process of generating the mesh.\nA :class:`MeshOverrideStructure` is a combination of geometry :class:`Geometry`,\ngrid size along x,y,z directions, and a boolean on whether the override\nwill be enforced.\n\nParameters\n----------\ngeometry : Union[Box, Sphere, Cylinder, PolySlab, TriangleMesh, GeometryGroup]\n Defines geometric properties of the structure.\nname : Optional[str] = None\n Optional name for the structure.\ndl : Tuple[PositiveFloat, PositiveFloat, PositiveFloat]\n [units = um]. Grid size along x, y, z directions.\nenforce : bool = False\n If ``True``, enforce the grid size setup inside the structure even if the structure is inside a structure of smaller grid size. In the intersection region of multiple structures of ``enforce=True``, grid size is decided by the last added structure of ``enforce=True``.\n\nExample\n-------\n>>> from tidy3d import Box\n>>> box = Box(center=(0,0,1), size=(2, 2, 2))\n>>> struct_override = MeshOverrideStructure(geometry=box, dl=(0.1,0.2,0.3), name='override_box')", "type": "object", "properties": { "geometry": { "title": "Geometry", "description": "Defines geometric properties of the structure.", "discriminator": { "propertyName": "type", "mapping": { "Box": "#/definitions/Box", "Sphere": "#/definitions/Sphere", "Cylinder": "#/definitions/Cylinder", "PolySlab": "#/definitions/PolySlab", "TriangleMesh": "#/definitions/TriangleMesh", "GeometryGroup": "#/definitions/GeometryGroup" } }, "oneOf": [ { "$ref": "#/definitions/Box" }, { "$ref": "#/definitions/Sphere" }, { "$ref": "#/definitions/Cylinder" }, { "$ref": "#/definitions/PolySlab" }, { "$ref": "#/definitions/TriangleMesh" }, { "$ref": "#/definitions/GeometryGroup" } ] }, "name": { "title": "Name", "description": "Optional name for the structure.", "type": "string" }, "type": { "title": "Type", "default": "MeshOverrideStructure", "enum": [ "MeshOverrideStructure" ], "type": "string" }, "dl": { "title": "Grid Size", "description": "Grid size along x, y, z directions.", "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number", "exclusiveMinimum": 0 }, { "type": "number", "exclusiveMinimum": 0 }, { "type": "number", "exclusiveMinimum": 0 } ] }, "enforce": { "title": "Enforce grid size", "description": "If ``True``, enforce the grid size setup inside the structure even if the structure is inside a structure of smaller grid size. In the intersection region of multiple structures of ``enforce=True``, grid size is decided by the last added structure of ``enforce=True``.", "default": false, "type": "boolean" } }, "required": [ "geometry", "dl" ], "additionalProperties": false, "definitions": { "Box": { "title": "Box", "description": "Rectangular prism.\n Also base class for :class:`Simulation`, :class:`Monitor`, and :class:`Source`.\n\nParameters\n----------\ncenter : Tuple[float, float, float] = (0.0, 0.0, 0.0)\n [units = um]. Center of object in x, y, and z.\nsize : Tuple[NonNegativeFloat, NonNegativeFloat, NonNegativeFloat]\n [units = um]. Size in x, y, and z directions.\n\nExample\n-------\n>>> b = Box(center=(1,2,3), size=(2,2,2))", "type": "object", "properties": { "type": { "title": "Type", "default": "Box", "enum": [ "Box" ], "type": "string" }, "center": { "title": "Center", "description": "Center of object in x, y, and z.", "default": [ 0.0, 0.0, 0.0 ], "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" } ] }, "size": { "title": "Size", "description": "Size in x, y, and z directions.", "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number", "minimum": 0 }, { "type": "number", "minimum": 0 }, { "type": "number", "minimum": 0 } ] } }, "required": [ "size" ], "additionalProperties": false }, "Sphere": { "title": "Sphere", "description": "Spherical geometry.\n\nParameters\n----------\nradius : NonNegativeFloat\n [units = um]. Radius of geometry.\ncenter : Tuple[float, float, float] = (0.0, 0.0, 0.0)\n [units = um]. Center of object in x, y, and z.\n\nExample\n-------\n>>> b = Sphere(center=(1,2,3), radius=2)", "type": "object", "properties": { "type": { "title": "Type", "default": "Sphere", "enum": [ "Sphere" ], "type": "string" }, "radius": { "title": "Radius", "description": "Radius of geometry.", "units": "um", "minimum": 0, "type": "number" }, "center": { "title": "Center", "description": "Center of object in x, y, and z.", "default": [ 0.0, 0.0, 0.0 ], "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" } ] } }, "required": [ "radius" ], "additionalProperties": false }, "Cylinder": { "title": "Cylinder", "description": "Cylindrical geometry with optional sidewall angle along axis\ndirection. When ``sidewall_angle`` is nonzero, the shape is a\nconical frustum or a cone.\n\nParameters\n----------\naxis : Literal[0, 1, 2] = 2\n Specifies dimension of the planar axis (0,1,2) -> (x,y,z).\nsidewall_angle : ConstrainedFloatValue = 0.0\n [units = rad]. Angle of the sidewall. ``sidewall_angle=0`` (default) specifies a vertical wall; ``0<sidewall_angle<np.pi/2`` specifies a shrinking cross section along the ``axis`` direction; and ``-np.pi/2<sidewall_angle<0`` specifies an expanding cross section along the ``axis`` direction.\nreference_plane : Literal['bottom', 'middle', 'top'] = middle\n The position of the plane where the supplied cross section are defined. The plane is perpendicular to the ``axis``. The plane is located at the ``bottom``, ``middle``, or ``top`` of the geometry with respect to the axis. E.g. if ``axis=1``, ``bottom`` refers to the negative side of the y-axis, and ``top`` refers to the positive side of the y-axis.\nradius : NonNegativeFloat\n [units = um]. Radius of geometry at the ``reference_plane``.\ncenter : Tuple[float, float, float] = (0.0, 0.0, 0.0)\n [units = um]. Center of object in x, y, and z.\nlength : NonNegativeFloat\n [units = um]. Defines thickness of cylinder along axis dimension.\n\nExample\n-------\n>>> c = Cylinder(center=(1,2,3), radius=2, length=5, axis=2)", "type": "object", "properties": { "type": { "title": "Type", "default": "Cylinder", "enum": [ "Cylinder" ], "type": "string" }, "axis": { "title": "Axis", "description": "Specifies dimension of the planar axis (0,1,2) -> (x,y,z).", "default": 2, "enum": [ 0, 1, 2 ], "type": "integer" }, "sidewall_angle": { "title": "Sidewall angle", "description": "Angle of the sidewall. ``sidewall_angle=0`` (default) specifies a vertical wall; ``0<sidewall_angle<np.pi/2`` specifies a shrinking cross section along the ``axis`` direction; and ``-np.pi/2<sidewall_angle<0`` specifies an expanding cross section along the ``axis`` direction.", "default": 0.0, "exclusiveMinimum": -1.5707963267948966, "exclusiveMaximum": 1.5707963267948966, "units": "rad", "type": "number" }, "reference_plane": { "title": "Reference plane for cross section", "description": "The position of the plane where the supplied cross section are defined. The plane is perpendicular to the ``axis``. The plane is located at the ``bottom``, ``middle``, or ``top`` of the geometry with respect to the axis. E.g. if ``axis=1``, ``bottom`` refers to the negative side of the y-axis, and ``top`` refers to the positive side of the y-axis.", "default": "middle", "enum": [ "bottom", "middle", "top" ], "type": "string" }, "radius": { "title": "Radius", "description": "Radius of geometry at the ``reference_plane``.", "units": "um", "minimum": 0, "type": "number" }, "center": { "title": "Center", "description": "Center of object in x, y, and z.", "default": [ 0.0, 0.0, 0.0 ], "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" } ] }, "length": { "title": "Length", "description": "Defines thickness of cylinder along axis dimension.", "units": "um", "minimum": 0, "type": "number" } }, "required": [ "radius", "length" ], "additionalProperties": false }, "PolySlab": { "title": "PolySlab", "description": "Polygon extruded with optional sidewall angle along axis direction.\n\nParameters\n----------\naxis : Literal[0, 1, 2] = 2\n Specifies dimension of the planar axis (0,1,2) -> (x,y,z).\nsidewall_angle : ConstrainedFloatValue = 0.0\n [units = rad]. Angle of the sidewall. ``sidewall_angle=0`` (default) specifies a vertical wall; ``0<sidewall_angle<np.pi/2`` specifies a shrinking cross section along the ``axis`` direction; and ``-np.pi/2<sidewall_angle<0`` specifies an expanding cross section along the ``axis`` direction.\nreference_plane : Literal['bottom', 'middle', 'top'] = middle\n The position of the plane where the supplied cross section are defined. The plane is perpendicular to the ``axis``. The plane is located at the ``bottom``, ``middle``, or ``top`` of the geometry with respect to the axis. E.g. if ``axis=1``, ``bottom`` refers to the negative side of the y-axis, and ``top`` refers to the positive side of the y-axis.\nslab_bounds : Tuple[float, float]\n [units = um]. Minimum and maximum positions of the slab along axis dimension.\ndilation : float = 0.0\n [units = um]. Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.\nvertices : ArrayLike_dtype=<class 'float'>_ndim=2\n [units = um]. List of (d1, d2) defining the 2 dimensional positions of the polygon face vertices at the ``reference_plane``. The index of dimension should be in the ascending order: e.g. if the slab normal axis is ``axis=y``, the coordinate of the vertices will be in (x, z)\n\nExample\n-------\n>>> vertices = np.array([(0,0), (1,0), (1,1)])\n>>> p = PolySlab(vertices=vertices, axis=2, slab_bounds=(-1, 1))", "type": "object", "properties": { "type": { "title": "Type", "default": "PolySlab", "enum": [ "PolySlab" ], "type": "string" }, "axis": { "title": "Axis", "description": "Specifies dimension of the planar axis (0,1,2) -> (x,y,z).", "default": 2, "enum": [ 0, 1, 2 ], "type": "integer" }, "sidewall_angle": { "title": "Sidewall angle", "description": "Angle of the sidewall. ``sidewall_angle=0`` (default) specifies a vertical wall; ``0<sidewall_angle<np.pi/2`` specifies a shrinking cross section along the ``axis`` direction; and ``-np.pi/2<sidewall_angle<0`` specifies an expanding cross section along the ``axis`` direction.", "default": 0.0, "exclusiveMinimum": -1.5707963267948966, "exclusiveMaximum": 1.5707963267948966, "units": "rad", "type": "number" }, "reference_plane": { "title": "Reference plane for cross section", "description": "The position of the plane where the supplied cross section are defined. The plane is perpendicular to the ``axis``. The plane is located at the ``bottom``, ``middle``, or ``top`` of the geometry with respect to the axis. E.g. if ``axis=1``, ``bottom`` refers to the negative side of the y-axis, and ``top`` refers to the positive side of the y-axis.", "default": "middle", "enum": [ "bottom", "middle", "top" ], "type": "string" }, "slab_bounds": { "title": "Slab Bounds", "description": "Minimum and maximum positions of the slab along axis dimension.", "units": "um", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "dilation": { "title": "Dilation", "description": "Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.", "default": 0.0, "units": "um", "type": "number" }, "vertices": { "title": "ArrayLike", "description": "List of (d1, d2) defining the 2 dimensional positions of the polygon face vertices at the ``reference_plane``. The index of dimension should be in the ascending order: e.g. if the slab normal axis is ``axis=y``, the coordinate of the vertices will be in (x, z)", "units": "um", "type": "ArrayLike" } }, "required": [ "slab_bounds", "vertices" ], "additionalProperties": false }, "TriangleMeshDataset": { "title": "TriangleMeshDataset", "description": "Dataset for storing triangular surface data.\n\nParameters\n----------\nsurface_mesh : TriangleMeshDataArray\n Dataset containing the surface triangles and corresponding face indices for a surface mesh.", "type": "object", "properties": { "type": { "title": "Type", "default": "TriangleMeshDataset", "enum": [ "TriangleMeshDataset" ], "type": "string" }, "surface_mesh": { "title": "DataArray", "description": "Dataset containing the surface triangles and corresponding face indices for a surface mesh.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } }, "required": [ "surface_mesh" ], "additionalProperties": false }, "TriangleMesh": { "title": "TriangleMesh", "description": "Custom surface geometry given by a triangle mesh, as in the STL file format.\n\nParameters\n----------\nmesh_dataset : Optional[TriangleMeshDataset]\n Surface mesh data.\n\nExample\n-------\n>>> vertices = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]])\n>>> faces = np.array([[1, 2, 3], [0, 3, 2], [0, 1, 3], [0, 2, 1]])\n>>> stl_geom = TriangleMesh.from_vertices_faces(vertices, faces)", "type": "object", "properties": { "type": { "title": "Type", "default": "TriangleMesh", "enum": [ "TriangleMesh" ], "type": "string" }, "mesh_dataset": { "title": "Surface mesh data", "description": "Surface mesh data.", "allOf": [ { "$ref": "#/definitions/TriangleMeshDataset" } ] } }, "required": [ "mesh_dataset" ], "additionalProperties": false }, "GeometryGroup": { "title": "GeometryGroup", "description": "A collection of Geometry objects that can be called as a single geometry object.\n\nParameters\n----------\ngeometries : Tuple[Annotated[Union[tidy3d.components.geometry.Box, tidy3d.components.geometry.Sphere, tidy3d.components.geometry.Cylinder, tidy3d.components.geometry.PolySlab, tidy3d.components.geometry.TriangleMesh], FieldInfo(default=PydanticUndefined, discriminator='type', extra={})], ...]\n Tuple of geometries in a single grouping. Can provide significant performance enhancement in ``Structure`` when all geometries are assigned the same medium.", "type": "object", "properties": { "type": { "title": "Type", "default": "GeometryGroup", "enum": [ "GeometryGroup" ], "type": "string" }, "geometries": { "title": "Geometries", "description": "Tuple of geometries in a single grouping. Can provide significant performance enhancement in ``Structure`` when all geometries are assigned the same medium.", "type": "array", "items": { "discriminator": { "propertyName": "type", "mapping": { "Box": "#/definitions/Box", "Sphere": "#/definitions/Sphere", "Cylinder": "#/definitions/Cylinder", "PolySlab": "#/definitions/PolySlab", "TriangleMesh": "#/definitions/TriangleMesh" } }, "oneOf": [ { "$ref": "#/definitions/Box" }, { "$ref": "#/definitions/Sphere" }, { "$ref": "#/definitions/Cylinder" }, { "$ref": "#/definitions/PolySlab" }, { "$ref": "#/definitions/TriangleMesh" } ] } } }, "required": [ "geometries" ], "additionalProperties": false } } }
- attribute dl: Tuple[Optional[pydantic.types.PositiveFloat], Optional[pydantic.types.PositiveFloat], Optional[pydantic.types.PositiveFloat]] [Required]#
Grid size along x, y, z directions.
- attribute enforce: bool = False#
If
True
, enforce the grid size setup inside the structure even if the structure is inside a structure of smaller grid size. In the intersection region of multiple structures ofenforce=True
, grid size is decided by the last added structure ofenforce=True
.
- attribute geometry: Union[tidy3d.components.geometry.Box, tidy3d.components.geometry.Sphere, tidy3d.components.geometry.Cylinder, tidy3d.components.geometry.PolySlab, tidy3d.components.geometry.TriangleMesh, tidy3d.components.geometry.GeometryGroup] [Required]#
Defines geometric properties of the structure.
- attribute name: str = None#
Optional name for the structure.
- Validated by
field_has_unique_names
- classmethod add_type_field() None #
Automatically place “type” field with model name in the model field dictionary.
- classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model #
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
- copy(**kwargs) tidy3d.components.base.Tidy3dBaseModel #
Copy a Tidy3dBaseModel. With
deep=True
as default.
- dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny #
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- classmethod dict_from_file(fname: str, group_path: Optional[str] = None) dict #
Loads a dictionary containing the model from a .yaml, .json, or .hdf5 file.
- Parameters
fname (str) – Full path to the .yaml or .json file to load the
Tidy3dBaseModel
from.group_path (str, optional) – Path to a group inside the file to use as the base level.
- Returns
A dictionary containing the model.
- Return type
dict
Example
>>> simulation = Simulation.from_file(fname='folder/sim.json')
- classmethod dict_from_hdf5(fname: str, group_path: str = '') dict #
Loads a dictionary containing the model contents from a .hdf5 file.
- Parameters
fname (str) – Full path to the .hdf5 file to load the
Tidy3dBaseModel
from.group_path (str, optional) – Path to a group inside the file to selectively load a sub-element of the model only.
- Returns
Dictionary containing the model.
- Return type
dict
Example
>>> sim_dict = Simulation.dict_from_hdf5(fname='folder/sim.hdf5')
- classmethod dict_from_json(fname: str) dict #
Load dictionary of the model from a .json file.
- Parameters
fname (str) – Full path to the .json file to load the
Tidy3dBaseModel
from.- Returns
A dictionary containing the model.
- Return type
dict
Example
>>> sim_dict = Simulation.dict_from_json(fname='folder/sim.json')
- classmethod dict_from_yaml(fname: str) dict #
Load dictionary of the model from a .yaml file.
- Parameters
fname (str) – Full path to the .yaml file to load the
Tidy3dBaseModel
from.- Returns
A dictionary containing the model.
- Return type
dict
Example
>>> sim_dict = Simulation.dict_from_yaml(fname='folder/sim.yaml')
- classmethod from_file(fname: str, group_path: Optional[str] = None, **parse_obj_kwargs) tidy3d.components.base.Tidy3dBaseModel #
Loads a
Tidy3dBaseModel
from .yaml, .json, or .hdf5 file.- Parameters
fname (str) – Full path to the .yaml or .json file to load the
Tidy3dBaseModel
from.group_path (str, optional) – Path to a group inside the file to use as the base level. Only for
.hdf5
files. Starting / is optional.**parse_obj_kwargs – Keyword arguments passed to either pydantic’s
parse_obj
function when loading model.
- Returns
An instance of the component class calling load.
- Return type
Tidy3dBaseModel
Example
>>> simulation = Simulation.from_file(fname='folder/sim.json')
- classmethod from_hdf5(fname: str, group_path: str = '', **parse_obj_kwargs) tidy3d.components.base.Tidy3dBaseModel #
Loads
Tidy3dBaseModel
instance to .hdf5 file.- Parameters
fname (str) – Full path to the .hdf5 file to load the
Tidy3dBaseModel
from.group_path (str, optional) – Path to a group inside the file to selectively load a sub-element of the model only. Starting / is optional.
**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
Example
>>> simulation.to_hdf5(fname='folder/sim.hdf5')
- classmethod from_json(fname: str, **parse_obj_kwargs) tidy3d.components.base.Tidy3dBaseModel #
Load a
Tidy3dBaseModel
from .json file.- Parameters
fname (str) – Full path to the .json file to load the
Tidy3dBaseModel
from.- Returns
Tidy3dBaseModel
– An instance of the component class calling load.**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
Example
>>> simulation = Simulation.from_json(fname='folder/sim.json')
- classmethod from_orm(obj: Any) Model #
- classmethod from_yaml(fname: str, **parse_obj_kwargs) tidy3d.components.base.Tidy3dBaseModel #
Loads
Tidy3dBaseModel
from .yaml file.- Parameters
fname (str) – Full path to the .yaml file to load the
Tidy3dBaseModel
from.**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
- Returns
An instance of the component class calling from_yaml.
- Return type
Tidy3dBaseModel
Example
>>> simulation = Simulation.from_yaml(fname='folder/sim.yaml')
- classmethod generate_docstring() str #
Generates a docstring for a Tidy3D mode and saves it to the __doc__ of the class.
- classmethod get_sub_model(group_path: str, model_dict: dict | list) dict #
Get the sub model for a given group path.
- static get_tuple_group_name(index: int) str #
Get the group name of a tuple element.
- static get_tuple_index(key_name: str) int #
Get the index into the tuple based on its group name.
- help(methods: bool = False) None #
Prints message describing the fields and methods of a
Tidy3dBaseModel
.- Parameters
methods (bool = False) – Whether to also print out information about object’s methods.
Example
>>> simulation.help(methods=True)
- json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode #
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model #
- classmethod parse_obj(obj: Any) Model #
- classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model #
- plot(x: float = None, y: float = None, z: float = None, ax: matplotlib.axes._axes.Axes = None, **patch_kwargs) matplotlib.axes._axes.Axes #
Plot structure’s geometric cross section at single (x,y,z) coordinate.
- 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.
ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.
**patch_kwargs – Optional keyword arguments passed to the matplotlib patch plotting of structure. For details on accepted values, refer to Matplotlib’s documentation.
- Returns
The supplied or created matplotlib axes.
- Return type
matplotlib.axes._subplots.Axes
- classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny #
- classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode #
- to_file(fname: str) None #
Exports
Tidy3dBaseModel
instance to .yaml, .json, or .hdf5 file- Parameters
fname (str) – Full path to the .yaml or .json file to save the
Tidy3dBaseModel
to.
Example
>>> simulation.to_file(fname='folder/sim.json')
- to_hdf5(fname: str) None #
Exports
Tidy3dBaseModel
instance to .hdf5 file.- Parameters
fname (str) – Full path to the .hdf5 file to save the
Tidy3dBaseModel
to.
Example
>>> simulation.to_hdf5(fname='folder/sim.hdf5')
- to_json(fname: str) None #
Exports
Tidy3dBaseModel
instance to .json file- Parameters
fname (str) – Full path to the .json file to save the
Tidy3dBaseModel
to.
Example
>>> simulation.to_json(fname='folder/sim.json')
- to_yaml(fname: str) None #
Exports
Tidy3dBaseModel
instance to .yaml file.- Parameters
fname (str) – Full path to the .yaml file to save the
Tidy3dBaseModel
to.
Example
>>> simulation.to_yaml(fname='folder/sim.yaml')
- classmethod tuple_to_dict(tuple_values: tuple) dict #
How we generate a dictionary mapping new keys to tuple values for hdf5.
- classmethod update_forward_refs(**localns: Any) None #
Try to update ForwardRefs on fields based on this Model, globalns and localns.
- updated_copy(**kwargs) tidy3d.components.base.Tidy3dBaseModel #
Make copy of a component instance with
**kwargs
indicating updated field values.
- classmethod validate(value: Any) Model #