# tidy3d.ModeSpec#

class tidy3d.ModeSpec#

Stores specifications for the mode solver to find an electromagntic mode. Note, the planar axes are found by popping the injection axis from {x,y,z}. For example, if injection axis is y, the planar axes are ordered {x,z}.

Parameters
• num_modes (PositiveInt = 1) – Number of modes returned by mode solver.

• target_neff (Optional[PositiveFloat] = None) – Guess for effective index of the mode.

• num_pml (Tuple[NonNegativeInt, NonNegativeInt] = (0, 0)) – Number of standard pml layers to add in the two tangential axes.

• sort_by (Literal['largest_neff', 'te_fraction', 'tm_fraction'] = largest_neff) – The solver will always compute the `num_modes` modes closest to the `target_neff`, but they can be reordered by the largest `te_fraction`, defined as the integral of the intensity of the E-field component parallel to the first plane axis normalized to the total in-plane E-field intensity. Similarly, `tm_fraction` uses the E field component parallel to the second plane axis.

• angle_theta (float = 0.0) – [units = rad]. Polar angle of the propagation axis from the injection axis.

• angle_phi (float = 0.0) – [units = rad]. Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.

• bend_radius (Optional[float] = None) – [units = um]. A curvature radius for simulation of waveguide bends. Can be negative, in which case the mode plane center has a smaller value than the curvature center along the tangential axis perpendicular to the bend axis.

• bend_axis (Optional[Literal[0, 1]] = None) – Index into the two tangential axes defining the normal to the plane in which the bend lies. This must be provided if `bend_radius` is not `None`. For example, for a ring in the global xy-plane, and a mode plane in either the xz or the yz plane, the `bend_axis` is always 1 (the global z axis).

Example

```>>> mode_spec = ModeSpec(num_modes=3, target_neff=1.5)
```

Show JSON schema
```{
"title": "ModeSpec",
"description": "Stores specifications for the mode solver to find an electromagntic mode.\nNote, the planar axes are found by popping the injection axis from {x,y,z}.\nFor example, if injection axis is y, the planar axes are ordered {x,z}.\n\nParameters\n----------\nnum_modes : PositiveInt = 1\n    Number of modes returned by mode solver.\ntarget_neff : Optional[PositiveFloat] = None\n    Guess for effective index of the mode.\nnum_pml : Tuple[NonNegativeInt, NonNegativeInt] = (0, 0)\n    Number of standard pml layers to add in the two tangential axes.\nsort_by : Literal['largest_neff', 'te_fraction', 'tm_fraction'] = largest_neff\n    The solver will always compute the ``num_modes`` modes closest to the ``target_neff``, but they can be reordered by the largest ``te_fraction``, defined as the integral of the intensity of the E-field component parallel to the first plane axis normalized to the total in-plane E-field intensity. Similarly, ``tm_fraction`` uses the E field component parallel to the second plane axis.\nangle_theta : float = 0.0\n    [units = rad].  Polar angle of the propagation axis from the injection axis.\nangle_phi : float = 0.0\n    [units = rad].  Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.\nbend_radius : Optional[float] = None\n    [units = um].  A curvature radius for simulation of waveguide bends. Can be negative, in which case the mode plane center has a smaller value than the curvature center along the tangential axis perpendicular to the bend axis.\nbend_axis : Optional[Literal[0, 1]] = None\n    Index into the two tangential axes defining the normal to the plane in which the bend lies. This must be provided if ``bend_radius`` is not ``None``. For example, for a ring in the global xy-plane, and a mode plane in either the xz or the yz plane, the ``bend_axis`` is always 1 (the global z axis).\n\nExample\n-------\n>>> mode_spec = ModeSpec(num_modes=3, target_neff=1.5)",
"type": "object",
"properties": {
"num_modes": {
"title": "Number of modes",
"description": "Number of modes returned by mode solver.",
"default": 1,
"exclusiveMinimum": 0,
"type": "integer"
},
"target_neff": {
"title": "Target effective index",
"description": "Guess for effective index of the mode.",
"exclusiveMinimum": 0,
"type": "number"
},
"num_pml": {
"title": "Number of PML layers",
"description": "Number of standard pml layers to add in the two tangential axes.",
"default": [
0,
0
],
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "integer",
"minimum": 0
},
{
"type": "integer",
"minimum": 0
}
]
},
"sort_by": {
"title": "Ordering of the returned modes",
"description": "The solver will always compute the ``num_modes`` modes closest to the ``target_neff``, but they can be reordered by the largest ``te_fraction``, defined as the integral of the intensity of the E-field component parallel to the first plane axis normalized to the total in-plane E-field intensity. Similarly, ``tm_fraction`` uses the E field component parallel to the second plane axis.",
"default": "largest_neff",
"enum": [
"largest_neff",
"te_fraction",
"tm_fraction"
],
"type": "string"
},
"angle_theta": {
"title": "Polar Angle",
"description": "Polar angle of the propagation axis from the injection axis.",
"default": 0.0,
"type": "number"
},
"angle_phi": {
"title": "Azimuth Angle",
"description": "Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.",
"default": 0.0,
"type": "number"
},
"description": "A curvature radius for simulation of waveguide bends. Can be negative, in which case the mode plane center has a smaller value than the curvature center along the tangential axis perpendicular to the bend axis.",
"units": "um",
"type": "number"
},
"bend_axis": {
"title": "Bend axis",
"description": "Index into the two tangential axes defining the normal to the plane in which the bend lies. This must be provided if ``bend_radius`` is not ``None``. For example, for a ring in the global xy-plane, and a mode plane in either the xz or the yz plane, the ``bend_axis`` is always 1 (the global z axis).",
"enum": [
0,
1
],
"type": "integer"
},
"type": {
"title": "Type",
"default": "ModeSpec",
"enum": [
"ModeSpec"
],
"type": "string"
}
},
}
```

Fields
• `angle_phi (float)`

• `angle_theta (float)`

• `bend_axis (Literal[0, 1])`

• `bend_radius (float)`

• `num_modes (pydantic.types.PositiveInt)`

• `num_pml (Tuple[pydantic.types.NonNegativeInt, pydantic.types.NonNegativeInt])`

• `sort_by (Literal['largest_neff', 'te_fraction', 'tm_fraction'])`

• `target_neff (pydantic.types.PositiveFloat)`

attribute angle_phi: float = 0.0#

Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.

attribute angle_theta: float = 0.0#

Polar angle of the propagation axis from the injection axis.

Validated by
• `glancing_incidence`

attribute bend_axis: Literal[0, 1] = None#

Index into the two tangential axes defining the normal to the plane in which the bend lies. This must be provided if `bend_radius` is not `None`. For example, for a ring in the global xy-plane, and a mode plane in either the xz or the yz plane, the `bend_axis` is always 1 (the global z axis).

Validated by
• `bend_axis_given`

A curvature radius for simulation of waveguide bends. Can be negative, in which case the mode plane center has a smaller value than the curvature center along the tangential axis perpendicular to the bend axis.

attribute num_modes: pydantic.types.PositiveInt = 1#

Number of modes returned by mode solver.

Constraints
• exclusiveMinimum = 0

attribute num_pml: Tuple[pydantic.types.NonNegativeInt, pydantic.types.NonNegativeInt] = (0, 0)#

Number of standard pml layers to add in the two tangential axes.

attribute sort_by: Literal['largest_neff', 'te_fraction', 'tm_fraction'] = 'largest_neff'#

The solver will always compute the `num_modes` modes closest to the `target_neff`, but they can be reordered by the largest `te_fraction`, defined as the integral of the intensity of the E-field component parallel to the first plane axis normalized to the total in-plane E-field intensity. Similarly, `tm_fraction` uses the E field component parallel to the second plane axis.

attribute target_neff: pydantic.types.PositiveFloat = None#

Guess for effective index of the mode.

Constraints
• exclusiveMinimum = 0