Skip to content

Commit

Permalink
Merge pull request #34 from QuEraComputing/719-standardize-legends-in…
Browse files Browse the repository at this point in the history
…-the-tutorial-plots

Standardize Plot Legends
  • Loading branch information
weinbe58 authored Oct 18, 2023
2 parents 566475f + ea7bd3e commit ee815f1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/examples/example-1-floquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ def detuning_wf(t, drive_amplitude, drive_frequency):

times = emulator_report.list_param("run_time")
density = [1 - ele.mean() for ele in emulator_report.bitstrings()]
plt.plot(times, density, color="#878787", marker=".", label="emulation")
plt.plot(times, density, color="#878787", marker=".", label="Emulator")

times = hardware_report.list_param("run_time")
density = [1 - ele.mean() for ele in hardware_report.bitstrings()]

plt.plot(times, density, color="#6437FF", linewidth=4, label="qpu")
plt.plot(times, density, color="#6437FF", linewidth=4, label="QPU")
plt.xlabel("Time ($\mu s$)")
plt.ylabel("Rydberg population")
plt.legend()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example-1-rabi.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@

times = emulator_report.list_param("run_time")
density = [1 - ele.mean() for ele in emulator_report.bitstrings()]
plt.plot(times, density, color="#878787", marker=".", label="Emuator")
plt.plot(times, density, color="#878787", marker=".", label="Emulator")

times = hardware_report.list_param("run_time")
density = [1 - ele.mean() for ele in hardware_report.bitstrings()]
plt.plot(times, density, color="#6437FF", linewidth=4, label="QPU")

plt.plot(times, density, color="#6437FF", linewidth=4, label="Hardware")
plt.xlabel("Time ($\mu s$)")
plt.ylabel("Rydberg population")
plt.legend()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example-1-ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@

times = emulator_report.list_param("run_time")
density = [1 - ele.mean() for ele in emulator_report.bitstrings()]
plt.plot(times, density, color="#878787", marker=".", label="emulation")
plt.plot(times, density, color="#878787", marker=".", label="Emulator")

times = hardware_report.list_param("run_time")
density = [1 - ele.mean() for ele in hardware_report.bitstrings()]

plt.plot(times, density, color="#6437FF", linewidth=4, label="qpu")
plt.plot(times, density, color="#6437FF", linewidth=4, label="QPU")
plt.xlabel("Time ($\mu s$)")
plt.ylabel("Rydberg population")
plt.legend()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example-2-multi-qubit-blockaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
ax.set_xlabel("Time")
ax.set_ylabel("Sum of Rydberg Densities")
# emulation
ax.plot(emu_run_times, emu_densities_summed, label="Emulation", color="#878787")
ax.plot(emu_run_times, emu_densities_summed, label="Emulator", color="#878787")
# hardware
ax.plot(hw_run_times, hardware_densities_summed, label="Hardware", color="#6437FF")
ax.plot(hw_run_times, hardware_densities_summed, label="QPU", color="#6437FF")
ax.legend()
ax.set_xlabel("Time ($\mu s$)")
ax.set_ylabel("Sum of Rydberg Densities")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def rydberg_state_probabilities(shot_counts):
(hw_line,) = ax.plot(
emu_run_times,
hw_rydberg_state_probabilities[rydberg_state],
label=rydberg_state + "-Rydberg",
label=rydberg_state + "-Rydberg QPU",
color=color,
)
(emu_line,) = ax.plot(
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/example-2-two-qubit-adiabatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def rydberg_state_probabilities(emu_counts):
(hw_line,) = ax.plot(
emu_distances,
hw_rydberg_state_probabilities[rydberg_state],
label=rydberg_state + "-Rydberg",
label=rydberg_state + "-Rydberg QPU",
color=color,
)
(emu_line,) = ax.plot(
Expand Down
14 changes: 8 additions & 6 deletions docs/examples/example-3-time-sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
os.mkdir("data")

# %% [markdown]
# ## Program Definition We define a program where our geometry is a chain of 11 atoms
# ## Program Definition
# We define a program where our geometry is a chain of 11 atoms
# with a distance of 6.1 micrometers between atoms.

# The pulse schedule presented here should be reminiscent of the Two Qubit Adiabatic
Expand Down Expand Up @@ -117,7 +118,8 @@
save(future, filename)

# %% [markdown]
# ## Plotting the Results To make our lives easier we define a trivial function to
# ## Plotting the Results
# To make our lives easier we define a trivial function to
# extract the probability of the Z2 phase from each of the tasks generated from the
# parameter sweep. The counts are obtained from the `report`of the batch object.

Expand All @@ -135,7 +137,8 @@ def get_z2_probabilities(report):


# %% [markdown]
# ## Extracting Counts And ProbabilitiesWe will now extract the counts and probabilities
# ## Extracting Counts And Probabilities
# We will now extract the counts and probabilities
# from the emulator and hardware runs. We will then plot the results. First we load the
# data from the files:

Expand Down Expand Up @@ -165,9 +168,8 @@ def get_z2_probabilities(report):


plt.plot(emu_sweep_times, emu_probabilities, label="Emulator", color="#878787")
plt.plot(
hardware_sweep_times, hardware_probabilities, label="Hardware", color="#6437FF"
)
plt.plot(hardware_sweep_times, hardware_probabilities, label="QPU", color="#6437FF")

plt.show()

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/example-4-quantum-scar-dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_z2_probabilities(report):
hw_z2_prob = get_z2_probabilities(hardware_report)

plt.plot(emu_run_times, emu_z2_prob, label="Emulator", color="#878787")
plt.plot(hw_run_times, hw_z2_prob, label="Hardware", color="#6437FF")
plt.plot(hw_run_times, hw_z2_prob, label="QPU", color="#6437FF")

plt.legend()
plt.xlabel("Time ($\mu s$)")
Expand Down

0 comments on commit ee815f1

Please sign in to comment.