Exemplo n.º 1
0
def plot_SH(state_0, state_1, filename = None):
    # state_0 : statevector of denoised state
    # state_1 : statevector of noisy state
    # filename : whether to save figure and figure name
    
    fig = plt.figure(figsize=(15,10))
    plt.axis("off")
    ax1 = fig.add_subplot(2, 2, 1)
    ax2 = fig.add_subplot(2, 2, 2)
    ax3 = fig.add_subplot(2, 2, 3)
    ax4 = fig.add_subplot(2, 2, 4)
    plot_state_hinton(state_1, ax_real = ax1, ax_imag = ax2)
    plot_state_hinton(state_0, ax_real = ax3, ax_imag = ax4)
    
    if filename != None:
        plt.savefig(filename + '.pdf', bbox_inches = 'tight')
Exemplo n.º 2
0
 def qonduit_visualization_state_plot_state_hinton(state):
     return interactive(lambda sv: display(plot_state_hinton(sv)),
                        sv=fixed(state))
Exemplo n.º 3
0
plot_histogram([counts, second_counts], legend=legend)

plot_histogram([counts, second_counts],
               legend=legend,
               sort='desc',
               figsize=(15, 12),
               color=['orange', 'black'],
               bar_labels=False)

from qiskit.visualization import plot_state_city, plot_bloch_multivector
from qiskit.visualization import plot_state_paulivec, plot_state_hinton
from qiskit.visualization import plot_state_qsphere

backend = BasicAer.get_backend('statevector_simulator')
result = execute(bell, backend).result()
psi = result.get_statevector(bell)

plot_state_city(psi)

plot_state_hinton(psi)

plot_state_qsphere(psi)

plot_state_paulivec(psi)

plot_bloch_multivector(psi)

plot_state_city(psi, title="My City", color=['black', 'orange'])

plot_state_hinton(psi, title="My Hinton")
# Get basis gates from noise model
basis_gates = noise_model.basis_gates

# Make a circuit
circ = QuantumCircuit(3, 3)
circ.h(0)
circ.cx(0, 1)
circ.cx(1, 2)
circ.measure([0, 1, 2], [0, 1, 2])

# execute the quantum circuit
result = execute(
    circ,
    Aer.get_backend("statevector_simulator"),
    basis_gates=basis_gates,
    noise_model=noise_model,
).result()
psi = result.get_statevector(circ)
counts = result.get_counts(0)

circ.draw(output="mpl")
plt.show()

plot_state_city(psi)
plot_state_hinton(psi)
plot_state_qsphere(psi)
plot_state_paulivec(psi)
plot_bloch_multivector(psi)

plot_histogram(counts, color="c")