qiskit-documentation/docs/api/qiskit/0.29/qiskit.ignis.verification.P...

183 lines
6.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: PurityRBFitter (v0.29)
description: API reference for qiskit.ignis.verification.PurityRBFitter in qiskit v0.29
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.ignis.verification.PurityRBFitter
---
# PurityRBFitter
<Class id="qiskit.ignis.verification.PurityRBFitter" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-ignis/tree/stable/0.6/qiskit/ignis/verification/randomized_benchmarking/fitters.py" signature="PurityRBFitter(purity_result, npurity, cliff_lengths, rb_pattern=None)" modifiers="class">
Bases: `qiskit.ignis.verification.randomized_benchmarking.fitters.RBFitterBase`
Class for fitter for purity RB.
Derived from RBFitterBase class.
**Parameters**
* **purity\_result** (*list*) list of results of the 3^n purity RB sequences per seed (qiskit.Result).
* **npurity** (*int*) equals 3^n (where n is the dimension).
* **cliff\_lengths** (*list*) the Clifford lengths, 2D list i x j where i is the number of patterns, j is the number of cliffords lengths.
* **rb\_pattern** (*list*) the pattern for the RB sequences.
## Methods
<span id="qiskit-ignis-verification-purityrbfitter-f234" />
### F234
<Function id="qiskit.ignis.verification.PurityRBFitter.F234" signature="PurityRBFitter.F234(n, a, b)" modifiers="static">
Function than maps: 2^n x 3^n > 4^n , namely: (a,b) > c where a in 2^n, b in 3^n, c in 4^n
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-add-data" />
### add\_data
<Function id="qiskit.ignis.verification.PurityRBFitter.add_data" signature="PurityRBFitter.add_data(new_purity_result, rerun_fit=True)">
Add a new result.
**Parameters**
* **new\_purity\_result** (*list*) list of RB results of the purity RB circuits.
* **rerun\_fit** (*bool*) re-calculate the means and fit the result.
#### Additional information:
Assumes that the executed result is the output of circuits generated by randomized\_benchmarking\_seq where is\_purity = True.
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-add-zdict-ops" />
### add\_zdict\_ops
<Function id="qiskit.ignis.verification.PurityRBFitter.add_zdict_ops" signature="PurityRBFitter.add_zdict_ops()">
Creating all Z-correlators in order to compute the expectation values.
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-calc-data" />
### calc\_data
<Function id="qiskit.ignis.verification.PurityRBFitter.calc_data" signature="PurityRBFitter.calc_data()">
Retrieve probabilities of success from execution results.
Measure the purity calculation into an internal variable \_raw\_data which is a 3-dimensional list, where item (i,j,k) is the purity of the set of qubits in pattern “i” for seed no. j and vector length self.\_cliff\_lengths\[i]\[k].
#### Additional information:
Assumes that the executed result is the output of circuits generated by randomized\_benchmarking\_seq,
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-calc-statistics" />
### calc\_statistics
<Function id="qiskit.ignis.verification.PurityRBFitter.calc_statistics" signature="PurityRBFitter.calc_statistics()">
Extract averages and std dev from the raw data (self.\_raw\_data).
Assumes that self.\_calc\_data has been run. Output into internal \_ydata variable. ydata is a list of dictionaries (length number of patterns):
Dictionary ydata\[i]:
> * ydata\[i]\[mean] is a numpy\_array of length n; entry j of this array contains the mean probability of success over seeds, for vector length self.\_cliff\_lengths\[i]\[j].
> * ydata\[i]\[std] is a numpy\_array of length n; entry j of this array contains the std of the probability of success over seeds, for vector length self.\_cliff\_lengths\[i]\[j].
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-fit-data" />
### fit\_data
<Function id="qiskit.ignis.verification.PurityRBFitter.fit_data" signature="PurityRBFitter.fit_data()">
Fit the Purity RB results to an exponential curve.
Use the data to construct guess values for the fits.
Puts the results into a list of fit dictionaries where each dictionary corresponds to a pattern and has fields:
> * `params` - three parameters of rb\_fit\_fun. The middle one is the exponent.
> * `err` - the error limits of the parameters.
> * `epc` - Error per Clifford.
> * `pepc` - Purity Error per Clifford.
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-fit-data-pattern" />
### fit\_data\_pattern
<Function id="qiskit.ignis.verification.PurityRBFitter.fit_data_pattern" signature="PurityRBFitter.fit_data_pattern(patt_ind, fit_guess)">
Fit the RB results of a particular pattern to an exponential curve.
**Parameters**
* **patt\_ind** (*int*) index of the subsystem to fit.
* **fit\_guess** (*list*) guess values for the fit.
Puts the results into a list of fit dictionaries where each dictionary corresponds to a pattern and has fields:
> * `params` - three parameters of rb\_fit\_fun. The middle one is the exponent.
> * `err` - the error limits of the parameters.
</Function>
<span id="qiskit-ignis-verification-purityrbfitter-plot-rb-data" />
### plot\_rb\_data
<Function id="qiskit.ignis.verification.PurityRBFitter.plot_rb_data" signature="PurityRBFitter.plot_rb_data(pattern_index=0, ax=None, add_label=True, show_plt=True)">
Plot purity RB data of a single pattern.
</Function>
## Attributes
### cliff\_lengths
<Attribute id="qiskit.ignis.verification.PurityRBFitter.cliff_lengths">
Return clifford lengths.
</Attribute>
### fit
<Attribute id="qiskit.ignis.verification.PurityRBFitter.fit">
Return the purity fit parameters.
</Attribute>
### raw\_data
<Attribute id="qiskit.ignis.verification.PurityRBFitter.raw_data">
Return raw data.
</Attribute>
### rb\_fit\_fun
<Attribute id="qiskit.ignis.verification.PurityRBFitter.rb_fit_fun">
Return the fit function rb\_fit\_fun.
</Attribute>
### rbfit\_pur
<Attribute id="qiskit.ignis.verification.PurityRBFitter.rbfit_pur">
Return the purity RB fitter.
</Attribute>
### results
<Attribute id="qiskit.ignis.verification.PurityRBFitter.results">
Return all the results.
</Attribute>
### seeds
<Attribute id="qiskit.ignis.verification.PurityRBFitter.seeds">
Return the number of loaded seeds.
</Attribute>
### ydata
<Attribute id="qiskit.ignis.verification.PurityRBFitter.ydata">
Return ydata (means and std devs).
</Attribute>
</Class>