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)

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

If no initial pole guess is provided, the initial guess is logarithmically spaced over the provided frequencies.

Parameters:
  • s_matrix – S matrix to be fitted.

  • initial_poles – Sequence of poles used as initial guess. Conjugates are automatically added for complex poles.

  • 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.

Returns:

Tuple with PoleResidueMatrix and the fit RMS error.