Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

DragFitter

DragFitter(backend_result, xdata, qubits, fit_p0, fit_bounds=None) GitHub(opens in a new tab)

Drag Experiment fitter

See IQFitter __init__

fit_p0 is [a, x0, c] where the fit is a*(x-x0)^2+c


Attributes

backend_result

Union[qiskit.result.result.Result, List[qiskit.result.result.Result]]

Return the execution results

Return type

Union[Result, List[Result]]

description

str

Return the fitter’s purpose, e.g. ‘T1’

Return type

str

fit_fun

Callable

Return the function used in the fit, e.g. BaseFitter._exp_fit_fun

Return type

Callable

measured_qubits

List[int]

Return the indices of the qubits to be characterized

Return type

List[int]

params

List[float]

Return the fit function parameters that were calculated by curve_fit

Return type

List[float]

params_err

List[float]

Return the error of the fit function parameters

Return type

List[float]

series

Optional[List[str]]

Return the list of series for the data

Return type

Optional[List[str]]

xdata

Union[List[float], numpy.array]

Return the data points on the x-axis, the independenet parameter which is fit against

Return type

Union[List[float], array]

ydata

List[Dict]

Return the data points on the y-axis

The data points are returning in the form of a list of dictionaries:

  • ydata[i][‘mean’] is a list, where item

    no. j is the probability of success of qubit i for a circuit that lasts xdata[j].

  • ydata[i][‘std’] is a list, where ydata[‘std’][j] is the

    standard deviation of the success of qubit i.

Return type

List[Dict]


Methods

add_data

DragFitter.add_data(results, recalc=True, refit=True)

Add new execution results to previous execution results

Parameters

  • results (Union[Result, List[Result]]) – new execution results
  • recalc (bool) – whether tp recalculate the data
  • refit (bool) – whether to refit the data

drag_amplitude

DragFitter.drag_amplitude(qind=- 1)

Return the drag amplitude from the fit

Parameters

qind (int) – qubit index

Returns

drag amp

Return type

float

fit_data

DragFitter.fit_data(qid=- 1, p0=None, bounds=None, series=None)

Fit the curve.

Compute self._params and self._params_err

Parameters

  • qid (int) – qubit for fitting. If -1 fit for all the qubits
  • p0 (Optional[List[float]]) – initial guess, equivalent to p0 in scipy.optimize
  • bounds (Optional[Tuple[List[float], List[float]]]) – bounds, equivalent to bounds in scipy.optimize
  • series (Optional[str]) – series to fit (if None fit all)

guess_params

DragFitter.guess_params(qind=0)

Guess parameters for the drag fit

Parameters

qind (int) – qubit index

Returns

guess parameters

[a, x0, c] where the fit is a(xx0)2+ca * (x - x0)^{2+c}

Return type

list

plot

DragFitter.plot(qind, series='0', ax=None, show_plot=False)

Plot the data and fit

Parameters

  • qind (int) – qubit index
  • series (str) – data series to plot (for rabi data always ‘0’)
  • ax (Axes) – matploblib axes (if none created)
  • show_plot (bool) – do plot.show

Returns

Plot axes

Return type

Axes

Was this page helpful?