# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python (cacs)
#     language: python
#     name: cacs_research
# ---

import sys
sys.path.append('/Users/cdp/Documents/GitHub/ArQTiC')
from arqtic.simulation_generator import Simulation_Generator
import numpy as np

#create simulation object
sim_obj = Simulation_Generator("XY_input_randomized.txt")

#connect to IBM
#if this is your first run enter your API key
#sim_obj.connect_IBM(api_key="your_key_here")
sim_obj.connect_IBM()

sim_obj.generate_circuits()

#run circuits on backend
sim_obj.run_circuits()

# +
noiseless_results=sim_obj.result_matrix
import matplotlib.pyplot as plt
plt.plot(noiseless_results)
#plt.ylim(-1,1)
#plt.xlim(0,sim_obj.steps)

plt.xlabel("Simulation Timestep")
plt.ylabel("Excitation Displacement")
plt.show()
# -

sim_obj.QCQS="QC"
sim_obj.device="ibmq_santiago"
sim_obj.run_circuits()


# +
qc_nonconstant=sim_obj.result_matrix

plt.plot(qc_nonconstant)
plt.plot(noiseless_results)
#plt.ylim(-1,1)
#plt.xlim(0,sim_obj.steps)

plt.xlabel("Simulation Timestep")
plt.ylabel("Excitation Displacement")
plt.show()
# -

sim_obj.constant_depth="True"
sim_obj.generate_circuits()
sim_obj.run_circuits()

# +
qc_constantdepth=sim_obj.result_matrix
plt.plot(qc_nonconstant,"r-.")
plt.plot(noiseless_results,"k")
plt.plot(qc_constantdepth,"b--")
#plt.ylim(-1,1)
#plt.xlim(0,sim_obj.steps)

plt.xlabel("Simulation Timestep",fontsize=14)
plt.ylabel("Excitation Displacement",fontsize=14)
plt.savefig("randomized_external_field.png")
plt.show()

# -

sim_obj2=Simulation_Generator("XY_input_zeroext.txt")
sim_obj2.generate_circuits()

sim_obj2.run_circuits()
zero_noiseless=sim_obj2.result_matrix

sim_obj2.QCQS="QC"
sim_obj2.device="ibmq_santiago"
sim_obj2.run_circuits()
zero_hardware=sim_obj2.result_matrix

sim_obj2=Simulation_Generator("XY_input_zeroext.txt")
sim_obj2.QCQS="QC"
sim_obj2.device="ibmq_santiago"
sim_obj2.constant_depth="True"
sim_obj2.generate_circuits()


sim_obj2.run_circuits()
zero_constantdepth=sim_obj2.result_matrix


# +
plt.plot(zero_noiseless,"k")
plt.plot(zero_hardware,"r-.")
plt.plot(zero_constantdepth,"b--")
#plt.ylim(-1,1)
#plt.xlim(0,sim_obj.steps)

plt.xlabel("Simulation Timestep",fontsize=14)
plt.ylabel("Excitation Displacement",fontsize=14)
plt.savefig("zero_external_field.png")
plt.show()

# -



StarcoderdataJupyterScriptsDedupFiltered