Esempio n. 1
0
    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)
            stop = buf.datapoints
            if logtags:
                tup = buf[-(stop -
                            start):]  # a tuple of chan tags, and time tags
                save_thread = threading.Thread(None,
Esempio n. 2
0
    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'
                raise('Problem with SLM setting')
                break
            # start taking data
            start = buf.datapoints
            time.sleep(Tacq)
            stop = buf.datapoints
            if logtags:
                tup = buf[-(stop - start):]  # a tuple of chan tags, and time tags
                save_thread = threading.Thread(None, target = tags2file, args=(dataPath, tup,cnt))
                save_thread.start()