tidy3d.plugins.dispersion.FastDispersionFitter#

class FastDispersionFitter[source]#

Bases: DispersionFitter

Tool for fitting refractive index data to get a dispersive medium described by PoleResidue model.

Parameters:
  • wvl_um (ArrayLike[dtype=float, ndim=1]) – [units = um]. Wavelength data in micrometers.

  • n_data (ArrayLike[dtype=float, ndim=1]) – Real part of the complex index of refraction.

  • k_data (Optional[ArrayLike[dtype=float, ndim=1]] = None) – Imaginary part of the complex index of refraction.

  • wvl_range (tuple[Optional[float], Optional[float]] = (None, None)) – [units = um]. Truncate the wavelength, n and k data to the wavelength range ‘[wvl_min, wvl_max]’ for fitting.

Notes

Practical Advice

Typical Usage:

fitter = FastDispersionFitter(wvl_um=wavelengths, n_data=n_values, k_data=k_values)
medium, rms_error = fitter.fit(min_num_poles=1, max_num_poles=5, tolerance_rms=1e-2)

Tips

  • Start with fewer poles (1-2) and increase only if the RMS error is too high.

  • Use wvl_range to focus the fit on your wavelength range of interest.

  • For PML stability, verify that the fitted model is passive (no gain).

  • Visualize the fit with fitter.plot(medium) before using it in a simulation.

Attributes

wvl_um

n_data

k_data

wvl_range

Methods

constant_loss_tangent_model(eps_real, ...[, ...])

Fit a constant loss tangent material model.

fit([min_num_poles, max_num_poles, eps_inf, ...])

Fit data using a fast fitting algorithm.

fit(min_num_poles=1, max_num_poles=5, eps_inf=None, tolerance_rms=1e-05, advanced_param=None)[source]#

Fit data using a fast fitting algorithm.

Note

The algorithm is described in:

B. Gustavsen and A. Semlyen, "Rational approximation
of frequency domain responses by vector fitting,"
IEEE Trans. Power. Deliv. 14, 3 (1999).

B. Gustavsen, "Improving the pole relocation properties
of vector fitting," IEEE Trans. Power Deliv. 21, 3 (2006).

B. Gustavsen, "Enforcing Passivity for Admittance Matrices
Approximated by Rational Functions," IEEE Trans. Power
Syst. 16, 1 (2001).

Note

The fit is performed after weighting the real and imaginary parts, so the RMS error is also weighted accordingly. By default, the weights are chosen based on typical values of the data. To change this behavior, use ‘AdvancedFastFitterParam.weights’.

Parameters:
  • min_num_poles (PositiveInt, optional) – Minimum number of poles in the model.

  • max_num_poles (PositiveInt, optional) – Maximum number of poles in the model.

  • eps_inf (float, optional) – Value of eps_inf to use in fit. If None, then eps_inf is also fit. Note: fitting eps_inf is not guaranteed to yield a global optimum, so the result may occasionally be better with a fixed value of eps_inf.

  • tolerance_rms (float, optional) – Weighted RMS error below which the fit is successful and the result is returned.

  • advanced_param (AdvancedFastFitterParam, optional) – Advanced parameters for fitting.

Returns:

Best fitting result: (dispersive medium, weighted RMS error).

Return type:

tuple[PoleResidue, float]

classmethod constant_loss_tangent_model(eps_real, loss_tangent, frequency_range, max_num_poles=5, number_sampling_frequency=10, tolerance_rms=1e-05, show_progress=True)[source]#

Fit a constant loss tangent material model.

Parameters:
  • eps_real (float) – Real part of permittivity

  • loss_tangent (float) – Loss tangent.

  • frequency_range (tuple[float, float]) – Freqquency range for the material to exhibit constant loss tangent response.

  • max_num_poles (PositiveInt, optional) – Maximum number of poles in the model.

  • number_sampling_frequency (PositiveInt, optional) – Number of sampling frequencies to compute RMS error for fitting.

  • tolerance_rms (float, optional) – Weighted RMS error below which the fit is successful and the result is returned.

  • show_progress (bool) – Whether to show a progress bar.

Returns:

Best results of multiple fits.

Return type:

class:`.PoleResidue