estimate_observables¶
-
forest.benchmarking.observable_estimation.
estimate_observables
(qc: pyquil.api._quantum_computer.QuantumComputer, obs_expt: forest.benchmarking.observable_estimation.ObservablesExperiment, num_shots: int = 500, symmetrization_method: Callable = None, active_reset: bool = False, show_progress_bar: bool = False) → Iterable[forest.benchmarking.observable_estimation.ExperimentResult]¶ Standard wrapper for estimating the observables in an ObservableExperiment.
Because of the use of default parameters for _measure_bitstrings, this method assumes the program in obs_expt can be compiled to native_quil using only basic_compile; the qc object’s compiler is only used to translate native quil to an executable.
A symmetrization_method can be specified which will be used to generate the necessary symmetrization results. This method should match the api of exhaustive_symmetrization; there, a list of symmetrized programs, the qubits to be measured for each program, the qubits that were flipped for each program, and the original pre-symmetrized program index are returned so that the bitarray results of the symmetrized programs and be processed via consolidate_symmetrization_outputs which returns ‘symmetrized’ results for the original pre-symmetrized programs.
Parameters: - qc – a quantum computer object on which to run the programs necessary to estimate each observable of obs_expt.
- obs_expt – a single ObservablesExperiment with settings pre-grouped as desired.
- num_shots – the number of shots to run each program or each symmetrized program.
- symmetrization_method – if not None, this can be used to symmetrize each program to remove unwanted classical correlations in the qubit measurement readout.
- active_reset – whether or not to begin the program by actively resetting. If true, execution of each of the returned programs in a loop on the QPU will generally be faster.
- show_progress_bar – displays a progress bar via tqdm if true.
Returns: all of the ExperimentResults which hold an estimate of each observable of obs_expt