Skip to content

Commit

Permalink
Merge pull request #398 from SRI-International/hydrogen-lattice
Browse files Browse the repository at this point in the history
For area plots, remove exceedingly long initial elapsed times
  • Loading branch information
rtvuser1 authored Sep 12, 2023
2 parents 7349874 + 05917ab commit 723a13a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 21 additions & 4 deletions _common/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
# Option to include all app charts with vplots at end
do_app_charts_with_all_metrics = False

# Toss out elapsed times for any run if the initial value is this factor of the second value
# (applies only to area plots - remove once queue time is removed earlier)
omit_initial_elapsed_time_factor = 10

# Number of ticks on volumetric depth axis
max_depth_log = 22

Expand Down Expand Up @@ -1733,14 +1737,27 @@ def plot_area_metrics(suptitle='',
x_last, score_last = 0, 0
x_sizes, x_points, y_points, score_points = [], [], [], []

for it in circuit_metrics_detail_2[group][circuit_id]:
mets = circuit_metrics_detail_2[group][circuit_id][it]

metrics_array = circuit_metrics_detail_2[group][circuit_id]

for it in metrics_array:
mets = metrics_array[it]

if x_metric not in mets: break
if score_metric not in mets: break

x_value = mets[x_metric]

# DEVNOTE: A brutally simplistic way to toss out initially long elapsed times
# that are most likely due to either queueing or system initialization
if x_metric == 'elapsed_time' and it == 0 and omit_initial_elapsed_time_factor > 0:
if (it + 1) in metrics_array:
mets2 = metrics_array[it + 1]
x_value2 = mets2[x_metric]
if x_value > (omit_initial_elapsed_time_factor * x_value2):
x_value = x_value2

# get each metric and accumulate if indicated
x_raw = x_now = mets[x_metric]
x_raw = x_now = x_value
if cumulative_flag:
x_now += x_last
x_last = x_now
Expand Down
1 change: 0 additions & 1 deletion hydrogen-lattice/qiskit/hydrogen_lattice_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,6 @@ def execution_handler2(qc, result, num_qubits, s_int, num_shots):
ex.set_tranpilation_flags(do_transpile_metrics=True, do_transpile_for_execute=True)

# get the classically computed expected energy variables from solution object
hf_energy = float(next(value for key, value in solution if key == "hf_energy"))
doci_energy = float(next(value for key, value in solution if key == "doci_energy"))
fci_energy = float(next(value for key, value in solution if key == "fci_energy"))
hf_energy = float(next(value for key, value in solution if key == "hf_energy"))
Expand Down

0 comments on commit 723a13a

Please sign in to comment.