From dedb7a198eda783301cfcc4e5b773cf0b7cf0189 Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Tue, 17 Dec 2024 16:18:04 -0500 Subject: [PATCH] Lint passes now --- templates/hamiltonian-simulation/hamsim_template.ipynb | 1 + .../hamsim_template.pregenerated.py | 1 + templates/hamiltonian-simulation/hamsim_template0.ipynb | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/hamiltonian-simulation/hamsim_template.ipynb b/templates/hamiltonian-simulation/hamsim_template.ipynb index c06e6f1..2e16c4d 100644 --- a/templates/hamiltonian-simulation/hamsim_template.ipynb +++ b/templates/hamiltonian-simulation/hamsim_template.ipynb @@ -29,6 +29,7 @@ "metadata": {}, "outputs": [], "source": [ + "# mypy: ignore-errors\n", "from qiskit_serverless import get_arguments, save_result, is_running_in_serverless\n", "\n", "\n", diff --git a/templates/hamiltonian-simulation/hamsim_template.pregenerated.py b/templates/hamiltonian-simulation/hamsim_template.pregenerated.py index a64af56..864139f 100644 --- a/templates/hamiltonian-simulation/hamsim_template.pregenerated.py +++ b/templates/hamiltonian-simulation/hamsim_template.pregenerated.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # coding: utf-8 +# mypy: ignore-errors # # Reducing the Trotter error of Hamiltonian dynamics with approximate quantum compilation # diff --git a/templates/hamiltonian-simulation/hamsim_template0.ipynb b/templates/hamiltonian-simulation/hamsim_template0.ipynb index 3345c87..9b9af91 100644 --- a/templates/hamiltonian-simulation/hamsim_template0.ipynb +++ b/templates/hamiltonian-simulation/hamsim_template0.ipynb @@ -792,14 +792,19 @@ "ref_expval = -0.5887\n", "print(f\"Exact:\\t\\t{ref_expval:.4f}\")\n", "\n", - "print(f\"With AQC:\\t{hw_expvals[0]:.4f} ± {hw_results_dicts[0][\"stds\"].item():.4f}, |∆| = {np.abs(ref_expval - hw_expvals[0]):.4f}\")\n", + "std = hw_results_dicts[0][\"stds\"].item()\n", + "print(\n", + " f\"With AQC:\\t{hw_expvals[0]:.4f} ± {std:.4f}, |∆| = {np.abs(ref_expval - hw_expvals[0]):.4f}\"\n", + ")\n", "\n", "with open(\"hw_results_comparison.pkl\", \"rb\") as f:\n", " hw_results_dicts_0, _ = dill.load(f)\n", "\n", "comparison_expval = hw_results_dicts_0[0][\"evs\"].item()\n", "comparison_std = hw_results_dicts_0[0][\"stds\"].item()\n", - "print(f\"Without AQC:\\t{comparison_expval:.4f} ± {comparison_std:.4f}, |∆| = {np.abs(ref_expval - comparison_expval):.4f}\")" + "print(\n", + " f\"Without AQC:\\t{comparison_expval:.4f} ± {comparison_std:.4f}, |∆| = {np.abs(ref_expval - comparison_expval):.4f}\"\n", + ")" ] }, {