code: def guess(self, data, f=None, **kwargs):
      verbose = kwargs.pop("verbose", None)
      if f is None:
          return
      argmin_s21 = np.abs(data).argmin()
      fmin = f.min()
      fmax = f.max()
      f_0_guess = f[
          argmin_s21
      ]  # guess that the resonance is the lowest point
      Q_min = 0.1 * (
          f_0_guess / (fmax - fmin)
      )  # assume the user isn't trying to fit just a small part of a resonance curve
      delta_f = np.diff(f)  # assume f is sorted
      min_delta_f = delta_f[delta_f > 0].min()
      Q_max = (
          f_0_guess / min_delta_f
      )  # assume data actually samples the resonance reasonably
      Q_guess = np.sqrt(Q_min * Q_max)  # geometric mean, why not?
      Q_e_real_guess = Q_guess / (1 - np.abs(data[argmin_s21]))
      if verbose:
          print(f"fmin={fmin}, fmax={fmax}, f_0_guess={f_0_guess}")
          print(
              f"Qmin={Q_min}, Q_max={Q_max}, Q_guess={Q_guess}, Q_e_real_guess={Q_e_real_guess}"
          )
      params = self.make_params(
          Q=Q_guess, Q_e_real=Q_e_real_guess, Q_e_imag=0, f_0=f_0_guess
      )
      params[f"{self.prefix}Q"].set(min=Q_min, max=Q_max)
      params[f"{self.prefix}f_0"].set(min=fmin, max=fmax)
      return lmfit.models.update_param_vals(
          params, self.prefix, **kwargs
      )
  
file_path: lmfit-py/examples/example_complex_resonator_model.py
imports: import matplotlib.pyplot
  import numpy
  import lmfit
label_desc: Use image node_id 2 for calling the ResonatorModel obj's underlying member method code with example usage: obj.guess(data, f) and returns: lmfit