pygsti.extras.rpe.rpeconstruction
Functions for creating RPE Models and Circuit lists
Module Contents
Functions
|
Make a model for simulating RPE, paramaterized by rotation angles. Note |
|
Make cosine and sine circuit lists. These operation sequences are used to estimate the angle specified |
|
Generates a dictionary that contains operation sequences for all RPE cosine and |
|
Generate a fake RPE DataSet using the probabilities obtained from a model. |
- pygsti.extras.rpe.rpeconstruction.create_parameterized_rpe_model(alpha_true, epsilon_true, aux_rot, spam_depol, gate_depol=None, with_id=True, rpeconfig_inst=None)
Make a model for simulating RPE, paramaterized by rotation angles. Note that the output model also has thetaTrue, alpha_true, and epsilon_true added attributes.
Parameters
- alpha_truefloat
Angle of rotation about “fixed axis”
- epsilon_truefloat
Angle of rotation about “loose axis”
- aux_rotfloat
Angle of rotation about the axis perpendicular to fixed and loose axes, that, by similarity transformation, changes loose axis.
- spam_depolfloat
Amount to depolarize SPAM by.
- gate_depolfloat, optional
Amount to depolarize gates by (defaults to None).
- with_idbool, optional
Do we include (perfect) identity or no identity? (Defaults to False; should be False for RPE, True for GST)
- rpeconfig_instRPEconfig object
Declares which model configuration RPE should be trying to fit; determines particular functions and values to be used.
Returns
- Model
The desired model for RPE; model also has attributes thetaTrue, alpha_true, and epsilon_true, automatically extracted.
- pygsti.extras.rpe.rpeconstruction.create_rpe_angle_circuit_lists(k_list, angle_name, rpeconfig_inst)
Make cosine and sine circuit lists. These operation sequences are used to estimate the angle specified by angle_name (‘alpha’, ‘epsilon’, or ‘theta’)
Parameters
- k_listlist of ints
The list of “germ powers” to be used. Typically successive powers of two; e.g. [1,2,4,8,16].
- angle_namestring
The angle to be deduced from these operation sequences. (Choices are ‘alpha’, ‘epsilon’, or ‘theta’)
- rpeconfig_instRPEconfig object
Declares which model configuration RPE should be trying to fit; determines particular functions and values to be used.
Returns
- cosStrListlist of Circuits
The list of “cosine strings” to be used for alpha estimation.
- sinStrListlist of Circuits
The list of “sine strings” to be used for alpha estimation.
- pygsti.extras.rpe.rpeconstruction.create_rpe_angle_circuits_dict(log2k_max_or_k_list, rpeconfig_inst)
Generates a dictionary that contains operation sequences for all RPE cosine and sine experiments for all three angles.
Parameters
- log2k_max_or_k_listint or list
int - log2(Maximum number of times to repeat an RPE germ) list - List of maximum number of times to repeat an RPE germ
- rpeconfig_instRPEconfig object
Declares which model configuration RPE should be trying to fit; determines particular functions and values to be used.
Returns
- totalStrListDdict
A dictionary containing all operation sequences for all sine and cosine experiments for alpha, epsilon, and theta. The keys of the returned dictionary are:
‘alpha’,’cos’ : List of operation sequences for cosine experiments used to determine alpha.
‘alpha’,’sin’ : List of operation sequences for sine experiments used to determine alpha.
- ‘epsilon’,’cos’List of operation sequences for cosine experiments used to
determine epsilon.
‘epsilon’,’sin’ : List of operation sequences for sine experiments used to determine epsilon.
‘theta’,’cos’ : List of operation sequences for cosine experiments used to determine theta.
‘theta’,’sin’ : List of operation sequences for sine experiments used to determine theta.
‘totalStrList’ : All above operation sequences combined into one list; duplicates removed.
- pygsti.extras.rpe.rpeconstruction.create_rpe_dataset(model_or_dataset, string_list_d, n_samples, sample_error='binomial', seed=None)
Generate a fake RPE DataSet using the probabilities obtained from a model. Is a thin wrapper for pygsti.data.simulate_data, changing default behavior of sample_error, and taking a dictionary of operation sequences as input.
Parameters
- model_or_datasetModel or DataSet object
If a Model, the model whose probabilities generate the data. If a DataSet, the data set whose frequencies generate the data.
- string_list_dDictionary of list of (tuples or Circuits)
Each tuple or Circuit contains operation labels and specifies a gate sequence whose counts are included in the returned DataSet. The dictionary must have the key ‘totalStrList’; easiest if this dictionary is generated by make_rpe_string_list_d.
- n_samplesint or list of ints or None
The simulated number of samples for each operation sequence. This only has effect when sample_error == “binomial” or “multinomial”. If an integer, all operation sequences have this number of total samples. If a list, integer elements specify the number of samples for the corresponding operation sequence. If None, then model_or_dataset must be a DataSet, and total counts are taken from it (on a per-circuit basis).
- sample_errorstring, optional
What type of sample error is included in the counts. Can be:
“none” - no sample error: counts are floating point numbers such that the exact probabilty can be found by the ratio of count / total.
“round” - same as “none”, except counts are rounded to the nearest integer.
“binomial” - the number of counts is taken from a binomial distribution. Distribution has parameters p = probability of the operation sequence and n = number of samples. This can only be used when there are exactly two outcome labels in model_or_dataset.
“multinomial” - counts are taken from a multinomial distribution. Distribution has parameters p_k = probability of the operation sequence using the k-th outcome label and n = number of samples. This should not be used for RPE.
- seedint, optional
If not None, a seed for numpy’s random number generator, which is used to sample from the binomial or multinomial distribution.
Returns
- DataSet
A static data set filled with counts for the specified operation sequences.