convert_lmfit_result

convert_lmfit_result(result, models, xdata, ydata, residuals)[source]

A helper function to convert LMFIT MinimizerResult into CurveFitResult.

CurveFitResult is a dataclass that can be serialized with the experiment JSON decoder. In addition, this class converts LMFIT Parameter objects into ufloats so that extra parameter computation in the analysis post-processing can perform accurate error propagation with parameter correlation.

Parameters:
  • result (MinimizerResult) – Output from LMFIT minimize.

  • models (List[Model]) – Model used for the fitting. Function description is extracted.

  • xdata (ndarray) – X values used for the fitting.

  • ydata (ndarray) – Y values used for the fitting.

  • residuals (ndarray) – The residuals of the ydata from the model.

Returns:

QiskitExperiments CurveFitResult object.

Return type:

CurveFitResult