Esempio n. 1
0
    CoincidenceWindow = 10e-9
    gate = 10e-9
    heraldChan = 0
    # get nanowire pixel locations from scan
    scanparams = np.loadtxt(dataPathInterp+'scanparameters.txt') 
    (xstart,xstop,xstep,ystart,ystop,ystep)=scanparams
    pixel_list = gp.interpolate2SLM(dataPathInterp, xstart, xstep, ystart, ystep)
    
    pixel = 27  # aim for middle of the nanowire array
    [xo,yo]= pixel_list[pixel,:]

    nrows = 512
    cnt = 0
    seed = 1  # use same random pattern all the time
    # compute random phase and set alice
    code = gp.encrypt(seed,512,128) 
    # figure phases to point to pixel
    fft_phase = gp.initial_phase_orig(257-xo,257-yo, 512)
    fft_phase += code
    gp.write2file(fft_phase, gp.phasemap, SLMpath, '99')

    for xshift in range(-10,11):
        for yshift in range(-10,11):
            print 'xshift, yshift: %3d %3d'%(xshift,yshift)
            # send decoding matrix to Bob SLM, vary xshift, yshift
            decode = gp.decrypt(code, xshift, yshift, nrows)
            gp.write2file(decode, gp.phasemap, SLMpath, '100')
            send(99)
            msg = wait()
            if int(msg)<0:
                print 'Problem with SLM setting'
Esempio n. 2
0
    infofp.write('# use the pixel mapping in this folder %s\n' %
                 dataPathInterp)
    infofp.write('# Tacq %f\n' % Tacq)
    infofp.write('#  BOB SLM xshift: %d, yshift: %d\n' % (xshift, yshift))
    infofp.close()

    cnt = 0
    while True:
        for pixel in range(64):
            [xo, yo] = pixel_list[pixel, :]
            print '%2d: %.3f %.3f' % (pixel, xo, yo)
            fft_phase = gp.initial_phase_orig(257 - xo, 257 - yo, 512)
            #print 'phase_offset',gp.phase_offset
            # generate encoding matrix
            seed = cnt + 1
            code = gp.encrypt(seed, 512, 128)
            fft_phase += code
            # send to Alice SLM
            gp.write2file(fft_phase, gp.phasemap, SLMpath, '99')
            # send decoding matrix to Bob SLM
            decode = gp.decrypt(code, xshift, yshift, nrows)
            gp.write2file(decode, gp.phasemap, SLMpath, '100')
            send(99)
            msg = wait()
            time.sleep(0.1)
            if int(msg) < 0:
                print 'Problem with SLM setting'
                break
            # start taking data
            start = buf.datapoints
            time.sleep(Tacq)
Esempio n. 3
0
    infofp.write('# Tacq %f\n' % Tacq)
    infofp.write('#  BOB SLM xshift: %d, yshift: %d\n' % (xshift, yshift))
    infofp.close()

    cnt = 0
    while True:
        for pixel in range(64):
            [xo, yo] = pixel_list[pixel, :]
            print '%2d: %.3f %.3f' % (pixel, xo, yo)
            for seedA in range(8):
                fft_phase = gp.initial_phase_orig(257 - xo, 257 - yo, 512)
                #print 'phase_offset',gp.phase_offset
                # generate encoding matrix
                #seed = cnt+1
                codeA = gp.encrypt(
                    seedA + 1, 512,
                    128)  #using seed+1 to make consistent with matlab ???
                fft_phase += codeA
                # send to Alice SLM
                gp.write2file(fft_phase, gp.phasemap, SLMpath, '99')
                for seedB in range(8):
                    # send decoding matrix to Bob SLM
                    codeB = gp.encrypt(seedB + 1, 512, 128)
                    decode = gp.decrypt(codeB, xshift, yshift, nrows)
                    gp.write2file(decode, gp.phasemap, SLMpath, '100')
                    send(99)
                    msg = wait()
                    time.sleep(0.1)
                    if int(msg) < 0:
                        print 'Problem with SLM setting'
                        break