pole_residue_fit

photonforge.pole_residue_fit(s_matrix, initial_poles=(), min_poles=1, max_poles=10, rms_error_tolerance=0.0001, max_iterations=100, max_stale_iterations=3, loss_factor=0.001, real=True)

Fit S matrix elements with rational functions sharing a set of poles.

If no initial pole guess is provided, the initial guess is evenly spaced over the provided frequencies, logarithmically if real is True and linearly otherwise.

Parameters:
  • s_matrix – S matrix to be fitted.

  • initial_poles – Sequence of poles used as initial guess. Complex poles should come in conjugate pairs if real is True.

  • min_poles – Minimal number of poles to try. It has no effect when initial pole guesses are provided.

  • max_poles – Maximal number of poles to try. It has no effect when initial pole guesses are provided.

  • loss_factor – For complex initial pole guesses, ratio between their real and imaginary parts.

  • rms_error_tolerance – RMS error level to break the fitting loop.

  • max_iterations – Maximal number of fitting iterations.

  • max_stale_iterations – Maximal number of iterations without error progress.

  • real – Whether the poles come in conjugate pairs, representing a real-valued (non-baseband) system.

Returns:

Tuple with PoleResidueMatrix and the fit RMS error.