def StartRamsey( AFG_Freq=200.0e6, AFG_Amp=1.0, CoolingTime=1.0 * unit.ms, # ms PumpingTime=100.0 * unit.us, # us DetectingTime=1000 * unit.us, # us RabiTime=18.6 * unit.us, t0=0.0 * unit.us, # start us t=1000.0 * unit.us, # stop us N=400, # Points AFG_N=1048570 # 1.04857 ms AFG Pulse Length ): global Task t = np.linspace(t0, t, N) Inst = GenRamseyInst(t, RabiTime, CoolingTime, PumpingTime, DetectingTime) Task = SpinTask(Inst, N, Continue=True) SetAFG_Freq(AFG_Freq, AFG_Amp, CoolingTime, PumpingTime, DetectingTime, AFG_N) return t
def triggerstop(): # 停止放大器工作,继续cooling ssss = [(wordCooling, OptC.BRANCH, 0, 4.0 * unit.ms)] SpinTask(ssss, 4, Continue=False) print('MW is stopped')
# timeTag=((start0,pulse length1),(stardt,pulse length2),(start3,pulse # length3)...) 对应Z0,Z1,X0,Y0四组测量 t0, dt = zip(*timeTag) # -----//-----compesation delay of AFG, we should triger the AFG 1.290 us in advance t0 = np.array(t0) + 1.03 timeTag = zip(t0, dt) # -----//-----给t0加上triger触发修正之后重新得到timeTag # print timeTag,t0[0] N = 100 # -----//-----将脉冲时序传给控制卡 InstListData = GenInstList(timeTag, CoolingTime, PumpingTime, DetectingTime) print(InstListData) # -----//-----4组测量,依次进行一次,然后整体重复N次。可以减少因激光功率变化或者离子移动问题造成的误差 Task = SpinTask(InstListData, 4 * N, Continue=True) Task.StartTask() # 打印结果,重复运行200次 k = 4 # 输入脉冲数 Data = np.zeros(k) # -----//-----实际PMT采集到的光子数 plus = np.zeros(k) # -----//-----阈值判断后得到的比特值 for j in range(15): temp = Task.Read() # -----//-----读取PMT数据 for i in range(N): for a in range(k): # -----//-----对读数进行0,1赋值判断 # print temp[k*i],temp[k*i+1],temp[k*i+2],temp[k*i+3] if temp[k * i + a] < 0.9: # -----//-----阈值设定并赋值0和1 plus[a] = 1.0 # -----//-----测到暗态为1 else: plus[a] = 0.0
InstListData.append( (wordPumpingTriger, OptC.CONTINUE, 0, ts * unit.us)) InstListData.append( (wordOperating, OptC.CONTINUE, 0, pl * unit.us)) else: InstListData.append( (wordCooling, OptC.CONTINUE, 0, CoolingTime * unit.ms - (ts - PumpingTime) * unit.us)) #InstListData.append((wordCooling,OptC.WAIT,0,1.0*unit.us)) # wait for line trigger InstListData.append((wordCoolingTriger, OptC.CONTINUE, 0, (ts - PumpingTime + 0.010) * unit.us)) InstListData.append((wordPumping, OptC.CONTINUE, 0, (PumpingTime - 0.010) * unit.us)) InstListData.append( (wordOperating, OptC.CONTINUE, 0, pl * unit.us)) #InstListData.append((wordOperating,OptC.CONTINUE,0,constime*unit.us)) InstListData.append( (wordDetecting, OptC.CONTINUE, 0, DetectingTime * unit.us)) InstListData.append((wordIdle, OptC.CONTINUE, 0, 1.0 * unit.us)) InstListData.append( (wordIdle, OptC.BRANCH, 1, 1.0 * unit.us)) #delay,then next cycle Task = SpinTask(InstListData, RabiPoints * N, Continue=True) ### Task.StartTask() ## timer.start(200) win.show() app.exec_() triggerstop() #停止放大器工作,继续cooling
fre = freq2 PiPulse = RabiTime * 0.5 #us operation time M=0 40.2 M=1 38.1 N = 200 #Points t1 = 600 #E8257D.write(':FREQ:FIX 9.644818870GHZ') Data = np.zeros(N) th = ThresIntegrator(N * 2) InstListData = [] pulselist = ((t1, 0), (t1, 0)) tlist = np.linspace(0, 2 * t1, N) X = tlist InstListData = mainFun() #print InstListData WAV, timeTag = GenWave(pulselist, fre * 2 * pi) setChannelWave32K(2, WAV, amplitude=1.0) # note 幅度在这里设置 time.sleep(2) Task = SpinTask(InstListData, N * 2, Continue=True) Task.StartTask() timer.start(200) win.show() app.exec_() print "Exit" #停止放大器工作,继续cooling triggerstop() #停止放大器工作,继续cooling
curve.setData(y=y, x=tlist0) freq, popt, pcov = fitFringer(tlist0, y) # perr = np.sqrt(np.diag(pcov)) fitY = funSin(tlist0, *popt) curveFit.setData(y=fitY, x=tlist0) A = popt[2] B = popt[3] if A < 0: fringe = (-A / (2 * B + A)) else: fringe = (A / (2 * B + A)) print(fringe, freq) timer = QtCore.QTimer() timer.timeout.connect(update) timer.start(200) win.show() app.exec_() print("Exit") Task.StopTask() ssss = [(wordCooling, OptC.CONTINUE, 0, 4.0 * unit.ms), (wordCooling, OptC.BRANCH, 0, 4.0 * unit.ms)] Task = SpinTask(ssss, 4, Continue=False) Task.StartTask()