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, target=tags2file, args=(dataPath, tup, cnt)) save_thread.start() cnts_single, cnts_coin = ttag_wrap.getCnts_nowait( Tacq, CoincidenceWindow, gate, heraldChan, buf) fname = 'single_%d_ccode.txt' % dirCnt write2file(dataPath, fname, cnts_single, xo, yo, cnt) fname = 'coin_%d_ccode.txt' % dirCnt write2file(dataPath, fname, cnts_coin, xo, yo, cnt) cnt += 1
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() cnts_single, cnts_coin = ttag_wrap.getCnts_nowait(Tacq, CoincidenceWindow,gate, heraldChan,buf) fname = 'single_%d_ccode.txt'%dirCnt write2file(dataPath, fname, cnts_single, xshift,yshift,cnt) fname = 'coin_%d_ccode.txt'%dirCnt write2file(dataPath, fname,cnts_coin,xshift, yshift,cnt) cnt += 1
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() cnts_single, cnts_coin = ttag_wrap.getCnts_nowait( Tacq, CoincidenceWindow, gate, heraldChan, buf) fname = 'single_%d_ccode.txt' % dirCnt write2file(dataPath, fname, cnts_single, xshift, yshift, cnt) fname = 'coin_%d_ccode.txt' % dirCnt write2file(dataPath, fname, cnts_coin, xshift, yshift, cnt) cnt += 1
#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, target = tags2file, args=(dataPath,tup,cnt)) save_thread.start() cnts_single, cnts_coin = ttag_wrap.getCnts_nowait(Tacq, CoincidenceWindow,gate, heraldChan,buf) fname = 'single_%d_ccode.txt'%dirCnt write2file(dataPath, fname, cnts_single, xo,yo,cnt) fname = 'coin_%d_ccode.txt'%dirCnt write2file(dataPath, fname,cnts_coin,xo,yo,cnt) cnt += 1