{
  "title": "CircuitImpedanceModel",
  "public_path": "flex_rf.tidy3d.CircuitImpedanceModel",
  "lookup_path": "tidy3d.rf.CircuitImpedanceModel",
  "slug": "flex_rf/tidy3d/CircuitImpedanceModel",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/circuitimpedancemodel/",
  "object_kind": "class",
  "introduction": "Circuit model storing R/L/C components and port nodes; fits admittance on demand.\n\nStores the circuit description (components and port nodes) and fitting parameters.\nThe model uses **nodal analysis** with linear R, L, and C branches only. Arbitrary\ntopology is supported (any single connected graph of R/L/C branches), and a single\none-port admittance is extracted between the chosen port nodes. Auxiliary\nbranch-current equations and generalized augmented MNA (e.g. ideal sources,\nconstraints, controlled sources) are **not** supported.\n\nThe circuit must form a single connected graph (all components share at least one\nnode with the rest); this is validated at construction. Implements the same\ninterface for `LinearLumpedElement`: `_to_medium` and\n`_as_admittance_function` compute the one-port admittance from the stored\ncircuit and fit it to a pole-residue or rational form when needed.\n\nUse `from_spice` to build from a SPICE netlist, or construct directly\nwith `components` and optionally `freq_range`. When `freq_range` is omitted,\nit must be provided when the model is used (e.g. when used with\n`TerminalComponentModeler`, the modeler injects\n`freq_range` into the circuit model at build time).",
  "notes": "**DC / low-frequency limitation:** All frequencies used for fitting or evaluation\nmust be **strictly positive**. Inductors are modeled as $$1/(j\\omega L)$$,\nwhich is singular at DC; `_get_effective_admittance` and branch admittance\nconstruction reject $$f \\le 0$$. For DC-safe or augmented formulations (e.g.\ninductor branches with auxiliary equations), a future augmented-MNA backend could\nbe added; the current implementation is nodal-RLC only.",
  "examples": "```python\ncomps = (\n    LumpedCircuitComponent(element_type=\"R\", node_plus=\"1\", node_minus=\"0\", value=50.0),\n    LumpedCircuitComponent(element_type=\"C\", node_plus=\"1\", node_minus=\"0\", value=1e-12),\n)\nmodel = CircuitImpedanceModel(components=comps, freq_range=(1e9, 2e9), n_freqs=5)\n```",
  "references": "",
  "signature": "class CircuitImpedanceModel(MicrowaveBaseModel)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/lumped_element.py",
    "url": "",
    "lineno": 1052,
    "endlineno": 1874
  },
  "bases": [
    "MicrowaveBaseModel"
  ],
  "parameter_rows": [
    {
      "name": "components",
      "annotation": "tuple[LumpedCircuitComponent, ...]",
      "default": "...",
      "description": "R, L, and C `LumpedCircuitComponent` instances defining the one-port network.",
      "origin": "declared"
    },
    {
      "name": "port_node_plus",
      "annotation": "str",
      "default": "'1'",
      "description": "Name of the port signal node (positive terminal).",
      "origin": "declared"
    },
    {
      "name": "port_node_minus",
      "annotation": "str",
      "default": "'0'",
      "description": "Name of the port reference node (negative/reference terminal).",
      "origin": "declared"
    },
    {
      "name": "freq_range",
      "annotation": "FreqBound | None",
      "default": "None",
      "description": "Frequency range in Hz for fitting the admittance. When set, must satisfy 0 < f_min < f_max (validated at construction; inductor admittance is singular at DC). `n_freqs` points are sampled from this range to fit the pole-residue model. If `None`, must be provided when the model is used (e.g. via `_to_medium(scaling_factor, frequency_range=...)` or by `TerminalComponentModeler`, which injects freq_range).",
      "origin": "declared"
    },
    {
      "name": "n_freqs",
      "annotation": "int",
      "default": "10",
      "description": "Number of sampling frequencies used in the pole-residue fit (minimum 5).",
      "origin": "declared"
    },
    {
      "name": "fit_tolerance",
      "annotation": "float",
      "default": "1e-05",
      "description": "Target weighted RMS error for the pole-residue fit.",
      "origin": "declared"
    },
    {
      "name": "min_num_poles",
      "annotation": "int",
      "default": "1",
      "description": "Minimum number of poles for the dispersion fitter.",
      "origin": "declared"
    },
    {
      "name": "max_num_poles",
      "annotation": "int",
      "default": "5",
      "description": "Maximum number of poles for the dispersion fitter.",
      "origin": "declared"
    },
    {
      "name": "fit_show_progress",
      "annotation": "bool",
      "default": "False",
      "description": "Whether to show the fitter progress bar when fitting.",
      "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": "from_spice",
      "kind": "function",
      "signature": "from_spice(spice_file: str | Path, frequency_range: FreqBound, port_node_plus: str | None = None, port_node_minus: str | None = None, n_freqs: int | None = None, min_num_poles: int = 1, max_num_poles: int = 5, tolerance_rms: float = 1e-05, show_progress: bool = False)",
      "description": "Build a `CircuitImpedanceModel` from a SPICE netlist file."
    },
    {
      "name": "from_touchstone",
      "kind": "function",
      "signature": "from_touchstone(touchstone_file: str, num_order: int = 2, denom_order: int = 2)",
      "description": "Build a `CircuitImpedanceModel` from a Touchstone file."
    }
  ],
  "group": "flex_rf.tidy3d"
}
