tidy3d.AnisotropicMedium
tidy3d.AnisotropicMedium#
- class tidy3d.AnisotropicMedium#
Bases:
tidy3d.components.medium.AbstractMedium
Diagonally anisotropic medium.
- Parameters
name (Optional[str] = None) – Optional unique name for medium.
frequency_range (Optional[Tuple[float, float]] = None) – [units = (Hz, Hz)]. Optional range of validity for the medium.
xx (Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]) – Medium describing the xx-component of the diagonal permittivity tensor.
yy (Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]) – Medium describing the yy-component of the diagonal permittivity tensor.
zz (Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]) – Medium describing the zz-component of the diagonal permittivity tensor.
Note
Only diagonal anisotropy is currently supported.
Example
>>> medium_xx = Medium(permittivity=4.0) >>> medium_yy = Medium(permittivity=4.1) >>> medium_zz = Medium(permittivity=3.9) >>> anisotropic_dielectric = AnisotropicMedium(xx=medium_xx, yy=medium_yy, zz=medium_zz)
Show JSON schema
{ "title": "AnisotropicMedium", "description": "Diagonally anisotropic medium.\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\nxx : Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]\n Medium describing the xx-component of the diagonal permittivity tensor.\nyy : Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]\n Medium describing the yy-component of the diagonal permittivity tensor.\nzz : Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]\n Medium describing the zz-component of the diagonal permittivity tensor.\n\nNote\n----\nOnly diagonal anisotropy is currently supported.\n\nExample\n-------\n>>> medium_xx = Medium(permittivity=4.0)\n>>> medium_yy = Medium(permittivity=4.1)\n>>> medium_zz = Medium(permittivity=3.9)\n>>> anisotropic_dielectric = AnisotropicMedium(xx=medium_xx, yy=medium_yy, zz=medium_zz)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "AnisotropicMedium", "enum": [ "AnisotropicMedium" ], "type": "string" }, "xx": { "title": "XX Component", "description": "Medium describing the xx-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "Medium": "#/definitions/Medium", "PoleResidue": "#/definitions/PoleResidue", "Sellmeier": "#/definitions/Sellmeier", "Lorentz": "#/definitions/Lorentz", "Debye": "#/definitions/Debye", "Drude": "#/definitions/Drude" } }, "oneOf": [ { "$ref": "#/definitions/Medium" }, { "$ref": "#/definitions/PoleResidue" }, { "$ref": "#/definitions/Sellmeier" }, { "$ref": "#/definitions/Lorentz" }, { "$ref": "#/definitions/Debye" }, { "$ref": "#/definitions/Drude" } ] }, "yy": { "title": "YY Component", "description": "Medium describing the yy-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "Medium": "#/definitions/Medium", "PoleResidue": "#/definitions/PoleResidue", "Sellmeier": "#/definitions/Sellmeier", "Lorentz": "#/definitions/Lorentz", "Debye": "#/definitions/Debye", "Drude": "#/definitions/Drude" } }, "oneOf": [ { "$ref": "#/definitions/Medium" }, { "$ref": "#/definitions/PoleResidue" }, { "$ref": "#/definitions/Sellmeier" }, { "$ref": "#/definitions/Lorentz" }, { "$ref": "#/definitions/Debye" }, { "$ref": "#/definitions/Drude" } ] }, "zz": { "title": "ZZ Component", "description": "Medium describing the zz-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "Medium": "#/definitions/Medium", "PoleResidue": "#/definitions/PoleResidue", "Sellmeier": "#/definitions/Sellmeier", "Lorentz": "#/definitions/Lorentz", "Debye": "#/definitions/Debye", "Drude": "#/definitions/Drude" } }, "oneOf": [ { "$ref": "#/definitions/Medium" }, { "$ref": "#/definitions/PoleResidue" }, { "$ref": "#/definitions/Sellmeier" }, { "$ref": "#/definitions/Lorentz" }, { "$ref": "#/definitions/Debye" }, { "$ref": "#/definitions/Drude" } ] } }, "required": [ "xx", "yy", "zz" ], "additionalProperties": false, "definitions": { "Medium": { "title": "Medium", "description": "Dispersionless medium.\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\npermittivity : ConstrainedFloatValue = 1.0\n [units = None (relative permittivity)]. Relative permittivity.\nconductivity : ConstrainedFloatValue = 0.0\n [units = S/um]. Electric conductivity. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.\n\nExample\n-------\n>>> dielectric = Medium(permittivity=4.0, name='my_medium')\n>>> eps = dielectric.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "Medium", "enum": [ "Medium" ], "type": "string" }, "permittivity": { "title": "Permittivity", "description": "Relative permittivity.", "default": 1.0, "minimum": 1.0, "units": "None (relative permittivity)", "type": "number" }, "conductivity": { "title": "Conductivity", "description": "Electric conductivity. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.", "default": 0.0, "minimum": 0.0, "units": "S/um", "type": "number" } }, "additionalProperties": false }, "ComplexNumber": { "title": "ComplexNumber", "description": "Complex number with a well defined schema.", "type": "object", "properties": { "real": { "title": "Real", "type": "number" }, "imag": { "title": "Imag", "type": "number" } }, "required": [ "real", "imag" ] }, "PoleResidue": { "title": "PoleResidue", "description": "A dispersive medium described by the pole-residue pair model.\nThe frequency-dependence of the complex-valued permittivity is described by:\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\neps_inf : float = 1.0\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\npoles : Tuple[Tuple[Union[tidy3d.components.types.tidycomplex, tidy3d.components.types.ComplexNumber], Union[tidy3d.components.types.tidycomplex, tidy3d.components.types.ComplexNumber]], ...] = ()\n [units = (rad/sec, rad/sec)]. Tuple of complex-valued (:math:`a_i, c_i`) poles for the model.\n\nNote\n----\n.. math::\n\n \\epsilon(\\omega) = \\epsilon_\\infty - \\sum_i\n \\left[\\frac{c_i}{j \\omega + a_i} +\n \\frac{c_i^*}{j \\omega + a_i^*}\\right]\n\nExample\n-------\n>>> pole_res = PoleResidue(eps_inf=2.0, poles=[((1+2j), (3+4j)), ((5+6j), (7+8j))])\n>>> eps = pole_res.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "PoleResidue", "enum": [ "PoleResidue" ], "type": "string" }, "eps_inf": { "title": "Epsilon at Infinity", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "default": 1.0, "units": "None (relative permittivity)", "type": "number" }, "poles": { "title": "Poles", "description": "Tuple of complex-valued (:math:`a_i, c_i`) poles for the model.", "default": [], "units": [ "rad/sec", "rad/sec" ], "type": "array", "items": { "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "anyOf": [ { "title": "ComplexNumber", "description": "Complex number with a well defined schema.", "type": "object", "properties": { "real": { "title": "Real", "type": "number" }, "imag": { "title": "Imag", "type": "number" } }, "required": [ "real", "imag" ] }, { "$ref": "#/definitions/ComplexNumber" } ] }, { "anyOf": [ { "title": "ComplexNumber", "description": "Complex number with a well defined schema.", "type": "object", "properties": { "real": { "title": "Real", "type": "number" }, "imag": { "title": "Imag", "type": "number" } }, "required": [ "real", "imag" ] }, { "$ref": "#/definitions/ComplexNumber" } ] } ] } } }, "additionalProperties": false }, "Sellmeier": { "title": "Sellmeier", "description": "A dispersive medium described by the Sellmeier model.\nThe frequency-dependence of the refractive index is described by:\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\ncoeffs : Tuple[Tuple[float, pydantic.types.PositiveFloat], ...]\n [units = (None, um^2)]. List of Sellmeier (:math:`B_i, C_i`) coefficients.\n\nNote\n----\n.. math::\n\n n(\\lambda)^2 = 1 + \\sum_i \\frac{B_i \\lambda^2}{\\lambda^2 - C_i}\n\nExample\n-------\n>>> sellmeier_medium = Sellmeier(coeffs=[(1,2), (3,4)])\n>>> eps = sellmeier_medium.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "Sellmeier", "enum": [ "Sellmeier" ], "type": "string" }, "coeffs": { "title": "Coefficients", "description": "List of Sellmeier (:math:`B_i, C_i`) coefficients.", "units": [ null, "um^2" ], "type": "array", "items": { "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number", "exclusiveMinimum": 0 } ] } } }, "required": [ "coeffs" ], "additionalProperties": false }, "Lorentz": { "title": "Lorentz", "description": "A dispersive medium described by the Lorentz model.\nThe frequency-dependence of the complex-valued permittivity is described by:\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\neps_inf : float = 1.0\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[float, float, float], ...]\n [units = (None (relative permittivity), Hz, Hz)]. List of (:math:`\\Delta\\epsilon_i, f_i, \\delta_i`) values for model.\n\nNote\n----\n.. math::\n\n \\epsilon(f) = \\epsilon_\\infty + \\sum_i\n \\frac{\\Delta\\epsilon_i f_i^2}{f_i^2 - 2jf\\delta_i - f^2}\n\nExample\n-------\n>>> lorentz_medium = Lorentz(eps_inf=2.0, coeffs=[(1,2,3), (4,5,6)])\n>>> eps = lorentz_medium.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "Lorentz", "enum": [ "Lorentz" ], "type": "string" }, "eps_inf": { "title": "Epsilon at Infinity", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "default": 1.0, "units": "None (relative permittivity)", "type": "number" }, "coeffs": { "title": "Coefficients", "description": "List of (:math:`\\Delta\\epsilon_i, f_i, \\delta_i`) values for model.", "units": [ "None (relative permittivity)", "Hz", "Hz" ], "type": "array", "items": { "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" } ] } } }, "required": [ "coeffs" ], "additionalProperties": false }, "Debye": { "title": "Debye", "description": "A dispersive medium described by the Debye model.\nThe frequency-dependence of the complex-valued permittivity is described by:\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\neps_inf : float = 1.0\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[float, pydantic.types.PositiveFloat], ...]\n [units = (None (relative permittivity), sec)]. List of (:math:`\\Delta\\epsilon_i, \\tau_i`) values for model.\n\nNote\n----\n.. math::\n\n \\epsilon(f) = \\epsilon_\\infty + \\sum_i\n \\frac{\\Delta\\epsilon_i}{1 - jf\\tau_i}\n\nExample\n-------\n>>> debye_medium = Debye(eps_inf=2.0, coeffs=[(1,2),(3,4)])\n>>> eps = debye_medium.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "Debye", "enum": [ "Debye" ], "type": "string" }, "eps_inf": { "title": "Epsilon at Infinity", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "default": 1.0, "units": "None (relative permittivity)", "type": "number" }, "coeffs": { "title": "Coefficients", "description": "List of (:math:`\\Delta\\epsilon_i, \\tau_i`) values for model.", "units": [ "None (relative permittivity)", "sec" ], "type": "array", "items": { "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number", "exclusiveMinimum": 0 } ] } } }, "required": [ "coeffs" ], "additionalProperties": false }, "Drude": { "title": "Drude", "description": "A dispersive medium described by the Drude model.\nThe frequency-dependence of the complex-valued permittivity is described by:\n\nParameters\n----------\nname : Optional[str] = None\n Optional unique name for medium.\nfrequency_range : Optional[Tuple[float, float]] = None\n [units = (Hz, Hz)]. Optional range of validity for the medium.\neps_inf : float = 1.0\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[float, pydantic.types.PositiveFloat], ...]\n [units = (Hz, Hz)]. List of (:math:`f_i, \\delta_i`) values for model.\n\nNote\n----\n.. math::\n\n \\epsilon(f) = \\epsilon_\\infty - \\sum_i\n \\frac{ f_i^2}{f^2 + jf\\delta_i}\n\nExample\n-------\n>>> drude_medium = Drude(eps_inf=2.0, coeffs=[(1,2), (3,4)])\n>>> eps = drude_medium.eps_model(200e12)", "type": "object", "properties": { "name": { "title": "Name", "description": "Optional unique name for medium.", "type": "string" }, "frequency_range": { "title": "Frequency Range", "description": "Optional range of validity for the medium.", "units": [ "Hz", "Hz" ], "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number" } ] }, "type": { "title": "Type", "default": "Drude", "enum": [ "Drude" ], "type": "string" }, "eps_inf": { "title": "Epsilon at Infinity", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "default": 1.0, "units": "None (relative permittivity)", "type": "number" }, "coeffs": { "title": "Coefficients", "description": "List of (:math:`f_i, \\delta_i`) values for model.", "units": [ "Hz", "Hz" ], "type": "array", "items": { "type": "array", "minItems": 2, "maxItems": 2, "items": [ { "type": "number" }, { "type": "number", "exclusiveMinimum": 0 } ] } } }, "required": [ "coeffs" ], "additionalProperties": false } } }
- attribute frequency_range: Tuple[float, float] = None#
Optional range of validity for the medium.
- attribute name: str = None#
Optional unique name for medium.
- Validated by
field_has_unique_names
- attribute xx: Union[tidy3d.components.medium.Medium, tidy3d.components.medium.PoleResidue, tidy3d.components.medium.Sellmeier, tidy3d.components.medium.Lorentz, tidy3d.components.medium.Debye, tidy3d.components.medium.Drude] [Required]#
Medium describing the xx-component of the diagonal permittivity tensor.
- attribute yy: Union[tidy3d.components.medium.Medium, tidy3d.components.medium.PoleResidue, tidy3d.components.medium.Sellmeier, tidy3d.components.medium.Lorentz, tidy3d.components.medium.Debye, tidy3d.components.medium.Drude] [Required]#
Medium describing the yy-component of the diagonal permittivity tensor.
- attribute zz: Union[tidy3d.components.medium.Medium, tidy3d.components.medium.PoleResidue, tidy3d.components.medium.Sellmeier, tidy3d.components.medium.Lorentz, tidy3d.components.medium.Debye, tidy3d.components.medium.Drude] [Required]#
Medium describing the zz-component of the diagonal permittivity tensor.
- 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')
- static eps_complex_to_eps_sigma(eps_complex: complex, freq: float) Tuple[float, float] #
Convert complex permittivity at frequency
freq
to permittivity and conductivity values.- Parameters
eps_complex (complex) – Complex-valued relative permittivity.
freq (float) – Frequency to evaluate permittivity at (Hz).
- Returns
Real part of relative permittivity & electric conductivity.
- Return type
Tuple[float, float]
- static eps_complex_to_nk(eps_c: complex) Tuple[float, float] #
Convert complex permittivity to n, k values.
- Parameters
eps_c (complex) – Complex-valued relative permittivity.
- Returns
Real and imaginary parts of refractive index (n & k).
- Return type
Tuple[float, float]
- eps_diagonal(frequency: float) Tuple[complex, complex, complex] #
Main diagonal of the complex-valued permittivity tensor as a function of frequency.
- eps_model(frequency: float) complex #
Complex-valued permittivity as a function of frequency.
- static eps_sigma_to_eps_complex(eps_real: float, sigma: float, freq: float) complex #
convert permittivity and conductivity to complex permittivity at freq
- Parameters
eps_real (float) – Real-valued relative permittivity.
sigma (float) – Conductivity.
freq (float) – Frequency to evaluate permittivity at (Hz). If not supplied, returns real part of permittivity (limit as frequency -> infinity.)
- Returns
Complex-valued relative permittivity.
- Return type
complex
- 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().
- nk_model(frequency: float) Tuple[float, float] #
Real and imaginary parts of the refactive index as a function of frequency.
- Parameters
frequency (float) – Frequency to evaluate permittivity at (Hz).
- Returns
Real part (n) and imaginary part (k) of refractive index of medium.
- Return type
Tuple[float, float]
- static nk_to_eps_complex(n: float, k: float = 0.0) complex #
Convert n, k to complex permittivity.
- Parameters
n (float) – Real part of refractive index.
k (float = 0.0) – Imaginary part of refrative index.
- Returns
Complex-valued relative permittivty.
- Return type
complex
- static nk_to_eps_sigma(n: float, k: float, freq: float) Tuple[float, float] #
Convert
n
,k
at frequencyfreq
to permittivity and conductivity values.- Parameters
n (float) – Real part of refractive index.
k (float = 0.0) – Imaginary part of refrative index.
frequency (float) – Frequency to evaluate permittivity at (Hz).
- Returns
Real part of relative permittivity & electric conductivity.
- Return type
Tuple[float, float]
- 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(freqs: float, ax: matplotlib.axes._axes.Axes = None) matplotlib.axes._axes.Axes #
Plot n, k of a
Medium
as a function of frequency.
- 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 #
- property components: Dict[str, tidy3d.components.medium.Medium]#
Dictionary of diagonal medium components.