{
  "title": "ModeInterpSpec",
  "public_path": "flex_rf.tidy3d.ModeInterpSpec",
  "lookup_path": "tidy3d.ModeInterpSpec",
  "slug": "flex_rf/tidy3d/ModeInterpSpec",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/modeinterpspec/",
  "object_kind": "class",
  "introduction": "Specification for mode frequency interpolation.",
  "notes": "Allows computing modes at a reduced set of frequencies and interpolating\nto obtain results at all requested frequencies. This can significantly\nreduce computational cost for broadband simulations where modes vary\nsmoothly with frequency.\n\nRequires frequency tracking to be enabled (`mode_spec.sort_spec.track_freq`\nmust not be `None`) to ensure mode ordering is consistent across frequencies.",
  "examples": "```python\n# Uniform sampling with linear interpolation\ninterp_spec = ModeInterpSpec(\n    method='linear',\n    sampling_spec=UniformSampling(num_points=10)\n)\n# Chebyshev sampling with polynomial interpolation\ninterp_spec = ModeInterpSpec.cheb(num_points=10)\n# Custom sampling with cubic interpolation\ncustom_freqs = [1e14, 1.5e14, 2e14, 2.5e14]\ninterp_spec = ModeInterpSpec.custom(method='cubic', freqs=custom_freqs)\n```",
  "references": "",
  "signature": "class ModeInterpSpec(Tidy3dBaseModel)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/mode_spec.py",
    "url": "",
    "lineno": 362,
    "endlineno": 581
  },
  "bases": [
    "Tidy3dBaseModel"
  ],
  "parameter_rows": [
    {
      "name": "sampling_spec",
      "annotation": "UniformSampling | ChebSampling | CustomSampling",
      "default": "",
      "description": "Specification for frequency sampling points.",
      "origin": "declared"
    },
    {
      "name": "method",
      "annotation": "Literal['linear', 'cubic', 'poly']",
      "default": "'linear'",
      "description": "Method for interpolating mode data between computed frequencies. 'linear' uses linear interpolation (faster, requires 2+ points). 'cubic' uses cubic spline interpolation (smoother, more accurate, requires 4+ points). 'poly' uses polynomial interpolation with barycentric formula (optimal for Chebyshev nodes, requires 3+ points). For complex-valued data, real and imaginary parts are interpolated independently.",
      "origin": "declared"
    },
    {
      "name": "reduce_data",
      "annotation": "bool",
      "default": "False",
      "description": "Applies only to `ModeSolverData`. If `True`, fields and quantities are only recorded at interpolation source frequency points. The data at requested frequencies can be obtained through interpolation. This can significantly reduce storage and computational costs for broadband simulations. Does not apply if the number of sampling points is greater than the number of monitor frequencies.",
      "origin": "declared"
    },
    {
      "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"
    }
  ],
  "members": [
    {
      "name": "cheb",
      "kind": "function",
      "signature": "cheb(num_points: int, reduce_data: bool = False)",
      "description": "Create a ModeInterpSpec with Chebyshev node sampling and polynomial interpolation."
    },
    {
      "name": "custom",
      "kind": "function",
      "signature": "custom(freqs: FreqArray, method: Literal['linear', 'cubic', 'poly'] = 'linear', reduce_data: bool = False)",
      "description": "Create a ModeInterpSpec with custom frequency sampling."
    },
    {
      "name": "num_points",
      "kind": "attribute",
      "signature": "num_points: int",
      "description": "Number of sampling points."
    },
    {
      "name": "sampling_points",
      "kind": "function",
      "signature": "sampling_points(freqs: FreqArray)",
      "description": "Compute frequency sampling points."
    },
    {
      "name": "uniform",
      "kind": "function",
      "signature": "uniform(num_points: int, method: Literal['linear', 'cubic', 'poly'] = 'linear', reduce_data: bool = False)",
      "description": "Create a ModeInterpSpec with uniform frequency sampling."
    }
  ],
  "group": "flex_rf.tidy3d"
}
