コード例 #1
0
ファイル: Delays.py プロジェクト: hbofffw/full-qkd-system
def check_correlations(aliceTtags, aliceChannels, bobTtags, bobChannels,
                       resolution, A_B_timetags, A_B_channels, channels1,
                       channels2, delays, coincidence_window_radius):

    for delay, ch1, ch2 in zip(delays, channels1, channels2):
        if delay < 0:
            A_B_timetags[A_B_channels == ch2] += (abs(delay)).astype(uint64)
        else:
            A_B_timetags[A_B_channels == ch1] += delay.astype(uint64)

    indexes_of_order = A_B_timetags.argsort(kind="mergesort")
    A_B_channels = take(A_B_channels, indexes_of_order)
    A_B_timetags = take(A_B_timetags, indexes_of_order)

    buf_num = ttag.getfreebuffer()
    buffer = ttag.TTBuffer(buf_num, create=True, datapoints=int(5e7))
    buffer.resolution = 260e-12
    buffer.channels = max(A_B_channels) + 1
    buffer.addarray(A_B_channels, A_B_timetags)

    buf_num = ttag.getfreebuffer()
    bufDelays = ttag.TTBuffer(buf_num, create=True, datapoints=int(5e7))
    bufDelays.resolution = resolution
    bufDelays.channels = max(A_B_channels) + 1
    bufDelays.addarray(A_B_channels, A_B_timetags.astype(uint64))

    with_delays = (bufDelays.coincidences(
        (A_B_timetags[-1] - 1) * bufDelays.resolution,
        coincidence_window_radius))
    remade = remake_coincidence_matrix(with_delays)

    print "__COINCIDENCES WITH DELAYS ->>\n", remade.astype(uint64)
コード例 #2
0
ファイル: Delays.py プロジェクト: KwiatQIM/full-qkd-system
def check_correlations(aliceTtags,aliceChannels,bobTtags,bobChannels,resolution, A_B_timetags, A_B_channels,channels1,channels2,delays,coincidence_window_radius):

    for delay,ch1,ch2 in zip(delays,channels1,channels2):
        if delay < 0:
            A_B_timetags[A_B_channels == ch2] += (abs(delay)).astype(uint64)
        else:
            A_B_timetags[A_B_channels == ch1] += delay.astype(uint64)
               
    indexes_of_order = A_B_timetags.argsort(kind = "mergesort")
    A_B_channels = take(A_B_channels,indexes_of_order)
    A_B_timetags = take(A_B_timetags,indexes_of_order)      

    buf_num = ttag.getfreebuffer() 
    buffer = ttag.TTBuffer(buf_num,create=True,datapoints = int(5e7))
    buffer.resolution = 260e-12
    buffer.channels = max(A_B_channels)+1
    buffer.addarray(A_B_channels,A_B_timetags)

    
    buf_num = ttag.getfreebuffer()
    bufDelays = ttag.TTBuffer(buf_num,create=True,datapoints = int(5e7))
    bufDelays.resolution = resolution
    bufDelays.channels = max(A_B_channels)+1
    bufDelays.addarray(A_B_channels,A_B_timetags.astype(uint64))
     
    
    
    with_delays = (bufDelays.coincidences((A_B_timetags[-1]-1)*bufDelays.resolution, coincidence_window_radius))
    remade = remake_coincidence_matrix(with_delays)
    
    print "__COINCIDENCES WITH DELAYS ->>\n",remade.astype(uint64)
コード例 #3
0
ファイル: Delays.py プロジェクト: KwiatQIM/full-qkd-system
def calculate_delays(aliceTtags,aliceChannels,bobTtags,bobChannels,
                    resolution= 260e-12,
                    coincidence_window_radius = 200-12,
                    delay_max = 1e-6):
    
    channels1 = [0,1,2,3]
    channels2 = [4,5,6,7]
    
    A_B_timetags = concatenate([aliceTtags,bobTtags])
    A_B_channels = concatenate([aliceChannels,bobChannels])

    indexes_of_order = A_B_timetags.argsort(kind = "mergesort")
    A_B_channels = take(A_B_channels,indexes_of_order)
    A_B_timetags = take(A_B_timetags,indexes_of_order)

    buf_num = ttag.getfreebuffer()
    bufN = ttag.TTBuffer(buf_num,create=True,datapoints = int(5e11))
    bufN.resolution = resolution
    bufN.channels = max(A_B_channels)+1
    bufN.addarray(A_B_channels,A_B_timetags)

    coincidences_before = (bufN.coincidences((A_B_timetags[-1]-1)*bufN.resolution, coincidence_window_radius))
    remade = remake_coincidence_matrix(coincidences_before)
    print "__COINCIDENCES BEFORE-->>\n",remade.astype(uint64)

    channel_number  = int(max(append(channels1,channels2)))
    delays = zeros(channel_number)
    k = 0
    for i,j in zip(channels1, channels2):
        delays[i] = (getDelay(bufN,i,j,delaymax=delay_max,time=(A_B_timetags[-1]-1)*bufN.resolution))/bufN.resolution
        print delays[i]
        k+=1
    check_correlations(aliceTtags, aliceChannels, bobTtags, bobChannels, resolution, A_B_timetags, A_B_channels, channels1, channels2, delays, coincidence_window_radius)
    print("Saving delays to file.")
    save("./resultsLaurynas/Delays/delays.npy",delays)
