BaseCoherenceFitter
BaseCoherenceFitter(description, backend_result, xdata, qubits, fit_fun, fit_p0, fit_bounds, circuit_names, series=None, expected_state='0', time_index=0, time_unit='micro-seconds')
Base class for fitters of characteristic times
Parameters
- description (
str
) – description of the fitter’s purpose, e.g. ‘T1’. - backend_result (
Union
[Result
,List
[Result
]]) – result of execution on the backend. - xdata (
Union
[List
[float
],array
]) – delay times of the circuits. - qubits (
List
[int
]) – the qubits to be characterized. - fit_fun (
Callable
[…,float
]) – equivalent to parameter f of scipy.curve_fit. - fit_p0 (
List
[float
]) – equivalent to parameter p0 of scipy.curve_fit. - fit_bounds (
Tuple
[List
[float
],List
[float
]]) – equivalent to parameter bounds of scipy.curve_fit. - circuit_names (
List
[str
]) – names of the circuits, should be the same length as xdata. Full circuit name will be these plus the series name. - series (
Optional
[List
[str
]]) – list of circuit name tags - expected_state (
str
) – is the circuit supposed to end up in ‘0’ or ‘1’? - time_index (
int
) – among parameters of fit_fun, which one is the characteristic time. - time_unit (
str
) – unit of delay times in xdata.
Attributes
backend_result
Union[qiskit.result.result.Result, List[qiskit.result.result.Result]]
Return the execution results
Return type
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:
Return type
List
[Dict
]
Methods
add_data
BaseCoherenceFitter.add_data(results, recalc=True, refit=True)
fit_data
BaseCoherenceFitter.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)
plot
BaseCoherenceFitter.plot(qind, series, ax=None, show_plot=True)
Plot coherence data.
Parameters
- qind (
int
) – qubit index to plot - series (
str
) – which series to plot (if list then plot multiple) - ax (
Optional
[Any
]) – plot axes - show_plot (
bool
) – whether to call plt.show()
Returns
The axes object
Return type
Axes
Raises
ImportError – if matplotlib is not installed
time
BaseCoherenceFitter.time(qid=- 1, series='0')
Return the characteristic time for the given qubit and series
Parameters
- qid (
int
) – the qubit index (or all qubits if -1) - series (
str
) – the series to get
Return type
Union
[float
, List
[float
]]
Returns
The characteristic time of the qubit, or all qubits
time_err
BaseCoherenceFitter.time_err(qid=- 1, series='0')
Return the error of characteristic time for the given qubit and series
Parameters
- qid (
int
) – the qubit index (or all qubits if -1) - series (
str
) – the series to get
Return type
Union
[float
, List
[float
]]
Returns
The error of the characteristic time of the qubit, or all qubits