{
  "title": "ModeSpec",
  "public_path": "flex_rf.tidy3d.ModeSpec",
  "lookup_path": "tidy3d.ModeSpec",
  "slug": "flex_rf/tidy3d/ModeSpec",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/modespec/",
  "object_kind": "class",
  "introduction": "Stores specifications for the mode solver to find an electromagnetic mode.",
  "notes": "The `angle_theta` and `angle_phi` parameters define the injection axis as illustrated in the figure\nbelow, with respect to the axis normal to the mode plane (`x` in the figure). Note that `angle_theta`\nmust be smaller than $$\\frac{pi}{2}$$. To inject in the backward direction, we can still use the\n`direction` parameter as also shown in the figure. Similarly, the mode amplitudes computed in mode monitors\nare defined w.r.t. the `forward` and `backward` directions as illustrated. Note, the planar axes are\nfound by popping the injection axis from `{x,y,z}`. For example, if injection axis is `y`, the planar\naxes are ordered `{x,z}`.\n\nThe `bend_axis` is the axis normal to the plane in which the bend lies, (`z` in the diagram below). In\nthe mode specification, it is defined locally for the mode plane as one of the two axes tangential to the\nplane. In the case of bends that lie in the `xy`-plane, the mode plane would be either in `xz` or in\n`yz`, so in both cases the correct setting is `bend_axis=1`, selecting the global `z`. The\n`bend_radius` is counted from the center of the mode plane to the center of the curvature,\nalong the tangential axis perpendicular to the bend axis. This radius can also be negative, if the center of\nthe mode plane is smaller than the center of the bend.",
  "examples": "```python\nmode_spec = ModeSpec(num_modes=3, target_neff=1.5)\n```",
  "references": "",
  "signature": "class ModeSpec(AbstractModeSpec)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/mode_spec.py",
    "url": "",
    "lineno": 939,
    "endlineno": 979
  },
  "bases": [
    "AbstractModeSpec"
  ],
  "parameter_rows": [
    {
      "name": "attrs",
      "annotation": "dict",
      "default": "factory: dict",
      "description": "Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, `attrs` are mutable. For example, the following is allowed for setting an `attr` `obj.attrs['foo'] = bar`. Also note that Tidy3D will raise a `TypeError` if `attrs` contain objects that can not be serialized. One can check if `attrs` are serializable by calling `obj.model_dump_json()`.",
      "origin": "inherited"
    },
    {
      "name": "num_modes",
      "annotation": "PositiveInt",
      "default": "1",
      "description": "Number of modes returned by mode solver.",
      "origin": "inherited"
    },
    {
      "name": "target_neff",
      "annotation": "PositiveFloat | None",
      "default": "None",
      "description": "Guess for effective index of the mode.",
      "origin": "inherited"
    },
    {
      "name": "num_pml",
      "annotation": "tuple[NonNegativeInt, NonNegativeInt]",
      "default": "(0, 0)",
      "description": "Number of standard pml layers to add in the two tangential axes.",
      "origin": "inherited"
    },
    {
      "name": "filter_pol",
      "annotation": "Literal['te', 'tm'] | None",
      "default": "None",
      "description": "The solver always computes the `num_modes` modes closest to the given `target_neff`. If `filter_pol==None`, they are simply sorted in order of decreasing effective index. If a polarization filter is selected, the modes are rearranged such that the first `n_pol` modes in the list are the ones with the selected polarization fraction larger than or equal to 0.5, while the next `num_modes - n_pol` modes are the ones where it is smaller than 0.5 (i.e. the opposite polarization fraction is larger than 0.5). Within each polarization subset, the modes are still ordered by decreasing effective index. `te`-fraction is defined as the integrated intensity of the E-field component parallel to the first plane axis, normalized to the total in-plane E-field intensity. Conversely, `tm`-fraction uses the E field component parallel to the second plane axis.",
      "origin": "inherited"
    },
    {
      "name": "angle_theta",
      "annotation": "float",
      "default": "0.0",
      "description": "Polar angle of the propagation axis from the injection axis.",
      "origin": "inherited"
    },
    {
      "name": "angle_phi",
      "annotation": "float",
      "default": "0.0",
      "description": "Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.",
      "origin": "inherited"
    },
    {
      "name": "precision",
      "annotation": "Literal['auto', 'single', 'double']",
      "default": "'double'",
      "description": "The solver will be faster and using less memory under single precision, but more accurate under double precision. Choose `'auto'` to apply double precision if the simulation contains a good conductor, single precision otherwise.",
      "origin": "inherited"
    },
    {
      "name": "bend_radius",
      "annotation": "FiniteFloat | None",
      "default": "None",
      "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.",
      "origin": "inherited"
    },
    {
      "name": "bend_axis",
      "annotation": "Axis2D | None",
      "default": "None",
      "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).",
      "origin": "inherited"
    },
    {
      "name": "angle_rotation",
      "annotation": "bool",
      "default": "False",
      "description": "Defines how modes are computed when `angle_theta` is not zero. If `False`, a coordinate transformation is applied through the permittivity and permeability tensors.If `True`, the structures in the simulation are first rotated to compute a mode solution at a reference plane normal to the structure's azimuthal direction. Then, the fields are rotated to align with the mode plane, using the `n_eff` calculated at the reference plane. The second option can produce more accurate results, but more care must be taken, for example, in ensuring that the original mode plane intersects the correct geometries in the simulation with rotated structures. Note: currently only supported when `angle_phi` is a multiple of `np.pi`.",
      "origin": "inherited"
    },
    {
      "name": "track_freq",
      "annotation": "TrackFreq | None",
      "default": "None",
      "description": "Deprecated. Use 'sort_spec.track_freq' instead.",
      "origin": "inherited"
    },
    {
      "name": "group_index_step",
      "annotation": "PositiveFloat | bool",
      "default": "False",
      "description": "Control the computation of the group index alongside the effective index. If set to a positive value, it sets the fractional frequency step used in the numerical differentiation of the effective index to compute the group index. If set to `True`, the default of 0.005 is used.",
      "origin": "inherited"
    },
    {
      "name": "sort_spec",
      "annotation": "ModeSortSpec",
      "default": "factory: ModeSortSpec",
      "description": "Defines how to filter and sort modes within each frequency. If `track_freq` is not `None`, the sorting is only exact at the specified frequency, while at other frequencies it can change depending on the mode tracking.",
      "origin": "inherited"
    },
    {
      "name": "interp_spec",
      "annotation": "ModeInterpSpec | None",
      "default": "None",
      "description": "Specification for computing modes at a reduced set of frequencies and interpolating to obtain results at all requested frequencies. This can significantly reduce computational cost for broadband simulations where modes vary smoothly with frequency. Requires frequency tracking to be enabled (`sort_spec.track_freq` must not be `None`) to ensure consistent mode ordering across frequencies.",
      "origin": "inherited"
    }
  ],
  "members": [],
  "group": "flex_rf.tidy3d"
}
