diff --git a/docs/source/guide/calibrators.md b/docs/source/guide/calibrators.md index e6db0f4f4..617dc94d1 100644 --- a/docs/source/guide/calibrators.md +++ b/docs/source/guide/calibrators.md @@ -57,6 +57,19 @@ print(cal.get_cost()) cal.run() ``` +## Verbose Log Output + +To print results from the experiments the calibrator performs, the `log` parameter can be passed in to the `run` method with either the value of `flat` or `cartesian`. By using the `log` parameter, detailed information about each experiment is printed when the `run` method completes. + +The detailed information can also be generated from the results of the calibrator after `run` is called by calling either {meth}`.log_results_flat` or {meth}`.log_results_cartesian`. + +The two options display the information in different formats, though both use a cross (✘) or a check (✔) to signal whether the error mitigation expirement obtained an expectation value better than the non-mitigated one. + +```{code-cell} ipython3 +# cal.results.log_results_flat() +cal.results.log_results_cartesian() +``` + ## Applying the optimal error mitigation strategy We first define randomized benchmarking circuit to test the effect of error mitigation. @@ -86,12 +99,10 @@ def execute(circuit, noise_level=0.001): cal.execute_with_mitigation(circuit, execute) ``` -```{code-cell} ipython3 - -``` - ## Tutorial You can find an example on quantum error mitigation calibration in the **[Examples](../examples/calibration-tutorial.md)** section of the documentation. This example illustrates functionalities from the calibration module using ZNE on a simulated IBM Quantum backend using Qiskit, defining a new settings object. + ++++ diff --git a/mitiq/calibration/calibrator.py b/mitiq/calibration/calibrator.py index 4f81fb6c0..f034d0bc8 100644 --- a/mitiq/calibration/calibrator.py +++ b/mitiq/calibration/calibrator.py @@ -297,7 +297,13 @@ def get_cost(self) -> Dict[str, int]: } def run(self, log: Optional[OutputForm] = None) -> None: - """Runs all the circuits required for calibration.""" + """Runs all the circuits required for calibration. + + args: + log: If set, detailed results of each experiment run by the + calibrator are printed. The value corresponds to the format of + the information and can be set to “flat” or “cartesian”. + """ if not self.results.is_missing_data(): self.results.reset_data()