pygsti.extras.idletomography.idttools
Idle Tomography utility routines
Module Contents
Functions
|
Lists every "error bit string" that co1uld be caused by an error of weight |
|
Lists every Pauli error operator for nqubits qubits with weight <= maxweight |
|
Lists every weight <= maxweight observable whose expectation value can be |
|
Tiles a set of base fiducial pairs on maxweight qubits to a |
List all nontrivial paulis of given weight wt. |
|
|
Set specific or random error terms (typically for a data-generating model) |
|
Get error rates on the global idle operation within a |
|
Get the exact intrinsic rates that would be produced by simulating model |
|
Get the exact observable rates that would be produced by simulating |
- pygsti.extras.idletomography.idttools.alloutcomes(prep, meas, maxweight)
Lists every “error bit string” that co1uld be caused by an error of weight up to maxweight when performing prep & meas (must be in same basis, but may have different signs).
Parameters
prep, meas : NQPauliState
maxweight : int
Returns
- list
A list of
NQOutcome
objects.
- pygsti.extras.idletomography.idttools.allerrors(nqubits, maxweight)
Lists every Pauli error operator for nqubits qubits with weight <= maxweight
Parameters
nqubits, maxweight : int
Returns
- list
A list of
NQPauliOp
objects.
- pygsti.extras.idletomography.idttools.allobservables(meas, maxweight)
Lists every weight <= maxweight observable whose expectation value can be extracted from the local Pauli measurement described by meas.
Parameters
meas : NQPauliState
maxweight : int
Returns
- list
A list of
NQPauliOp
objects.
- pygsti.extras.idletomography.idttools.tile_pauli_fidpairs(base_fidpairs, nqubits, maxweight)
Tiles a set of base fiducial pairs on maxweight qubits to a set of fiducial pairs on nqubits qubits such that every set of maxweight qubits takes on the values in each base pair in at least one of the returned pairs.
Parameters
- base_fidpairslist
A list of 2-tuples of
NQPauliState
objects (on maxweight qubits).- nqubitsint
The number of qubits.
- maxweightint
The maximum weight errors the base qubits are meant to detect. Equal to the number of qubits in the base pairs.
Returns
- list
A list of 2-tuples of
NQPauliState
objects (on nqubits qubits).
- pygsti.extras.idletomography.idttools.nontrivial_paulis(wt)
List all nontrivial paulis of given weight wt.
Parameters
wt : int
Returns
- list
A list of tuples of ‘X’, ‘Y’, and ‘Z’, e.g. (‘X’,’Z’).
- pygsti.extras.idletomography.idttools.set_idle_errors(nqubits, model, errdict, rand_default=None, hamiltonian=True, stochastic=True, affine=True)
Set specific or random error terms (typically for a data-generating model) within a noise model (a
CloudNoiseModel
object).Parameters
- nqubitsint
The number of qubits.
- modelCloudNoiseModel
The model, to set the idle errors of.
- errdictdict
A dictionary of errors to include. Keys are “S(<>)”, “H(<>)”, and “A(<>)” where <> is a string of ‘X’,’Y’,’Z’,and ‘I’ (e.g. “S(XIZ)”) and values are floating point error rates.
- rand_defaultfloat or numpy array, optional
Random error rates to insert into values not specified in errdict. If a floating point number, a random value between 0 and rand_default is used. If an array, then values are taken directly and sequentially from this array (typically of random rates). The array must be long enough to provide values for all unspecified rates.
- hamiltonian, stochastic, affinebool, optional
Whether model includes Hamiltonian, Stochastic, and/or Affine errors (e.g. if the model was built with “H+S” parameterization, then only hamiltonian and stochastic should be set to True).
Returns
- numpy.ndarray
The random rates the were used.
- pygsti.extras.idletomography.idttools.extract_idle_errors(nqubits, model, hamiltonian=True, stochastic=True, affine=True, scale_for_idt=True)
Get error rates on the global idle operation within a
CloudNoiseModel
object.Parameters
- nqubitsint
The number of qubits.
- modelCloudNoiseModel
The model, to get the idle errors of.
- hamiltonian, stochastic, affinebool, optional
Whether model includes Hamiltonian, Stochastic, and/or Affine errors (e.g. if the model was built with “H+S” parameterization, then only hamiltonian and stochastic should be set to True).
- scale_for_idtbool, optional
Whether rates should be scaled to match the intrinsic rates output by idle tomography. If False, then the rates are simply the coefficients of corresponding terms in the error generator.
Returns
- hamiltonian_rates, stochastic_rates, affine_ratesdict
Dictionaries of error rates. Keys are Pauli labels of length nqubits, e.g. “XIX”, “IIX”, “XZY”. Only nonzero rates are returned.
- pygsti.extras.idletomography.idttools.predicted_intrinsic_rates(nqubits, maxweight, model, hamiltonian=True, stochastic=True, affine=True)
Get the exact intrinsic rates that would be produced by simulating model (for comparison with idle tomography results).
Parameters
- nqubitsint
The number of qubits.
- maxweightint, optional
The maximum weight of errors to consider.
- modelCloudNoiseModel
The model to extract intrinsic error rates from.
- hamiltonian, stochastic, affinebool, optional
Whether model includes Hamiltonian, Stochastic, and/or Affine errors (e.g. if the model was built with “H+S” parameterization, then only hamiltonian and stochastic should be set to True).
Returns
- ham_intrinsic_rates, sto_intrinsic_rates, aff_intrinsic_ratesnumpy.ndarray
Arrays of intrinsic rates. None if corresponding hamiltonian, stochastic or affine is set to False.
- pygsti.extras.idletomography.idttools.predicted_observable_rates(idtresults, typ, nqubits, maxweight, model)
Get the exact observable rates that would be produced by simulating model (for comparison with idle tomography results).
Parameters
- idtresultsIdleTomographyResults
The idle tomography results object used to determing which observable rates should be computed, and the provider of the Jacobian relating the intrinsic rates internal to model to these observable rates.
- typ{“samebasis”,”diffbasis”}
The type of observable rates to predict and return.
- nqubitsint
The number of qubits.
- maxweightint
The maximum weight of errors to consider.
- modelCloudNoiseModel
The noise model to extract error rates from.
Returns
- ratesdict
A dictionary of the form: rate = rates[pauli_fidpair][obsORoutcome], to match the structure of an IdleTomographyResults object’s `