Aufgrund einer Wartung wird GitLab am 21.09. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 21.09. between 8:00 and 9:00 am.

Commit e5f37cda authored by Orkun Şensebat's avatar Orkun Şensebat
Browse files

Add current version of translation

parent ddf0eab3
Pipeline #462381 failed with stage
in 12 seconds
import numpy as np
# some initialization
#call random_seed(size=k) # machine/compiler dep# endent
pi = np.pi
twopi = 2*pi
# input data
nsteps = 32
nsamples = 100000
HWP2 = 0 # degrees, orientation of wave plate 2 (EOM2)
T0 = 1000 # (ns), maximum time delay
W = 1 # (ns), time coincidence window
cHWP2 = np.cos(HWP2*pi/180)
sHWP2 = np.sin(HWP2*pi/180)
count = 0 # set all counts to zero
for ipsi0 in range(0, nsteps): # loop over different settings of EOM1
cHWP1 = np.cos(ipsi0*twopi/nsteps)
sHWP1 = np.sin(ipsi0*twopi/nsteps)
for i in range(0, nsamples):
# source
# F90: call random_number(r0)
r0 = np.random.rand()
c1 = np.cos(r0*twopi) # polarization angle x of particle going to station 1
s1 = np.sin(r0*twopi) # polarization angle x + pi/2 of particle going to station 2
c2 = -s1
s2 = c1
# station 1
call Analyzer(c1,s1,cHWP1,sHWP1,T0,j1,l1)
# station 2
call Analyzer(c2,s2,cHWP2,sHWP2,T0,j2,l2)
# count
Count(j1,j2,0,ipsi0) = Count(j1,j2,0,ipsi0)+1 # Malus law model
if(abs(l1-l2)<W) Count(j1,j2,1,ipsi0) = Count(j1,j2,1,ipsi0)+1 # Malus law model + time window
# data analysis
for j in range(0, nsteps):
for i in range(0, 1): # i = 0 <==> no time window, i = 1 <=> use time coincidences
tot(i,j) = sum(count(:,:,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)
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) :
E12(i,j) = E12(i,j)/tot(i,j)
E1(i,j) = E1(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
for i in range(0, 1):
write(7+i,'("# ** DLM Demo EPRB **")')
write(7+i,'("# Input variables: ")')
write(7+i,'("# Nsamples = ",i0)') nsamples
write(7+i,'("# theta HWP2 = ",e11.3)') HWP2
write(7+i,'("# T0 = ",e11.3)') T0
write(7+i,'("# W = ",e11.3)') W
write(7+i,'("# iseed = ",i0)') iseed(1)
write(7+i,'("# Theta <S1.a> <S2.b> <S1.a S2.b> theory S N++ N-+ N+- N-- sum(N..)")')
write(7+i,'("#",116("-"))')
write(7+i,'("# Theta <S1.a> <S2.b> <S1.a S2.b> theory S N++ N-+ N+- N-- sum(N..)")')
for j in range(0, nsteps):
S = 3*E12(i,j)-E12(i,mod(j*3,nsteps)) # correlation of QT
r0 = -np.cos(2*j*twopi/nsteps)
write(7+i,'(1x,6e11.3,5i10)')
j*360.0/nsteps,E1(i,j),E2(i,j),E12(i,j),r0,S,count(:,:,i,j),tot(i,j)
def Analyzer(c,s,cHWP,sHWP,T0,j,l):
# EOM : plane rotation
c2 = cHWP*c+sHWP*s
s2 = -sHWP*c+cHWP*s
x = c2*c2-s2*s2 # cos(2(x-a))
y = 2*c2*s2 # sin(2(x-a))
# Malus law
# F90: call random_number(r0)
r0 = np.random.rand()
if(x>2*r0-1):
j = 0 # +1 event
else:
j = 1 #-1 event
# time delay
# F90: call random_number(r1)
r1 = np.random.rand()
l = y*y*y*y*T0*r1 # delay time: T_0 sin(2*(theta1 - x))**4
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