tidy3d.FieldProjectionCartesianData
tidy3d.FieldProjectionCartesianData#
- class tidy3d.FieldProjectionCartesianData#
Bases:
tidy3d.components.data.monitor_data.AbstractFieldProjectionData
Data associated with a
FieldProjectionCartesianMonitor
: components of projected fields.- Parameters
monitor (FieldProjectionCartesianMonitor) – Field projection monitor with a Cartesian projection grid.
Er (FieldProjectionCartesianDataArray) – Spatial distribution of r-component of the electric field.
Etheta (FieldProjectionCartesianDataArray) – Spatial distribution of the theta-component of the electric field.
Ephi (FieldProjectionCartesianDataArray) – Spatial distribution of phi-component of the electric field.
Hr (FieldProjectionCartesianDataArray) – Spatial distribution of r-component of the magnetic field.
Htheta (FieldProjectionCartesianDataArray) – Spatial distribution of theta-component of the magnetic field.
Hphi (FieldProjectionCartesianDataArray) – Spatial distribution of phi-component of the magnetic field.
medium (Union[Medium, AnisotropicMedium, PECMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, Medium2D] = Medium(name=None, frequency_range=None, allow_gain=False, type='Medium', permittivity=1.0, conductivity=0.0)) – Background medium through which to project fields.
projection_surfaces (Tuple[FieldProjectionSurface, ...]) – Surfaces of the monitor where near fields were recorded for projection
Example
>>> from tidy3d import FieldProjectionCartesianDataArray >>> f = np.linspace(1e14, 2e14, 10) >>> x = np.linspace(0, 5, 10) >>> y = np.linspace(0, 10, 20) >>> z = np.atleast_1d(5) >>> coords = dict(x=x, y=y, z=z, f=f) >>> values = (1+1j) * np.random.random((len(x), len(y), len(z), len(f))) >>> scalar_field = FieldProjectionCartesianDataArray(values, coords=coords) >>> monitor = FieldProjectionCartesianMonitor( ... center=(1,2,3), size=(2,2,2), freqs=f, name='n2f_monitor', x=x, y=y, ... proj_axis=2, proj_distance=50 ... ) >>> data = FieldProjectionCartesianData( ... monitor=monitor, Er=scalar_field, Etheta=scalar_field, Ephi=scalar_field, ... Hr=scalar_field, Htheta=scalar_field, Hphi=scalar_field, ... projection_surfaces=monitor.projection_surfaces, ... )
Show JSON schema
{ "title": "FieldProjectionCartesianData", "description": "Data associated with a :class:`.FieldProjectionCartesianMonitor`: components of\nprojected fields.\n\nParameters\n----------\nmonitor : FieldProjectionCartesianMonitor\n Field projection monitor with a Cartesian projection grid.\nEr : FieldProjectionCartesianDataArray\n Spatial distribution of r-component of the electric field.\nEtheta : FieldProjectionCartesianDataArray\n Spatial distribution of the theta-component of the electric field.\nEphi : FieldProjectionCartesianDataArray\n Spatial distribution of phi-component of the electric field.\nHr : FieldProjectionCartesianDataArray\n Spatial distribution of r-component of the magnetic field.\nHtheta : FieldProjectionCartesianDataArray\n Spatial distribution of theta-component of the magnetic field.\nHphi : FieldProjectionCartesianDataArray\n Spatial distribution of phi-component of the magnetic field.\nmedium : Union[Medium, AnisotropicMedium, PECMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, Medium2D] = Medium(name=None, frequency_range=None, allow_gain=False, type='Medium', permittivity=1.0, conductivity=0.0)\n Background medium through which to project fields.\nprojection_surfaces : Tuple[FieldProjectionSurface, ...]\n Surfaces of the monitor where near fields were recorded for projection\n\nExample\n-------\n>>> from tidy3d import FieldProjectionCartesianDataArray\n>>> f = np.linspace(1e14, 2e14, 10)\n>>> x = np.linspace(0, 5, 10)\n>>> y = np.linspace(0, 10, 20)\n>>> z = np.atleast_1d(5)\n>>> coords = dict(x=x, y=y, z=z, f=f)\n>>> values = (1+1j) * np.random.random((len(x), len(y), len(z), len(f)))\n>>> scalar_field = FieldProjectionCartesianDataArray(values, coords=coords)\n>>> monitor = FieldProjectionCartesianMonitor(\n... center=(1,2,3), size=(2,2,2), freqs=f, name='n2f_monitor', x=x, y=y,\n... proj_axis=2, proj_distance=50\n... )\n>>> data = FieldProjectionCartesianData(\n... monitor=monitor, Er=scalar_field, Etheta=scalar_field, Ephi=scalar_field,\n... Hr=scalar_field, Htheta=scalar_field, Hphi=scalar_field,\n... projection_surfaces=monitor.projection_surfaces,\n... )", "type": "object", "properties": { "type": { "title": "Type", "default": "FieldProjectionCartesianData", "enum": [ "FieldProjectionCartesianData" ], "type": "string" }, "monitor": { "title": "Projection monitor", "description": "Field projection monitor with a Cartesian projection grid.", "allOf": [ { "$ref": "#/definitions/FieldProjectionCartesianMonitor" } ] }, "Er": { "title": "DataArray", "description": "Spatial distribution of r-component of the electric field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "Etheta": { "title": "DataArray", "description": "Spatial distribution of the theta-component of the electric field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "Ephi": { "title": "DataArray", "description": "Spatial distribution of phi-component of the electric field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "Hr": { "title": "DataArray", "description": "Spatial distribution of r-component of the magnetic field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "Htheta": { "title": "DataArray", "description": "Spatial distribution of theta-component of the magnetic field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "Hphi": { "title": "DataArray", "description": "Spatial distribution of phi-component of the magnetic field.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "medium": { "title": "Background Medium", "description": "Background medium through which to project fields.", "default": { "name": null, "frequency_range": null, "allow_gain": false, "type": "Medium", "permittivity": 1.0, "conductivity": 0.0 }, "anyOf": [ { "$ref": "#/definitions/Medium" }, { "$ref": "#/definitions/AnisotropicMedium" }, { "$ref": "#/definitions/PECMedium" }, { "$ref": "#/definitions/PoleResidue" }, { "$ref": "#/definitions/Sellmeier" }, { "$ref": "#/definitions/Lorentz" }, { "$ref": "#/definitions/Debye" }, { "$ref": "#/definitions/Drude" }, { "$ref": "#/definitions/FullyAnisotropicMedium" }, { "$ref": "#/definitions/CustomMedium" }, { "$ref": "#/definitions/CustomPoleResidue" }, { "$ref": "#/definitions/CustomSellmeier" }, { "$ref": "#/definitions/CustomLorentz" }, { "$ref": "#/definitions/CustomDebye" }, { "$ref": "#/definitions/CustomDrude" }, { "$ref": "#/definitions/CustomAnisotropicMedium" }, { "$ref": "#/definitions/Medium2D" } ] }, "projection_surfaces": { "title": "Projection surfaces", "description": "Surfaces of the monitor where near fields were recorded for projection", "type": "array", "items": { "$ref": "#/definitions/FieldProjectionSurface" } } }, "required": [ "monitor", "Er", "Etheta", "Ephi", "Hr", "Htheta", "Hphi", "projection_surfaces" ], "additionalProperties": false, "definitions": { "ApodizationSpec": { "title": "ApodizationSpec", "description": "Stores specifications for the apodizaton of frequency-domain monitors.\n\nParameters\n----------\nstart : Optional[NonNegativeFloat] = None\n [units = sec]. Defines the time at which the start apodization ends.\nend : Optional[NonNegativeFloat] = None\n [units = sec]. Defines the time at which the end apodization begins.\nwidth : Optional[PositiveFloat] = None\n [units = sec]. Characteristic decay length of the apodization function.\n\nExample\n-------\n>>> apod_spec = ApodizationSpec(start=1, end=2, width=0.5)", "type": "object", "properties": { "start": { "title": "Start Interval", "description": "Defines the time at which the start apodization ends.", "units": "sec", "minimum": 0, "type": "number" }, "end": { "title": "End Interval", "description": "Defines the time at which the end apodization begins.", "units": "sec", "minimum": 0, "type": "number" }, "width": { "title": "Apodization Width", "description": "Characteristic decay length of the apodization function.", "units": "sec", "exclusiveMinimum": 0, "type": "number" }, "type": { "title": "Type", "default": "ApodizationSpec", "enum": [ "ApodizationSpec" ], "type": "string" } }, "additionalProperties": false }, "FieldProjectionCartesianMonitor": { "title": "FieldProjectionCartesianMonitor", "description": ":class:`Monitor` that samples electromagnetic near fields in the frequency domain\nand projects them on a Cartesian observation plane. The ``center`` and ``size`` fields define\nwhere the monitor will be placed in order to record near fields, typically very close\nto the structure of interest. The near fields are then projected\nto far-field locations defined by ``x``, ``y``, and ``proj_distance``, relative\nto the ``custom_origin``. Here, ``x`` and ``y`` correspond to a local coordinate system\nwhere the local z axis is defined by ``proj_axis``: which is the axis normal to this monitor.\nIf the distance between the near and far field locations is much larger than the size of the\ndevice, one can typically set ``far_field_approx`` to ``True``, which will make use of the\nfar-field approximation to speed up calculations. If the projection distance is comparable\nto the size of the device, we recommend setting ``far_field_approx`` to ``False``,\nso that the approximations are not used, and the projection is accurate even just a few\nwavelengths away from the near field locations.\nFor applications where the monitor is an open surface rather than a box that\nencloses the device, it is advisable to pick the size of the monitor such that the\nrecorded near fields decay to negligible values near the edges of the monitor.\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.\nname : ConstrainedStrValue\n Unique name for monitor.\nfreqs : Union[Tuple[float, ...], ArrayLike_dtype=<class 'float'>_ndim=1]\n [units = Hz]. Array or list of frequencies stored by the field monitor.\napodization : ApodizationSpec = ApodizationSpec(start=None, end=None, width=None, type='ApodizationSpec')\n Sets parameters of (optional) apodization. Apodization applies a windowing function to the Fourier transform of the time-domain fields into frequency-domain ones, and can be used to truncate the beginning and/or end of the time signal, for example to eliminate the source pulse when studying the eigenmodes of a system. Note: apodization affects the normalization of the frequency-domain fields.\nnormal_dir : Optional[Literal['+', '-']] = None\n Direction of the surface monitor's normal vector w.r.t. the positive x, y or z unit vectors. Must be one of ``'+'`` or ``'-'``. Applies to surface monitors only, and defaults to ``'+'`` if not provided.\nexclude_surfaces : Optional[Tuple[Literal['x-', 'x+', 'y-', 'y+', 'z-', 'z+'], ...]] = None\n Surfaces to exclude in the integration, if a volume monitor.\ncustom_origin : Optional[Tuple[float, float, float]] = None\n [units = um]. Local origin used for defining observation points. If ``None``, uses the monitor's center.\nfar_field_approx : bool = True\n Whether to enable the far field approximation when projecting fields. If ``True``, terms that decay as O(1/r^2) are ignored, as are the radial components of fields. Typically, this should be set to ``True`` only when the projection distance is much larger than the size of the device being modeled, and the projected points are in the far field of the device.\nproj_axis : Literal[0, 1, 2]\n Axis along which the observation plane is oriented.\nproj_distance : float = 1000000.0\n [units = um]. Signed distance of the projection plane along ``proj_axis``. from the plane containing ``local_origin``.\nx : Union[Tuple[float, ...], ArrayLike_dtype=<class 'float'>_ndim=1]\n [units = um]. Local x observation coordinates w.r.t. ``local_origin`` and ``proj_axis``. When ``proj_axis`` is 0, this corresponds to the global y axis. When ``proj_axis`` is 1, this corresponds to the global x axis. When ``proj_axis`` is 2, this corresponds to the global x axis. \ny : Union[Tuple[float, ...], ArrayLike_dtype=<class 'float'>_ndim=1]\n [units = um]. Local y observation coordinates w.r.t. ``local_origin`` and ``proj_axis``. When ``proj_axis`` is 0, this corresponds to the global z axis. When ``proj_axis`` is 1, this corresponds to the global z axis. When ``proj_axis`` is 2, this corresponds to the global y axis. \n\nExample\n-------\n>>> monitor = FieldProjectionCartesianMonitor(\n... center=(1,2,3),\n... size=(2,2,2),\n... freqs=[250e12, 300e12],\n... name='n2f_monitor',\n... custom_origin=(1,2,3),\n... x=[-1, 0, 1],\n... y=[-2, -1, 0, 1, 2],\n... proj_axis=2,\n... proj_distance=5\n... )", "type": "object", "properties": { "type": { "title": "Type", "default": "FieldProjectionCartesianMonitor", "enum": [ "FieldProjectionCartesianMonitor" ], "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 } ] }, "name": { "title": "Name", "description": "Unique name for monitor.", "minLength": 1, "type": "string" }, "freqs": { "title": "Frequencies", "description": "Array or list of frequencies stored by the field monitor.", "units": "Hz", "anyOf": [ { "type": "array", "items": { "type": "number" } }, { "type": "ArrayLike" } ] }, "apodization": { "title": "Apodization Specification", "description": "Sets parameters of (optional) apodization. Apodization applies a windowing function to the Fourier transform of the time-domain fields into frequency-domain ones, and can be used to truncate the beginning and/or end of the time signal, for example to eliminate the source pulse when studying the eigenmodes of a system. Note: apodization affects the normalization of the frequency-domain fields.", "default": { "start": null, "end": null, "width": null, "type": "ApodizationSpec" }, "allOf": [ { "$ref": "#/definitions/ApodizationSpec" } ] }, "normal_dir": { "title": "Normal vector orientation", "description": "Direction of the surface monitor's normal vector w.r.t. the positive x, y or z unit vectors. Must be one of ``'+'`` or ``'-'``. Applies to surface monitors only, and defaults to ``'+'`` if not provided.", "enum": [ "+", "-" ], "type": "string" }, "exclude_surfaces": { "title": "Excluded surfaces", "description": "Surfaces to exclude in the integration, if a volume monitor.", "type": "array", "items": { "enum": [ "x-", "x+", "y-", "y+", "z-", "z+" ], "type": "string" } }, "custom_origin": { "title": "Local origin", "description": "Local origin used for defining observation points. If ``None``, uses the monitor's center.", "units": "um", "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "number" }, { "type": "number" }, { "type": "number" } ] }, "far_field_approx": { "title": "Far field approximation", "description": "Whether to enable the far field approximation when projecting fields. If ``True``, terms that decay as O(1/r^2) are ignored, as are the radial components of fields. Typically, this should be set to ``True`` only when the projection distance is much larger than the size of the device being modeled, and the projected points are in the far field of the device.", "default": true, "type": "boolean" }, "proj_axis": { "title": "Projection plane axis", "description": "Axis along which the observation plane is oriented.", "enum": [ 0, 1, 2 ], "type": "integer" }, "proj_distance": { "title": "Projection distance", "description": "Signed distance of the projection plane along ``proj_axis``. from the plane containing ``local_origin``.", "default": 1000000.0, "units": "um", "type": "number" }, "x": { "title": "Local x observation coordinates", "description": "Local x observation coordinates w.r.t. ``local_origin`` and ``proj_axis``. When ``proj_axis`` is 0, this corresponds to the global y axis. When ``proj_axis`` is 1, this corresponds to the global x axis. When ``proj_axis`` is 2, this corresponds to the global x axis. ", "units": "um", "anyOf": [ { "type": "array", "items": { "type": "number" } }, { "type": "ArrayLike" } ] }, "y": { "title": "Local y observation coordinates", "description": "Local y observation coordinates w.r.t. ``local_origin`` and ``proj_axis``. When ``proj_axis`` is 0, this corresponds to the global z axis. When ``proj_axis`` is 1, this corresponds to the global z axis. When ``proj_axis`` is 2, this corresponds to the global y axis. ", "units": "um", "anyOf": [ { "type": "array", "items": { "type": "number" } }, { "type": "ArrayLike" } ] } }, "required": [ "size", "name", "freqs", "proj_axis", "x", "y" ], "additionalProperties": false }, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\npermittivity : ConstrainedFloatValue = 1.0\n [units = None (relative permittivity)]. Relative permittivity.\nconductivity : float = 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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : PositiveFloat = 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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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)", "exclusiveMinimum": 0, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : PositiveFloat = 1.0\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[float, float, pydantic.types.NonNegativeFloat], ...]\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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)", "exclusiveMinimum": 0, "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", "minimum": 0 } ] } } }, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : PositiveFloat = 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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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)", "exclusiveMinimum": 0, "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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : PositiveFloat = 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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "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)", "exclusiveMinimum": 0, "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 }, "AnisotropicMedium": { "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.\nallow_gain : Optional[bool] = None\n This field is ignored. Please set ``allow_gain`` in each component\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "This field is ignored. Please set ``allow_gain`` in each component", "type": "boolean" }, "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 }, "PECMedium": { "title": "PECMedium", "description": "Perfect electrical conductor class.\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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\n\nNote\n----\nTo avoid confusion from duplicate PECs, must import ``tidy3d.PEC`` instance directly.", "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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "PECMedium", "enum": [ "PECMedium" ], "type": "string" } }, "additionalProperties": false }, "FullyAnisotropicMedium": { "title": "FullyAnisotropicMedium", "description": "Fully anisotropic medium including all 9 components of the permittivity and conductivity\ntensors. Provided permittivity tensor and the symmetric part of the conductivity tensor must\nhave coinciding main directions. A non-symmetric conductivity tensor can be used to model\nmagneto-optic effects. Note that dispersive properties and subpixel averaging are currently not\nsupported for fully anisotropic materials.\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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\npermittivity : ArrayLike_dtype=<class 'float'>_ndim=2_shape=(3, 3) = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\n [units = None (relative permittivity)]. Relative permittivity tensor.\nconductivity : ArrayLike_dtype=<class 'float'>_ndim=2_shape=(3, 3) = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n [units = S/um]. Electric conductivity tensor. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.\n\nNote\n----\nSimulations involving fully anisotropic materials are computationally more intensive, thus,\nthey take longer time to complete. This increase strongly depends on the filling fraction of\nthe simulation domain by fully anisotropic materials, varying approximately in the range from\n1.5 to 5. Cost of running a simulation is adjusted correspondingly.\n\nExample\n-------\n>>> perm = [[2, 0, 0], [0, 1, 0], [0, 0, 3]]\n>>> cond = [[0.1, 0, 0], [0, 0, 0], [0, 0, 0]]\n>>> anisotropic_dielectric = FullyAnisotropicMedium(permittivity=perm, conductivity=cond)", "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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "FullyAnisotropicMedium", "enum": [ "FullyAnisotropicMedium" ], "type": "string" }, "permittivity": { "title": "Permittivity", "description": "Relative permittivity tensor.", "default": [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ], "units": "None (relative permittivity)", "type": "ArrayLike" }, "conductivity": { "title": "Conductivity", "description": "Electric conductivity tensor. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.", "default": [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ], "units": "S/um", "type": "ArrayLike" } }, "additionalProperties": false }, "PermittivityDataset": { "title": "PermittivityDataset", "description": "Dataset storing the diagonal components of the permittivity tensor.\n\nParameters\n----------\neps_xx : ScalarFieldDataArray\n Spatial distribution of the xx-component of the relative permittivity.\neps_yy : ScalarFieldDataArray\n Spatial distribution of the yy-component of the relative permittivity.\neps_zz : ScalarFieldDataArray\n Spatial distribution of the zz-component of the relative permittivity.\n\nExample\n-------\n>>> x = [-1,1]\n>>> y = [-2,0,2]\n>>> z = [-3,-1,1,3]\n>>> f = [2e14, 3e14]\n>>> coords = dict(x=x, y=y, z=z, f=f)\n>>> sclr_fld = ScalarFieldDataArray((1+1j) * np.random.random((2,3,4,2)), coords=coords)\n>>> data = PermittivityDataset(eps_xx=sclr_fld, eps_yy=sclr_fld, eps_zz=sclr_fld)", "type": "object", "properties": { "type": { "title": "Type", "default": "PermittivityDataset", "enum": [ "PermittivityDataset" ], "type": "string" }, "eps_xx": { "title": "DataArray", "description": "Spatial distribution of the xx-component of the relative permittivity.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "eps_yy": { "title": "DataArray", "description": "Spatial distribution of the yy-component of the relative permittivity.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "eps_zz": { "title": "DataArray", "description": "Spatial distribution of the zz-component of the relative permittivity.", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } }, "required": [ "eps_xx", "eps_yy", "eps_zz" ], "additionalProperties": false }, "CustomMedium": { "title": "CustomMedium", "description": ":class:`.Medium` with user-supplied permittivity distribution.\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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\npermittivity : Optional[SpatialDataArray] = None\n [units = None (relative permittivity)]. Spatial profile of relative permittivity.\nconductivity : Optional[SpatialDataArray] = None\n [units = S/um]. Spatial profile Electric conductivity. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.\neps_dataset : Optional[PermittivityDataset] = None\n [To be deprecated] User-supplied dataset containing complex-valued permittivity as a function of space. Permittivity distribution over the Yee-grid will be interpolated based on ``interp_method``.\n\nExample\n-------\n>>> Nx, Ny, Nz = 10, 9, 8\n>>> X = np.linspace(-1, 1, Nx)\n>>> Y = np.linspace(-1, 1, Ny)\n>>> Z = np.linspace(-1, 1, Nz)\n>>> coords = dict(x=X, y=Y, z=Z)\n>>> permittivity= SpatialDataArray(np.ones((Nx, Ny, Nz)), coords=coords)\n>>> conductivity= SpatialDataArray(np.ones((Nx, Ny, Nz)), coords=coords)\n>>> dielectric = CustomMedium(permittivity=permittivity, conductivity=conductivity)\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomMedium", "enum": [ "CustomMedium" ], "type": "string" }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" }, "permittivity": { "title": "DataArray", "description": "Spatial profile of relative permittivity.", "units": "None (relative permittivity)", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "conductivity": { "title": "DataArray", "description": "Spatial profile Electric conductivity. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.", "units": "S/um", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "eps_dataset": { "title": "Permittivity Dataset", "description": "[To be deprecated] User-supplied dataset containing complex-valued permittivity as a function of space. Permittivity distribution over the Yee-grid will be interpolated based on ``interp_method``.", "allOf": [ { "$ref": "#/definitions/PermittivityDataset" } ] } }, "additionalProperties": false }, "CustomPoleResidue": { "title": "CustomPoleResidue", "description": "A spatially varying 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : SpatialDataArray\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\npoles : Tuple[Tuple[tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray], ...] = ()\n [units = (rad/sec, rad/sec)]. Tuple of complex-valued (:math:`a_i, c_i`) poles for the model.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\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>>> x = np.linspace(-1, 1, 5)\n>>> y = np.linspace(-1, 1, 6)\n>>> z = np.linspace(-1, 1, 7)\n>>> coords = dict(x=x, y=y, z=z)\n>>> eps_inf = SpatialDataArray(np.ones((5, 6, 7)), coords=coords)\n>>> a1 = SpatialDataArray(-np.random.random((5, 6, 7)), coords=coords)\n>>> c1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> a2 = SpatialDataArray(-np.random.random((5, 6, 7)), coords=coords)\n>>> c2 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> pole_res = CustomPoleResidue(eps_inf=eps_inf, poles=[(a1, c1), (a2, c2)])\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomPoleResidue", "enum": [ "CustomPoleResidue" ], "type": "string" }, "eps_inf": { "title": "DataArray", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "units": "None (relative permittivity)", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "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": [ { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } ] } }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" } }, "required": [ "eps_inf" ], "additionalProperties": false }, "CustomSellmeier": { "title": "CustomSellmeier", "description": "A spatially varying 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\ncoeffs : Tuple[Tuple[tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray], ...]\n [units = (None, um^2)]. List of Sellmeier (:math:`B_i, C_i`) coefficients.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\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>>> x = np.linspace(-1, 1, 5)\n>>> y = np.linspace(-1, 1, 6)\n>>> z = np.linspace(-1, 1, 7)\n>>> coords = dict(x=x, y=y, z=z)\n>>> b1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> c1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> sellmeier_medium = CustomSellmeier(coeffs=[(b1,c1),])\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomSellmeier", "enum": [ "CustomSellmeier" ], "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": [ { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } ] } }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" } }, "required": [ "coeffs" ], "additionalProperties": false }, "CustomLorentz": { "title": "CustomLorentz", "description": "A spatially varying 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : SpatialDataArray\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray], ...]\n [units = (None (relative permittivity), Hz, Hz)]. List of (:math:`\\Delta\\epsilon_i, f_i, \\delta_i`) values for model.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\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>>> x = np.linspace(-1, 1, 5)\n>>> y = np.linspace(-1, 1, 6)\n>>> z = np.linspace(-1, 1, 7)\n>>> coords = dict(x=x, y=y, z=z)\n>>> eps_inf = SpatialDataArray(np.ones((5, 6, 7)), coords=coords)\n>>> d_epsilon = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> f = SpatialDataArray(1+np.random.random((5, 6, 7)), coords=coords)\n>>> delta = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> lorentz_medium = CustomLorentz(eps_inf=eps_inf, coeffs=[(d_epsilon,f,delta),])\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomLorentz", "enum": [ "CustomLorentz" ], "type": "string" }, "eps_inf": { "title": "DataArray", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "units": "None (relative permittivity)", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "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": [ { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } ] } }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" } }, "required": [ "eps_inf", "coeffs" ], "additionalProperties": false }, "CustomDebye": { "title": "CustomDebye", "description": "A spatially varying 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : SpatialDataArray\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray], ...]\n [units = (None (relative permittivity), sec)]. List of (:math:`\\Delta\\epsilon_i, \\tau_i`) values for model.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\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>>> x = np.linspace(-1, 1, 5)\n>>> y = np.linspace(-1, 1, 6)\n>>> z = np.linspace(-1, 1, 7)\n>>> coords = dict(x=x, y=y, z=z)\n>>> eps_inf = SpatialDataArray(1+np.random.random((5, 6, 7)), coords=coords)\n>>> eps1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> tau1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> debye_medium = CustomDebye(eps_inf=eps_inf, coeffs=[(eps1,tau1),])\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomDebye", "enum": [ "CustomDebye" ], "type": "string" }, "eps_inf": { "title": "DataArray", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "units": "None (relative permittivity)", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "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": [ { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } ] } }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" } }, "required": [ "eps_inf", "coeffs" ], "additionalProperties": false }, "CustomDrude": { "title": "CustomDrude", "description": "A spatially varying 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\neps_inf : SpatialDataArray\n [units = None (relative permittivity)]. Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).\ncoeffs : Tuple[Tuple[tidy3d.components.data.data_array.SpatialDataArray, tidy3d.components.data.data_array.SpatialDataArray], ...]\n [units = (Hz, Hz)]. List of (:math:`f_i, \\delta_i`) values for model.\ninterp_method : Literal['nearest', 'linear'] = nearest\n Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.\nsubpixel : bool = False\n If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.\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>>> x = np.linspace(-1, 1, 5)\n>>> y = np.linspace(-1, 1, 6)\n>>> z = np.linspace(-1, 1, 7)\n>>> coords = dict(x=x, y=y, z=z)\n>>> eps_inf = SpatialDataArray(np.ones((5, 6, 7)), coords=coords)\n>>> f1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> delta1 = SpatialDataArray(np.random.random((5, 6, 7)), coords=coords)\n>>> drude_medium = CustomDrude(eps_inf=eps_inf, coeffs=[(f1,delta1),])\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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "CustomDrude", "enum": [ "CustomDrude" ], "type": "string" }, "eps_inf": { "title": "DataArray", "description": "Relative permittivity at infinite frequency (:math:`\\epsilon_\\infty`).", "units": "None (relative permittivity)", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, "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": [ { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] }, { "title": "DataArray", "type": "xr.DataArray", "properties": { "_dims": { "title": "_dims", "type": "Tuple[str, ...]" } }, "required": [ "_dims" ] } ] } }, "interp_method": { "title": "Interpolation method", "description": "Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.", "default": "nearest", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "If ``True`` and simulation's ``subpixel`` is also ``True``, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.", "default": false, "type": "boolean" } }, "required": [ "eps_inf", "coeffs" ], "additionalProperties": false }, "CustomAnisotropicMedium": { "title": "CustomAnisotropicMedium", "description": "Diagonally anisotropic medium with spatially varying permittivity in each component.\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.\nallow_gain : Optional[bool] = None\n This field is ignored. Please set ``allow_gain`` in each component\nxx : Union[CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomMedium]\n Medium describing the xx-component of the diagonal permittivity tensor.\nyy : Union[CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomMedium]\n Medium describing the yy-component of the diagonal permittivity tensor.\nzz : Union[CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomMedium]\n Medium describing the zz-component of the diagonal permittivity tensor.\ninterp_method : Optional[Literal['nearest', 'linear']] = None\n When the value is 'None', each component will follow its own interpolation method. When the value is other than 'None', the interpolation method specified by this field will override the one in each component.\nsubpixel : Optional[bool] = None\n This field is ignored. Please set ``subpixel`` in each component\n\nNote\n----\nOnly diagonal anisotropy is currently supported.\n\nExample\n-------\n>>> Nx, Ny, Nz = 10, 9, 8\n>>> x = np.linspace(-1, 1, Nx)\n>>> y = np.linspace(-1, 1, Ny)\n>>> z = np.linspace(-1, 1, Nz)\n>>> coords = dict(x=x, y=y, z=z)\n>>> permittivity= SpatialDataArray(np.ones((Nx, Ny, Nz)), coords=coords)\n>>> conductivity= SpatialDataArray(np.ones((Nx, Ny, Nz)), coords=coords)\n>>> medium_xx = CustomMedium(permittivity=permittivity, conductivity=conductivity)\n>>> medium_yy = CustomMedium(permittivity=permittivity, conductivity=conductivity)\n>>> d_epsilon = SpatialDataArray(np.random.random((Nx, Ny, Nz)), coords=coords)\n>>> f = SpatialDataArray(1+np.random.random((Nx, Ny, Nz)), coords=coords)\n>>> delta = SpatialDataArray(np.random.random((Nx, Ny, Nz)), coords=coords)\n>>> medium_zz = CustomLorentz(eps_inf=permittivity, coeffs=[(d_epsilon,f,delta),])\n>>> anisotropic_dielectric = CustomAnisotropicMedium(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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "This field is ignored. Please set ``allow_gain`` in each component", "type": "boolean" }, "type": { "title": "Type", "default": "CustomAnisotropicMedium", "enum": [ "CustomAnisotropicMedium" ], "type": "string" }, "xx": { "title": "XX Component", "description": "Medium describing the xx-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "CustomPoleResidue": "#/definitions/CustomPoleResidue", "CustomSellmeier": "#/definitions/CustomSellmeier", "CustomLorentz": "#/definitions/CustomLorentz", "CustomDebye": "#/definitions/CustomDebye", "CustomDrude": "#/definitions/CustomDrude", "CustomMedium": "#/definitions/CustomMedium" } }, "oneOf": [ { "$ref": "#/definitions/CustomPoleResidue" }, { "$ref": "#/definitions/CustomSellmeier" }, { "$ref": "#/definitions/CustomLorentz" }, { "$ref": "#/definitions/CustomDebye" }, { "$ref": "#/definitions/CustomDrude" }, { "$ref": "#/definitions/CustomMedium" } ] }, "yy": { "title": "YY Component", "description": "Medium describing the yy-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "CustomPoleResidue": "#/definitions/CustomPoleResidue", "CustomSellmeier": "#/definitions/CustomSellmeier", "CustomLorentz": "#/definitions/CustomLorentz", "CustomDebye": "#/definitions/CustomDebye", "CustomDrude": "#/definitions/CustomDrude", "CustomMedium": "#/definitions/CustomMedium" } }, "oneOf": [ { "$ref": "#/definitions/CustomPoleResidue" }, { "$ref": "#/definitions/CustomSellmeier" }, { "$ref": "#/definitions/CustomLorentz" }, { "$ref": "#/definitions/CustomDebye" }, { "$ref": "#/definitions/CustomDrude" }, { "$ref": "#/definitions/CustomMedium" } ] }, "zz": { "title": "ZZ Component", "description": "Medium describing the zz-component of the diagonal permittivity tensor.", "discriminator": { "propertyName": "type", "mapping": { "CustomPoleResidue": "#/definitions/CustomPoleResidue", "CustomSellmeier": "#/definitions/CustomSellmeier", "CustomLorentz": "#/definitions/CustomLorentz", "CustomDebye": "#/definitions/CustomDebye", "CustomDrude": "#/definitions/CustomDrude", "CustomMedium": "#/definitions/CustomMedium" } }, "oneOf": [ { "$ref": "#/definitions/CustomPoleResidue" }, { "$ref": "#/definitions/CustomSellmeier" }, { "$ref": "#/definitions/CustomLorentz" }, { "$ref": "#/definitions/CustomDebye" }, { "$ref": "#/definitions/CustomDrude" }, { "$ref": "#/definitions/CustomMedium" } ] }, "interp_method": { "title": "Interpolation method", "description": "When the value is 'None', each component will follow its own interpolation method. When the value is other than 'None', the interpolation method specified by this field will override the one in each component.", "enum": [ "nearest", "linear" ], "type": "string" }, "subpixel": { "title": "Subpixel averaging", "description": "This field is ignored. Please set ``subpixel`` in each component", "type": "boolean" } }, "required": [ "xx", "yy", "zz" ], "additionalProperties": false }, "Medium2D": { "title": "Medium2D", "description": "2D 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.\nallow_gain : bool = False\n Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.\nss : Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]\n Medium describing the ss-component of the diagonal permittivity tensor. The ss-component refers to the in-plane dimension of the medium that is the first component in order of 'x', 'y', 'z'. If the 2D material is normal to the y-axis, for example, then this determines the xx-component of the corresponding 3D medium.\ntt : Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude]\n Medium describing the tt-component of the diagonal permittivity tensor. The tt-component refers to the in-plane dimension of the medium that is the second component in order of 'x', 'y', 'z'. If the 2D material is normal to the y-axis, for example, then this determines the zz-component of the corresponding 3D medium.\n\nNote\n----\nOnly diagonal anisotropy is currently supported.\n\nExample\n-------\n>>> drude_medium = Drude(eps_inf=2.0, coeffs=[(1,2), (3,4)])\n>>> medium2d = Medium2D(ss=drude_medium, tt=drude_medium)", "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" } ] }, "allow_gain": { "title": "Allow gain medium", "description": "Allow the medium to be active. Caution: simulations with gain medium are unstable, and are likely to diverge.Simulations where 'allow_gain' is set to 'True' will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.", "default": false, "type": "boolean" }, "type": { "title": "Type", "default": "Medium2D", "enum": [ "Medium2D" ], "type": "string" }, "ss": { "title": "SS Component", "description": "Medium describing the ss-component of the diagonal permittivity tensor. The ss-component refers to the in-plane dimension of the medium that is the first component in order of 'x', 'y', 'z'. If the 2D material is normal to the y-axis, for example, then this determines the xx-component of the corresponding 3D medium.", "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" } ] }, "tt": { "title": "TT Component", "description": "Medium describing the tt-component of the diagonal permittivity tensor. The tt-component refers to the in-plane dimension of the medium that is the second component in order of 'x', 'y', 'z'. If the 2D material is normal to the y-axis, for example, then this determines the zz-component of the corresponding 3D medium.", "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": [ "ss", "tt" ], "additionalProperties": false }, "FieldMonitor": { "title": "FieldMonitor", "description": ":class:`Monitor` that records electromagnetic fields in the frequency domain.\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.\nname : ConstrainedStrValue\n Unique name for monitor.\nfreqs : Union[Tuple[float, ...], ArrayLike_dtype=<class 'float'>_ndim=1]\n [units = Hz]. Array or list of frequencies stored by the field monitor.\napodization : ApodizationSpec = ApodizationSpec(start=None, end=None, width=None, type='ApodizationSpec')\n Sets parameters of (optional) apodization. Apodization applies a windowing function to the Fourier transform of the time-domain fields into frequency-domain ones, and can be used to truncate the beginning and/or end of the time signal, for example to eliminate the source pulse when studying the eigenmodes of a system. Note: apodization affects the normalization of the frequency-domain fields.\nfields : Tuple[Literal['Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz'], ...] = ['Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz']\n Collection of field components to store in the monitor.\ninterval_space : Tuple[PositiveInt, PositiveInt, PositiveInt] = (1, 1, 1)\n Number of grid step intervals between monitor recordings. If equal to 1, there will be no downsampling. If greater than 1, fields will be downsampled and automatically colocated.\ncolocate : Optional[bool] = None\n Toggle whether fields should be colocated to grid cell centers. Default: ``False`` if ``interval_space`` is 1 in each direction, ``True`` if ``interval_space`` is greater than one in any direction.\n\nExample\n-------\n>>> monitor = FieldMonitor(\n... center=(1,2,3),\n... size=(2,2,2),\n... fields=['Hx'],\n... freqs=[250e12, 300e12],\n... name='steady_state_monitor')", "type": "object", "properties": { "type": { "title": "Type", "default": "FieldMonitor", "enum": [ "FieldMonitor" ], "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 } ] }, "name": { "title": "Name", "description": "Unique name for monitor.", "minLength": 1, "type": "string" }, "freqs": { "title": "Frequencies", "description": "Array or list of frequencies stored by the field monitor.", "units": "Hz", "anyOf": [ { "type": "array", "items": { "type": "number" } }, { "type": "ArrayLike" } ] }, "apodization": { "title": "Apodization Specification", "description": "Sets parameters of (optional) apodization. Apodization applies a windowing function to the Fourier transform of the time-domain fields into frequency-domain ones, and can be used to truncate the beginning and/or end of the time signal, for example to eliminate the source pulse when studying the eigenmodes of a system. Note: apodization affects the normalization of the frequency-domain fields.", "default": { "start": null, "end": null, "width": null, "type": "ApodizationSpec" }, "allOf": [ { "$ref": "#/definitions/ApodizationSpec" } ] }, "fields": { "title": "Field Components", "description": "Collection of field components to store in the monitor.", "default": [ "Ex", "Ey", "Ez", "Hx", "Hy", "Hz" ], "type": "array", "items": { "enum": [ "Ex", "Ey", "Ez", "Hx", "Hy", "Hz" ], "type": "string" } }, "interval_space": { "title": "Spatial interval", "description": "Number of grid step intervals between monitor recordings. If equal to 1, there will be no downsampling. If greater than 1, fields will be downsampled and automatically colocated.", "default": [ 1, 1, 1 ], "type": "array", "minItems": 3, "maxItems": 3, "items": [ { "type": "integer", "exclusiveMinimum": 0 }, { "type": "integer", "exclusiveMinimum": 0 }, { "type": "integer", "exclusiveMinimum": 0 } ] }, "colocate": { "title": "Colocate fields", "description": "Toggle whether fields should be colocated to grid cell centers. Default: ``False`` if ``interval_space`` is 1 in each direction, ``True`` if ``interval_space`` is greater than one in any direction.", "type": "boolean" } }, "required": [ "size", "name", "freqs" ], "additionalProperties": false }, "FieldProjectionSurface": { "title": "FieldProjectionSurface", "description": "Data structure to store surface monitors where near fields are recorded for\nfield projections.\n\nParameters\n----------\nmonitor : FieldMonitor\n :class:`.FieldMonitor` on which near fields will be sampled and integrated.\nnormal_dir : Literal['+', '-']\n :class:`.Direction` of the surface monitor's normal vector w.r.t. the positive x, y or z unit vectors. Must be one of '+' or '-'.", "type": "object", "properties": { "monitor": { "title": "Field monitor", "description": ":class:`.FieldMonitor` on which near fields will be sampled and integrated.", "allOf": [ { "$ref": "#/definitions/FieldMonitor" } ] }, "normal_dir": { "title": "Normal vector orientation", "description": ":class:`.Direction` of the surface monitor's normal vector w.r.t. the positive x, y or z unit vectors. Must be one of '+' or '-'.", "enum": [ "+", "-" ], "type": "string" }, "type": { "title": "Type", "default": "FieldProjectionSurface", "enum": [ "FieldProjectionSurface" ], "type": "string" } }, "required": [ "monitor", "normal_dir" ], "additionalProperties": false } } }
- attribute Ephi: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of phi-component of the electric field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute Er: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of r-component of the electric field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute Etheta: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of the theta-component of the electric field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute Hphi: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of phi-component of the magnetic field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute Hr: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of r-component of the magnetic field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute Htheta: tidy3d.components.data.data_array.FieldProjectionCartesianDataArray [Required]#
Spatial distribution of theta-component of the magnetic field.
- Constraints
title = DataArray
type = xr.DataArray
properties = {‘_dims’: {‘title’: ‘_dims’, ‘type’: ‘Tuple[str, …]’}}
required = [‘_dims’]
- attribute medium: Union[tidy3d.components.medium.Medium, tidy3d.components.medium.AnisotropicMedium, tidy3d.components.medium.PECMedium, tidy3d.components.medium.PoleResidue, tidy3d.components.medium.Sellmeier, tidy3d.components.medium.Lorentz, tidy3d.components.medium.Debye, tidy3d.components.medium.Drude, tidy3d.components.medium.FullyAnisotropicMedium, tidy3d.components.medium.CustomMedium, tidy3d.components.medium.CustomPoleResidue, tidy3d.components.medium.CustomSellmeier, tidy3d.components.medium.CustomLorentz, tidy3d.components.medium.CustomDebye, tidy3d.components.medium.CustomDrude, tidy3d.components.medium.CustomAnisotropicMedium, tidy3d.components.medium.Medium2D] = Medium(name=None, frequency_range=None, allow_gain=False, type='Medium', permittivity=1.0, conductivity=0.0)#
Background medium through which to project fields.
- attribute monitor: tidy3d.components.monitor.FieldProjectionCartesianMonitor [Required]#
Field projection monitor with a Cartesian projection grid.
- attribute projection_surfaces: Tuple[tidy3d.components.monitor.FieldProjectionSurface, ...] [Required]#
Surfaces of the monitor where near fields were recorded for projection
- 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 = '', custom_decoders: Optional[List[Callable]] = None) 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.
custom_decoders (List[Callable]) – List of functions accepting (fname: str, group_path: str, model_dict: dict, key: str, value: Any) that store the value in the model dict after a custom decoding.
- 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 = '', custom_decoders: Optional[List[Callable]] = None, **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.
custom_decoders (List[Callable]) – List of functions accepting (fname: str, group_path: str, model_dict: dict, key: str, value: Any) that store the value in the model dict after a custom decoding.
**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
Example
>>> simulation = Simulation.from_file(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.
- get_submodels_by_hash() Dict[int, List[Union[str, Tuple[str, int]]]] #
Return a dictionary of this object’s sub-models indexed by their hash values.
- 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().
- make_data_array(data: numpy.ndarray) xarray.core.dataarray.DataArray #
Make an xr.DataArray with data and same coords and dims as fields of self.
- make_dataset(keys: Tuple[str, ...], vals: Tuple[numpy.ndarray, ...]) xarray.core.dataset.Dataset #
Make an xr.Dataset with keys and data with same coords and dims as fields.
- make_renormalized_data(phase: numpy.ndarray, proj_distance: float) tidy3d.components.data.monitor_data.AbstractFieldProjectionData #
Helper to apply the re-projection phase to a copied dataset.
- normalize(source_spectrum_fn: Callable[[float], complex]) tidy3d.components.data.monitor_data.AbstractFieldProjectionData #
Return copy of self after normalization is applied using source spectrum function.
- 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 #
- static propagation_phase(dist: Optional[float], k: complex) complex #
Phase associated with propagation of a distance with a given wavenumber.
- renormalize_fields(proj_distance: float) tidy3d.components.data.monitor_data.FieldProjectionCartesianData #
Return a
FieldProjectionCartesianData
with fields re-normalized to a new projection distance, by applying a phase factor based onproj_distance
.- Parameters
proj_distance (float = None) – (micron) new plane distance relative to the monitor’s local origin.
- Returns
Copy of this
FieldProjectionCartesianData
with fields re-projected toproj_distance
.- Return type
- 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, custom_encoders: Optional[List[Callable]] = None) None #
Exports
Tidy3dBaseModel
instance to .hdf5 file.- Parameters
fname (str) – Full path to the .hdf5 file to save the
Tidy3dBaseModel
to.custom_encoders (List[Callable]) – List of functions accepting (fname: str, group_path: str, value: Any) that take the
value
supplied and write it to the hdf5fname
atgroup_path
.
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 #
- static wavenumber(medium: Union[tidy3d.components.medium.Medium, tidy3d.components.medium.AnisotropicMedium, tidy3d.components.medium.PECMedium, tidy3d.components.medium.PoleResidue, tidy3d.components.medium.Sellmeier, tidy3d.components.medium.Lorentz, tidy3d.components.medium.Debye, tidy3d.components.medium.Drude, tidy3d.components.medium.FullyAnisotropicMedium, tidy3d.components.medium.CustomMedium, tidy3d.components.medium.CustomPoleResidue, tidy3d.components.medium.CustomSellmeier, tidy3d.components.medium.CustomLorentz, tidy3d.components.medium.CustomDebye, tidy3d.components.medium.CustomDrude, tidy3d.components.medium.CustomAnisotropicMedium, tidy3d.components.medium.Medium2D], frequency: float) complex #
Complex valued wavenumber associated with a frequency.
- property coords: Dict[str, numpy.ndarray]#
Coordinates of the fields contained.
- property coords_spherical: Dict[str, numpy.ndarray]#
Coordinates grid for the fields in the spherical system.
- property dims: Tuple[str, ...]#
Dimensions of the radiation vectors contained.
- property eta: complex#
Returns the complex wave impedance associated with the background medium.
- property f: numpy.ndarray#
Frequencies.
- property field_components: Dict[str, tidy3d.components.data.data_array.DataArray]#
Maps the field components to their associated data.
- property fields_cartesian: xarray.core.dataset.Dataset#
Get all field components in Cartesian coordinates relative to the monitor’s local origin for all projection grid points and frequencies specified in the
AbstractFieldProjectionMonitor
.- Returns
xarray dataset containing (
Ex
,Ey
,Ez
,Hx
,Hy
,Hz
) in Cartesian coordinates.- Return type
xarray.Dataset
- property fields_spherical: xarray.core.dataset.Dataset#
Get all field components in spherical coordinates relative to the monitor’s local origin for all projection grid points and frequencies specified in the
AbstractFieldProjectionMonitor
.- Returns
xarray dataset containing (
Er
,Etheta
,Ephi
,Hr
,Htheta
,Hphi
) in spherical coordinates.- Return type
xarray.Dataset
- property k: complex#
Returns the complex wave number associated with the background medium.
- property nk: Tuple[float, float]#
Returns the real and imaginary parts of the background medium’s refractive index.
- property power: xarray.core.dataarray.DataArray#
Get power measured on the projection grid relative to the monitor’s local origin.
- Returns
Power at points relative to the local origin.
- Return type
xarray.DataArray
- property radar_cross_section: xarray.core.dataarray.DataArray#
Radar cross section in units of incident power.
- property symmetry_expanded_copy: tidy3d.components.data.monitor_data.MonitorData#
Return copy of self with symmetry applied.
- property x: numpy.ndarray#
X positions.
- property y: numpy.ndarray#
Y positions.
- property z: numpy.ndarray#
Z positions.