コード例 #4
0
ファイル: SA_Exp_v2.py プロジェクト: mallman777/ttag
def startTagger():
  global buf
  ttnumber = ttag.getfreebuffer()-1
  print "ttnumber: ", ttnumber
  buf = ttag.TTBuffer(ttnumber)  #Opens the buffer
  #  Timetag time units are float 
  buf.start()
  return buf
コード例 #5
0
ファイル: ttag_wrap.py プロジェクト: mallman777/ttag
def openttag(toFile = None):
    fromFile = '/mnt/odrive/HPD/ShanePyStuff/scripts/UQDttagger2/ttag/UQD/src/uqd.uqcfg'
    ttnumber = ttag.getfreebuffer()-1
    print "ttnumber: ", ttnumber
    buf = ttag.TTBuffer(ttnumber)  #Opens the buffer
    buf.tagsAsTime = False
    #buf.start()
    if toFile != None:
      shutil.copyfile(fromFile, toFile)
    return buf
コード例 #6
0
def openttag(toFile=None):
    fromFile = '/mnt/odrive/HPD/ShanePyStuff/scripts/UQDttagger2/ttag/UQD/src/uqd.uqcfg'
    ttnumber = ttag.getfreebuffer() - 1
    print "ttnumber: ", ttnumber
    buf = ttag.TTBuffer(ttnumber)  #Opens the buffer
    buf.tagsAsTime = False
    #buf.start()
    if toFile != None:
        shutil.copyfile(fromFile, toFile)
    return buf
コード例 #7
0
ファイル: quickstop.py プロジェクト: mallman777/ttag
import ttag
bufNum = ttag.getfreebuffer() - 1 
buf = ttag.TTBuffer(bufNum)
buf.stop()

コード例 #8
0
###################

#Run UQDinterface
# is this needed anymore? SN, May 17, 2014
#args = ['sudo', 'bash','launch.sh']
#f = open('test','w')
#process = subprocess.Popen(args,stdout=f)

#print "The process ID is:"
#print process.pid+1  # p.pid is the PID for the new shell.  p.pid is the PID for UQDinterface in the new shell
#print process.pid+2
#time.sleep(1)

#ttnumber = int(raw_input("Time tagger to open:"))
ttnumber = ttag.getfreebuffer()-1
print "ttnumber: ", ttnumber
buf = ttag.TTBuffer(ttnumber)  #Opens the buffer
buf.tagsAsTime = False
buf.start()
time.sleep(1)

print "Channels:", buf.channels
print "Resolution:", buf.resolution
print "Datapoints:", buf.datapoints
print "Buffer size:", buf.size()

ptr = 0

updateTime = ptime.time()
fps = 0
コード例 #9
0
ファイル: randWalk.py プロジェクト: mallman777/ttag
def startTagger():
  ttnumber = ttag.getfreebuffer()-1
  print "ttnumber: ", ttnumber
  buf = ttag.TTBuffer(ttnumber)  #Opens the buffer
  return buf
コード例 #10
0
    return (bob,alice,bob_pol,alice_pol)

if (__name__ == '__main__'):
   # alice_raw_filename = raw_input("Insert filename with Alice counts: ")
    # bob_raw_filename = raw_input("Insert filename with Bob counts: ")
    numpy.set_printoptions(edgeitems = 100)

    alice_raw_filename = "power238_1s_0.csv"
    bob_raw_filename = "power238_1s_1.csv"
    
    resolution = 5e-11
    alice_bob_ch_ttag =read_raw_file(alice_raw_filename, bob_raw_filename,resolution)
    saveprep("06-03-2014",alice_bob_ch_ttag[1],alice_bob_ch_ttag[3],alice_bob_ch_ttag[0],alice_bob_ch_ttag[2])
    
    buf_num = ttag.getfreebuffer()
#     buf = ttag.TTBuffer(buf_num,create=True,datapoints = len(alice_bob_ch_ttag[0]))
#     buf.resolution = resolution
#     buf.channels = max(alice_bob_ch_ttag[0])+1
#     buf.addarray(alice_bob_ch_ttag[0],alice_bob_ch_ttag[1])
#     buf.addarray(alice_bob_ch_ttag[2],alice_bob_ch_ttag[3])
#     print(len(alice_bob_ch_ttag[0]),len(alice_bob_ch_ttag[1]),len(alice_bob_ch_ttag[2]),len(alice_bob_ch_ttag[3])
#     print (buf.coincidences(2.0, 1e-5))
    print("Combining arrays")
     
    A_B_timetags = concatenate((alice_bob_ch_ttag[1],alice_bob_ch_ttag[3]))
    A_B_channels = concatenate((alice_bob_ch_ttag[0],alice_bob_ch_ttag[2]))
    #print A_B_timetags
    #print A_B_channels
    
    indexes_of_order = A_B_timetags.argsort(kind = "mergesort")
コード例 #11
0
ファイル: histGui.py プロジェクト: mallman777/ttag
def startBuffer():
  bufNum = ttag.getfreebuffer()-1
  buf = ttag.TTBuffer(bufNum)
  buf.start()
  time.sleep(1)
  return buf
コード例 #12
0
def startBuffer():
    bufNum = ttag.getfreebuffer() - 1
    buf = ttag.TTBuffer(bufNum)
    buf.start()
    time.sleep(1)
    return buf