async def pipulseDetunewave(measure, awg, pilen, n, alpha, delta, name_ch, phaseDiff=0): shift = 200 / 1e9 pilen = pilen / 1e9 envelope = whichEnvelope(measure.envelopename) I, Q, mrk1, mrk2 = wn.zero(), wn.zero(), wn.zero(), wn.zero() for i in [np.pi, 0] * n: pulse = (envelope(pilen) << (0.5 * pilen + shift)) + (envelope(pilen) << (1.5 * pilen + shift)) shift += 2 * pilen wav_I, wav_Q = wn.mixing(pulse, phase=i, freq=delta, phaseDiff=phaseDiff, ratioIQ=-1.0, DRAGScaling=alpha) I, Q = I + wav_I, Q + wav_Q await writeWave(awg, name_ch, (I, Q, mrk1, mrk2)) return I, Q, mrk1, mrk2
async def tomoWave(envelopename='square', during=0, shift=200e-9, Delta_lo=80e6, axis='X', DRAGScaling=None): envelope = whichEnvelope(envelopename) if axis == 'X': phi = 0 pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=DRAGScaling) if axis == 'Y': phi = -np.pi / 2 pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=DRAGScaling) if axis == 'Z': wav_I = wav_Q = wn.zero() return wav_I, wav_Q, wn.zero()
async def rabiWave(envelopename='square', nwave=1, amp=1, during=75e-9, shift=0, Delta_lo=110e6, phase=0, phaseDiff=0, DRAGScaling=None, single=False): shift += 200e-9 envelope = whichEnvelope(envelopename) if single: wave = ((envelope(2 * during) << (shift + during))) * amp else: wave = (((envelope(during) << (shift + during / 2))) + ((envelope(during) << (shift + during / 2 * 3)))) * amp # mwav = (wn.square(2*during+380e-9) << (during+190e-9+10e-9)) * amp mwav = wn.square(2 * during) << (during + shift) pulse, mpulse = wn.zero(), wn.zero() for i in range(nwave): pulse += (wave << 2 * i * during) mpulse += (mwav << 2 * i * during) wav_I, wav_Q = wn.mixing(pulse, phase=phase, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) return wav_I, wav_Q, mpulse, mpulse
async def coherenceWave(measure, t_run=0, during=75e-9, n_wave=0, seqtype='CPMG', detune=3e6, shift=200e-9, Delta_lo=110e6): amp = measure.amp envelopename = measure.envelopename envelope = whichEnvelope(envelopename) pulse1 = envelope(during) << (during / 2 + shift) wavI1, wavQ1 = wn.mixing(pulse1, phase=2 * np.pi * detune * t_run, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) pulse3 = envelope(during) << (t_run + (2 * n_wave + 1.5) * during + shift) wavI3, wavQ3 = wn.mixing(pulse3, phase=0, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) if seqtype == 'CPMG': pulse2, step = wn.zero(), t_run / n_wave for i in range(n_wave): pulse2 += envelope(2 * during) << ((i + 0.5) * step + (i + 1) * 2 * during + shift) wavI2, wavQ2 = wn.mixing(pulse2, phase=np.pi / 2, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) if seqtype == 'PDD': pulse2, step = wn.zero(), t_run / (n_wave + 1) for i in range(n_wave): pulse2 += envelope(2 * during) << ((i + 1) * step + (i + 1) * 2 * during + shift) wavI2, wavQ2 = wn.mixing(pulse2, phase=np.pi / 2, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) wavI, wavQ = wavI1 + wavI2 + wavI3, wavQ1 + wavQ2 + wavQ3 return wavI * amp, wavQ * amp, wn.zero(), wn.zero()
async def ac_stark_wave(measure): awg = measure.awg['awgread'] pulse_read = await modulation_read(measure, measure.delta, tdelay=measure.readlen) width = 500e-9 pulse = wn.square(width) << (width / 2 + 3000e-9) I, Q = wn.zero(), wn.zero() for i in measure.delta: wav_I, wav_Q = wn.mixing(pulse, phase=0.0, freq=i, ratioIQ=-1.0) I, Q = I + wav_I, Q + wav_Q pulse_acstark = (I, Q, wn.zero(), wn.zero()) pulselist = np.array(pulse_read) + np.array(pulse_acstark) await writeWave(awg, ['Readout_I', 'Readout_Q'], pulselist)
async def coherenceWave(awg, t_run, during=75e-9, n_wave=0, seqtype='CPMG', detune=3e6, shift=200e-9, Delta_lo=80e6, name=['Ex_I', 'Ex_Q']): pulse1 = wn.square(during) << (during / 2 + shift) wavI1, wavQ1 = wn.mixing(pulse1, phase=2 * np.pi * detune * t_run, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) pulse3 = wn.square(during) << (t_run + (2 * n_wave + 1.5) * during + shift) wavI3, wavQ3 = wn.mixing(pulse3, phase=0, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) if seqtype == 'CPMG': pulse2, step = wn.zero(), t_run / n_wave for i in range(n_wave): pulse2 += wn.square(2 * during) << ((i + 0.5) * step + (i + 1) * 2 * during + shift) wavI2, wavQ2 = wn.mixing(pulse2, phase=np.pi / 2, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) if seqtype == 'PDD': pulse2, step = wn.zero(), t_run / (n_wave + 1) for i in range(n_wave): pulse2 += wn.square(2 * during) << ((i + 1) * step + (i + 1) * 2 * during + shift) wavI2, wavQ2 = wn.mixing(pulse2, phase=np.pi / 2, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=0.0, DRAGScaling=None) wavI, wavQ = wavI1 + wavI2 + wavI3, wavQ1 + wavQ2 + wavQ3 I, Q = wavI(t_new), wavQ(t_new) await awg.update_waveform(I, name[0]) await awg.update_waveform(Q, name[1])
async def HDWave(measure, awg, pilen, coef, axis, nwave, name_ch): pulseequator2 = await tomoWave(measure.envelopename, during=pilen / 1e9, Delta_lo=110e6, axis='Xhalf', DRAGScaling=coef, phaseDiff=0) pulsem, shift = np.array([wn.zero()] * 4), 0 for i in range(nwave): shift += pilen / 1e9 + 10e-9 pulse1 = await tomoWave(measure.envelopename, during=pilen / 1e9, shift=shift, Delta_lo=110e6, axis=axis[0], DRAGScaling=coef, phaseDiff=0) shift += pilen / 1e9 + 10e-9 pulse2 = await tomoWave(measure.envelopename, during=pilen / 1e9, shift=shift, Delta_lo=110e6, axis=axis[1], DRAGScaling=coef, phaseDiff=0) pulsem += (np.array(pulse1) + np.array(pulse2)) pulseequator1 = await tomoWave(measure.envelopename,during=pilen/1e9,shift=(shift+pilen/1e9+10e-9),\ Delta_lo=110e6,axis='Xhalf',DRAGScaling=coef,phaseDiff=0) pulse = np.array(pulseequator1) + np.array(pulseequator2) + np.array( pulsem) await writeWave(awg, name_ch, pulse)
async def rabiWave(envelopename='square', nwave=1, amp=1, during=75e-9, shift=200e-9, Delta_lo=80e6, phase=0, phaseDiff=0, DRAGScaling=None): envelope = whichEnvelope(envelopename) wave = (((envelope(during) << (shift + during / 2))) + ((envelope(during) << (shift + during / 2 * 3)))) * amp # wave = ((wn.cosPulse(2*during) << (shift+during))) mwav = (wn.square(2 * during) << (during + shift)) * amp pulse = mpulse = wn.zero() for i in range(nwave): pulse += wave * amp << 2 * i * during mpulse += mwav * amp << 2 * i * during wav_I, wav_Q = wn.mixing(pulse, phase=phase, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) return wav_I, wav_Q, mpulse
async def pipulseDetunewave(measure, awg, pilen, axisshift, alpha, name_ch): wav_I = wav_Q = mrk1 = wn.zero() for i in axisshift: pulse = await rabiWave(envelopename=measure.envelopename, during=pilen / 1e9, shift=(200 + i[0]) / 1e9, phase=i[1], DRAGScaling=alpha) wav_I, wav_Q, mrk1 = wav_I + pulse[0], wav_Q + pulse[1], mrk1 + pulse[2] pulse = (wav_I, wav_Q, mrk1) await writeWave(awg, name_ch, pulse)
async def tomoTest(measure, awg, t, halfpi, axis, name): gatepulse = await rabiWave(measure.envelopename, during=t / 1e9, shift=(200 + halfpi) / 1e9, Delta_lo=80e6) # gatepulse = await rabiWave(envelopename=measure.envelopename,during=halfpi/1e9) tomopulse = await tomoWave(measure.envelopename, halfpi / 1e9, Delta_lo=80e6, axis=axis) pulse = gatepulse[0] + tomopulse[0], gatepulse[1] + tomopulse[1], wn.zero() await writeWave(awg, name, pulse)
async def modulation_read(measure, delta, tdelay=1100, repeats=512, phase=0.0, amp=0.3, rname=['Readout_I', 'Readout_Q']): t_list, ats, awg = measure.t_list, measure.ats, measure.awg['awgread'] await awg.stop() twidth, n, measure.readlen = tdelay, len(delta), tdelay wavelen = (twidth // 64) * 64 if wavelen < twidth: wavelen += 64 measure.wavelen = int(wavelen) await genwaveform(awg, rname, [1, 5]) ringup = 100 # pulse1 = wn.square((wavelen-ringup)/1e9) >> ((wavelen+ringup)/ 1e9 / 2) pulse1 = wn.square(wavelen / 1e9) >> (wavelen / 1e9 / 2 + ringup / 1e9) pulse2 = wn.square(ringup / 1e9) >> (ringup / 2 / 1e9) pulse = amp * pulse1 + pulse2 mrkp1 = wn.square(25000e-9) << (25000e-9 / 2 + 300e-9) mrkp2 = wn.square( wavelen / 1e9) >> (wavelen / 1e9 / 2 + 440 / 1e9 + ringup / 1e9) # mrkp3 = wn.square(4000/1e9) >> 1000/1e9 mrkp4 = wn.square(5000 / 1e9) << (2500 + 84995) / 1e9 I, Q = wn.zero(), wn.zero() for i in delta: wav_I, wav_Q = wn.mixing(pulse, phase=phase, freq=i, ratioIQ=-1.0) I, Q = I + wav_I, Q + wav_Q pulselist = I, Q, (mrkp2, ), (mrkp4, mrkp4, mrkp1, mrkp4) await writeWave(awg, rname, pulselist, True, mark=True) await awg.setValue('Vpp', 1.5 * n, ch=1) await awg.setValue('Vpp', 1.5 * n, ch=5) await awg.write('*WAI') await ats_setup(ats, delta, l=tdelay, repeats=repeats) await couldRun(awg) return pulselist
async def tomoWave(envelopename='square', during=0, shift=0, Delta_lo=110e6, axis='X', DRAGScaling=None, phaseDiff=0): shift += 200e-9 envelope = whichEnvelope(envelopename) if axis == 'X': phi = 0 pulse = (((envelope(during) << (shift + during / 2))) + ((envelope(during) << (shift + during / 2 * 3)))) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Xhalf': phi = 0 pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Xnhalf': phi = np.pi pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Y': phi = np.pi / 2 pulse = (((envelope(during) << (shift + during / 2))) + ((envelope(during) << (shift + during / 2 * 3)))) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Ynhalf': phi = -np.pi / 2 pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Yhalf': phi = np.pi / 2 pulse = envelope(during) << (shift + during / 2) wav_I, wav_Q = wn.mixing(pulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) if axis == 'Z': wav_I, wav_Q = wn.zero(), wn.zero() return wav_I, wav_Q, wn.zero(), wn.zero()
async def rbWave(measure, m, gate, pilen, Delta_lo=110e6, shift=0, phaseDiff=0.0, DRAGScaling=None): op = { '1': ['I'], '2': ['X'], '3': ['Xhalf'], '4': ['Xnhalf'], '5': ['Y'], '6': ['Yhalf'], '7': ['Ynhalf'], '8': ['X', 'Y'], '9': ['Xhalf', 'Yhalf', 'Xnhalf'], '10': ['Xhalf', 'Ynhalf', 'Xnhalf'], '11': ['Ynhalf', 'X'], '12': ['Yhalf', 'X'], '13': ['Xhalf', 'Y'], '14': ['Xnhalf', 'Y'], '15': ['Xhalf', 'Yhalf', 'Xhalf'], '16': ['Xnhalf', 'Yhalf', 'Xnhalf'], '17': ['Xhalf', 'Yhalf'], '18': ['Xnhalf', 'Yhalf'], '19': ['Xhalf', 'Ynhalf'], '20': ['Xnhalf', 'Ynhalf'], '21': ['Ynhalf', 'Xnhalf'], '22': ['Ynhalf', 'Xhalf'], '23': ['Yhalf', 'Xnhalf'], '24': ['Yhalf', 'Xhalf'] } mseq = mx.cliffordGroup_single(m, gate) if mseq == []: return rotseq = [] for i in mseq[::-1]: rotseq += op[i] waveseq_I, waveseq_Q, wav = wn.zero(), wn.zero(), wn.zero() # rotseq = ['Xhalf','Xnhalf','Yhalf','Ynhalf']*m # if rotseq == []: # return # print(rotseq) for i in rotseq: paras = genParas(i) if i == 'I': waveseq_I += wn.zero() waveseq_Q += wn.zero() # continue else: pulse = genXY(during=pilen, pulse=paras[1], envelopename=measure.envelopename) cosPulse = pulse << shift phi = paras[0] wav_I, wav_Q = wn.mixing(cosPulse, phase=phi, freq=Delta_lo, ratioIQ=-1.0, phaseDiff=phaseDiff, DRAGScaling=DRAGScaling) waveseq_I += wav_I waveseq_Q += wav_Q if paras[1] == 'pi': shift += 2 * pilen if paras[1] == 'halfpi': shift += pilen return waveseq_I, waveseq_Q, wn.zero(), wn.zero()