mean_xy_data¶
- mean_xy_data(xdata, ydata, sigma=None, shots=None, method='sample')[source]¶
Return (x, y_mean, sigma) data.
The mean is taken over all
data values with the same data value using the specified method. For each the mean and variance are computed as"sample"
(default): Sample mean and variance ,
"iwv"
: Inverse-weighted variance"shots_weighted_variance"
: Sample mean and variance with weights from shots , , where is the number of shots per data point and is a total number of shots from different circuit execution at the same value. Ifshots
is not provided, this applies uniform weights to all values.
Deprecated since version 0.9: The function
qiskit_experiments.curve_analysis.utils.mean_xy_data()
is deprecated as of qiskit-experiments 0.9. It will be removed no earlier than 3 months after the release date. The curve data representation has been replaced by the DataFrame format.- Parameters:
xdata (ndarray) – 1D or 2D array of xdata from curve_fit_data or multi_curve_fit_data
ydata (ndarray) – array of ydata returned from curve_fit_data or multi_curve_fit_data
sigma (ndarray | None) – Optional, array of standard deviations in ydata.
shots (ndarray | None) – Optional, array of shots used to get a data point.
method (str) – The method to use for computing y means and standard deviations sigma (default: “sample”).
- Returns:
(x, y_mean, sigma, shots)
, wherex
is an arrays of unique x-values,y
is an array of sample mean y-values,sigma
is an array of sample standard deviation of y values, andshots
are the total number of experiment shots used to evaluate the data point. Ifshots
in the function call isNone
, the numbers appear in the returned value will represent just a number of duplicated x value entries.- Return type:
tuple
- Raises:
QiskitError – If the “ivw” method is used without providing a sigma.