-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlotter_Errors.py
62 lines (54 loc) · 1.72 KB
/
Plotter_Errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'''
Another program to print pretty plots of the 1D QWalk simulations for Errors
B.Sudarsan
March 28,2017
'''
import numpy as np
import matplotlib.pyplot as plt
#fsim = open("Error-checker-Biased-Sim-analytic-N=50.dat","rb")
out = np.loadtxt("Error-checker-Biased-Sim-analytic-N=50.dat")
#print out[:,0]
timestep = out[:,0]
probr = out[:,1]
probi = out[:,2]
probsimr = out[:,3]
probsimi = out[:,4]
errr = out[:,5]
erri = out[:,6]
errsimr = out[:,7]
errsimi = out[:,8]
'''
#Plot the results
plt.plot(xtheo,probtheo,label='Theoretical result')
plt.plot(xsim,probsim,label='Simulation result')
plt.title("Comparison between theory and simulation, 1D random walk")
plt.legend(loc='lower right')
plt.show()
#Plot the deviation
chi2_mag = np.dot(chi2.T,chi2)
plt.plot(xsim,chi2,label='chi2 between results')
plt.title("Chi2 deviation between results:"+str(chi2_mag))
plt.show()
'''
plt.plot(timestep,probr,'x-',label='Analytic,Re(P)')
plt.plot(timestep,probi,'x-',label='Analytic,Im(P)')
plt.plot(timestep,probsimr,label='Simulation,Re(P)')
plt.plot(timestep,probsimi,label='Simulation,Im(P)')
plt.title("Tot. probability P versus time, initial state: Coin=|0>, Lattice=|0>")
plt.legend(loc='lower right')
plt.xlabel('Timestep t')
plt.ylabel('Total probability')
ax = plt.gca()
ax.set_ylim([-1.5,1.5])
plt.show()
plt.plot(timestep,errr,'x-',label='Re(Integ.err) from quad()')
plt.plot(timestep,erri,'x-',label='Im(Integ.err) from quad()')
plt.plot(timestep,errsimr,label='Re|Psi(sim)-Psi(analyt)|')
plt.plot(timestep,errsimi,label='Im|Psi(sim)-Psi(analyt)|')
plt.title("Error vs time, initial state: Coin=|0>, Lattice=|0>")
plt.legend(loc='lower right')
plt.xlabel('Timestep t')
plt.ylabel('Error')
ax = plt.gca()
ax.set_ylim([-1.5e-14,1.5e-14])
plt.show()