Commit 54aa3914 authored by Orkun Şensebat's avatar Orkun Şensebat
Browse files

Produce desired plot

parent 2bdb32cb
Pipeline #463838 passed with stage
in 52 seconds
import numpy as np import numpy as np
import matplotlib.pyplot as plt
# some initialization # some initialization
...@@ -53,32 +54,29 @@ for ipsi0 in range(nsteps): # loop over different settings of EOM1 ...@@ -53,32 +54,29 @@ for ipsi0 in range(nsteps): # loop over different settings of EOM1
count[j1, j2, 1, ipsi0] = count[j1, j2, 1, ipsi0] + 1 # Malus law model + time window count[j1, j2, 1, ipsi0] = count[j1, j2, 1, ipsi0] + 1 # Malus law model + time window
# data analysis # data analysis
tot = np.zeros(shape=(2, nsteps), dtype=np.int16) tot = np.zeros(shape=(2, nsteps), dtype=np.int32)
E12 = np.zeros(shape=(2, nsteps), dtype=np.float64) E12 = np.zeros(shape=(2, nsteps), dtype=np.float64)
E1 = np.zeros(shape=(2, nsteps), dtype=np.float64) E1 = np.zeros(shape=(2, nsteps), dtype=np.float64)
E2 = np.zeros(shape=(2, nsteps), dtype=np.float64) E2 = np.zeros(shape=(2, nsteps), dtype=np.float64)
for j in range(nsteps): for j in range(nsteps):
for i in [0, 1]: # i = 0 <==> no time window, i = 1 <=> use time coincidences for i in [0, 1]:
tot[i, j] = np.sum(count[:, :, i, j]) # i = 0 <==> no time window, i = 1 <=> use time coincidences
#tot[i, j] = np.sum(count[:, :, i, j])
tot[i, j] = count[0, 0, i, j] + count[1, 1, i, j] + count[1, 0, i, j] + count[0, 1, i, j]
E12[i, j] = count[0, 0, i, j] + count[1, 1, i, j] - count[1, 0, i, j] - count[0, 1, i, j] E12[i, j] = count[0, 0, i, j] + count[1, 1, i, j] - count[1, 0, i, j] - count[0, 1, i, j]
E1[i, j] = count[0, 0, i, j] + count[0, 1, i, j] - count[1, 1, i, j] - count[1, 0, i, j] E1[i, j] = count[0, 0, i, j] + count[0, 1, i, j] - count[1, 1, i, j] - count[1, 0, i, j]
E2[i, j] = count[0, 0, i, j] + count[1, 0, i, j] - count[1, 1, i, j] - count[0, 1, i, j] E2[i, j] = count[0, 0, i, j] + count[1, 0, i, j] - count[1, 1, i, j] - count[0, 1, i, j]
if(tot[i, j]>0) : if(tot[i, j]>0):
E12[i, j] = E12[i, j]/tot[i, j] E12[i, j] = E12[i, j]/tot[i, j]
E1[i, j] = E1[i, j]/tot[i, j] E1[i, j] = E1[i, j]/tot[i, j]
E2[i, j] = E2[i, j]/tot[i, j] E2[i, j] = E2[i, j]/tot[i, j]
# print out to two different files, suitable for plotting by GNUPLOT theta = np.linspace(0, 360, nsteps)
for i in [0, 1]: theta_theory = np.linspace(0, 360, nsteps*100)
print('("# ** DLM Demo EPRB **")') theory = []
print('("# Input variables: ")') for j in range(nsteps*100):
print('("# Nsamples = ', nsamples, '"') theory.append(-np.cos(2 * j * 2 * np.pi / nsteps / 100))
print('("# theta HWP2 = ', HWP2, '"') plt.plot(theta, E12[0, :], 'o')
print('("# T0 = ', T0, '"') plt.plot(theta_theory, theory, '.', markersize=1)
print('("# W = ', W, '"') plt.savefig('e12.pdf')
print('("# seed = ', wxyz, '"') plt.close()
print('("# Theta <S1.a> <S2.b> <S1.a S2.b> theory S N++ N-+ N+- N-- sum(N..)")') \ No newline at end of file
for j in range(nsteps):
S = 3*E12[i, j] - E12[i, (j*3)%nsteps] # correlation of QT
r0 = -np.cos(2*j*2*np.pi/nsteps)
print(j*360.0/nsteps, E1[i, j], E2[i, j], E12[i, j], r0, S, count[:, :, i, j].flatten(), tot[i, j])
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment