Beispiel #1
0
    def load_test_waveform(self):

        self.awg.delete_all_waveforms()
        self.awg.get_id() #Sometimes AWGs are slow.  If it responds it's ready.

        length = abs(int(1e9/self.if_freq *100))
        qubit_info = mclient.get_qubit_info(self.qubit_info.get_name())

        s = sequencer.Sequence()
        s.append(sequencer.Combined([
                            sequencer.Constant(length, 0.25, chan=qubit_info.sideband_channels[0]),
                            sequencer.Constant(length, 0.25, chan=qubit_info.sideband_channels[1])]))

        s = sequencer.Sequencer(s)

        s.add_ssb(qubit_info.ssb)
        seqs = s.render()
        self.seqs = seqs

        l = awgloader.AWGLoader(bulkload=config.awg_bulkload)
        base = 1
        for i in range(1, 5):
            awg = instruments['AWG%d'%i]
            if awg:
                chanmap = {1:base, 2:base+1, 3:base+2, 4:base+3}
                logging.info('Adding AWG%d, channel map: %s', i, chanmap)
                l.add_awg(awg, chanmap)
                base += 4
        l.load(seqs)
        l.run()
Beispiel #2
0
def MeasurementPulse(pulselen=200, delay=0, ro_delay=0, **kwargs):
    label = kwargs.pop('label', None)
    cb = sequencer.Combined([
        sequencer.Constant(pulselen, 2, chan='m0'),
        sequencer.Sequence([
            sequencer.Delay(delay),
            sequencer.Constant(40, 1, chan='master', **kwargs),
            sequencer.Constant(220, 2, chan='master', **kwargs)
        ]),
    ],
                            label=label,
                            align=sequencer.ALIGN_LEFT)
    if ro_delay == 0:
        return cb
    else:
        return sequencer.Sequence([sequencer.Delay(ro_delay), cb])
Beispiel #3
0
def RegOp(ins, **kwargs):
    length = kwargs.pop('length', REGOPLEN)
    return sequencer.Constant(length,
                              0,
                              chan='master',
                              master_register_instruction=ins,
                              **kwargs)
Beispiel #4
0
    def __call__(self, alpha, phase, amp=None, **kwargs):
        '''
        Generate a rotation pulse of angle <alpha> around axis <phase>.
        If <amp> is specified that amplitude is used and <alpha> is ignored.
        '''

        plen = int(round(self.pi_len * alpha / np.pi / 4.0) * 4)
        print 'Alpha=%s --> plen = %s' % (alpha, plen)
        if plen < 24:
            print 'Warning: pulse length < 24!'
            plen = 24
        return sequencer.Constant(plen, self.val, chan=self.chan)
Beispiel #5
0
    def __call__(self, alpha, amp=None, plot=False, **kwargs):
        '''
        Generate a rotation pulse of angle <alpha> around axis <phase>.
        If <amp> is specified that amplitude is used and <alpha> is ignored.
        '''

        self.determine_correction()

        sequencer.Pulse.RANGE_ACTION = sequencer.IGNORE
        data = self.get_pulse_data()
        name = self.get_pulse_name()
        Ipulse = sequencer.Pulse('%s_I' % name,
                                 np.real(data),
                                 chan=self.chans[0]).rendered()
        Qpulse = sequencer.Pulse('%s_Q' % name,
                                 np.imag(data),
                                 chan=self.chans[1]).rendered()
        if plot:
            plt.figure()
            plt.plot(self.pulse.data)
            plt.plot(np.real(data))
            plt.plot(np.imag(data))
            plt.plot(2 * np.arange(len(data) / 2), np.real(data[::2]), 'ks')
            plt.plot(2 * np.arange(len(data) / 2), np.imag(data[::2]), 'ro')

        pulses = []
        Ipulse.set_params(mixer_amplitudes=(0xffff, 0), **kwargs)
        pulses.append(Ipulse)
        Qpulse.set_params(mixer_amplitudes=(0, 0xffff), **kwargs)
        pulses.append(Qpulse)

        if self.marker_chan is not None:
            mpulse = sequencer.Constant(pulses[0].get_length(),
                                        self.marker_val,
                                        chan=self.marker_chan,
                                        **kwargs)
            pulses.append(mpulse)

        if len(pulses) == 1:
            return sequencer.Sequence(pulses, **kwargs)
        else:
            return sequencer.Combined(pulses, **kwargs)
Beispiel #6
0
def LongMeasurementPulse(pulselen=None,
                         rolen=None,
                         reflen=None,
                         ro_delay=0,
                         pulse_pump=False,
                         **kwargs):
    sequencer.Pulse.RANGE_ACTION = sequencer.IGNORE
    label = kwargs.pop('label', None)
    if pulselen is None:
        pulselen = ro_ins.get_pulse_len()
    if rolen is None:
        rolen = ro_ins.get_acq_len()
    if reflen is None:
        reflen = ro_ins.get_ref_len()

    ro = sequencer.Constant(reflen, 3, chan='master', **kwargs)
    kwargs.pop('master_integrate', None)  # Remove integrate from kwargs
    if reflen != rolen:
        ro = sequencer.Sequence([
            ro,
            sequencer.Constant(rolen - reflen, 2, chan='master', **kwargs)
        ])

    if pulse_pump:
        cb = sequencer.Sequence([
            sequencer.Constant(800, 1, chan='m1'),
            sequencer.Combined([
                sequencer.Constant(pulselen, 2, chan='m0'),
                sequencer.Constant(rolen, 1, chan='m1'),
                ro,
            ],
                               align=sequencer.ALIGN_LEFT)
        ],
                                label=label)
    else:
        cb = sequencer.Combined([
            sequencer.Constant(pulselen, 2, chan='m0'),
            ro,
        ],
                                label=label,
                                align=sequencer.ALIGN_LEFT)

    if ro_delay == 0:
        return cb
    else:
        return sequencer.Sequence([sequencer.Delay(ro_delay), cb])
Beispiel #7
0
def RegDelay(ireg, **kwargs):
    return sequencer.Constant(REGOPLEN, 0, chan=-1, master_register_delay=ireg)
Beispiel #8
0
    def __call__(self, alpha, phase, amp=None, **kwargs):
        '''
        Generate a rotation pulse of angle <alpha> around axis <phase>.
        If <amp> is specified that amplitude is used and <alpha> is ignored.
        '''
        if amp is None:
            amp = self.ampgen(alpha)
        amp *= 65535.0
        pulses = []

        kwargs['chan%d_mixer_amplitudes' %
               self.chans[0]] = (np.cos(phase) * amp, np.sin(phase) * amp)
        kwargs['chan%d_mixer_amplitudes' %
               self.chans[1]] = (-np.sin(phase) * amp, np.cos(phase) * amp)
        if 'detune_period' in kwargs and kwargs['detune_period'] != 0:
            period = kwargs.pop('detune_period')
            ts = np.arange(len(self.Ipulse.data))
            data = self.Ipulse.data * np.exp(2j * np.pi * ts / period)
            if 0:
                import matplotlib.pyplot as plt
                plt.figure()
                plt.plot(ts, np.real(data))
                plt.plot(ts, np.imag(data))
                plt.suptitle('period=%s' % period)
            Ipulse = sequencer.Pulse('%s_re%s' % (self.Ipulse.name, period),
                                     np.real(data),
                                     chan=self.chans[0]).rendered()
            Qpulse = sequencer.Pulse('%s_im%s' % (self.Ipulse.name, period),
                                     np.imag(data),
                                     chan=self.chans[1]).rendered()
            Ipulse.set_params(**kwargs)
            pulses.append(Ipulse)
            Qpulse.set_params(**kwargs)
            pulses.append(Qpulse)

        else:
            if self.Ipulse:
                p = copy.deepcopy(self.Ipulse)
                pulses.append(p)
                pulses[-1].chan = self.chans[0]
                pulses[-1].set_params(**kwargs)
                if not self.Qpulse:
                    pulses.append(
                        sequencer.Constant(self.Ipulse.get_length(),
                                           1e-6,
                                           chan=self.chans[1]))
                    pulses[-1].set_params(
                        mixer_amplitudes=(-amp * np.sin(phase),
                                          amp * np.cos(phase)),
                        **kwargs)
            if self.Qpulse:
                p = copy.deepcopy(self.Qpulse)
                pulses.append(p)
                pulses[-1].chan = self.chans[1]
                pulses[-1].set_params(**kwargs)

        sequencer.Pulse.RANGE_ACTION = sequencer.IGNORE
        if self.marker_chan is not None:
            mpulse = sequencer.Constant(pulses[0].get_length(),
                                        self.marker_val,
                                        chan=self.marker_chan,
                                        **kwargs)
            pulses.append(mpulse)

        if len(pulses) == 1:
            return sequencer.Sequence(pulses)
        else:
            return sequencer.Combined(pulses, **kwargs)
Beispiel #9
0
                                   delay=5,
                                   bgcor=False,
                                   Qswitch_infoA=Qswitch_info1A,
                                   Qswitch_infoB=Qswitch_info1B,
                                   extra_info=[
                                       Qswitch_info1A,
                                       Qswitch_info1B,
                                       cavity_info1B,
                                   ])
        Qfun.measure()

if 0:  # load sequence to AWG2
    import awgloader
    seq = ge(np.pi, 0)
    s = sequencer.Sequence()
    s.append(sequencer.Join([sequencer.Constant(250, 1, chan=3), seq]))
    #    s.append(seq)
    l = awgloader.AWGLoader()
    awg = mclient.instruments['AWG1']
    #    awg = mclient.instruments['AWG2']
    l.add_awg(awg, {1: 1, 2: 2, 3: 3, 4: 4})
    s = sequencer.Sequencer(s)
    s = s.render()
    l.load(s)

bla
if 1:
    iqg = 40.02 + 50.77j
    iqe = 8.02 + 1.21j
    iqg_actual = iqg - (iqe - iqg) / 89.0 * 5.0
    iqe_actual = iqe + (iqe - iqg) / 88.0 * 6.0
Beispiel #10
0
                                     periods=qubit_periods[0::2],
                                     amps=qubit_amps[0::2])
wigodds = fpgapulses.FPGADetunedSum(m.qubit.rotate.Ipulse,
                                    periods=qubit_periods[1::2],
                                    amps=qubit_amps[1::2])

REPRATE_DELAY = 1000000  # Delay to get a reasonable repetition rate

s = sequencer.Sequence()

I0 = DMAX * m.cavity.rotate.pi_amp * 65535
Q0 = I0
DI = round(2.0 * I0 / (NI - 1))
DQ = round(2.0 * Q0 / (NQ - 1))

s.append(sequencer.Constant(512, 1, value=1, chan='m0'))

s.append(fpgapulses.RegOp(RegisterInstruction.MOVI(0, +I0), label='Ireset'))
s.append(fpgapulses.RegOp(RegisterInstruction.MOVI(3, +I0), fpga_counter0=NI))
s.append(fpgapulses.RegOp(RegisterInstruction.MOVI(2, +Q0), label='Qreset'))
s.append(fpgapulses.RegOp(RegisterInstruction.MOVI(1, -Q0), fpga_counter1=NQ))

s.append(sequencer.Constant(256, 1, chan=0, label='displace'))
s.append(stateprep)
s.append(m.cavity.displace(1.0, fpga_mixer_mask=(True, True)))
s.append(wigodds(np.pi, 0))
s.append(fpgapulses.LongMeasurementPulse(label='measure'))
s.append(sequencer.Delay(REPRATE_DELAY))
if BG:
    s.append(stateprep)
    s.append(m.cavity.displace(1.0, fpga_mixer_mask=(True, True)))
Beispiel #11
0
import numpy as np
from pulseseq import sequencer, pulselib
import sys
import time
import fpgapulses
import fpgameasurement
import fpga_sequences
from YngwieEncoding import *

REPRATE_DELAY = 50000  # Delay to get a reasonable repetition rate

m = fpgameasurement.FPGAMeasurement('cool', rrec=False)

s = sequencer.Sequence()

s.append(sequencer.Constant(512, 1, value=1, chan='m0'))
s.append(fpga_sequences.qubit_cool(m, label='qcool', tgtlabel='measure'))
s.append(
    fpgapulses.RegOp(RegisterInstruction.NOP(),
                     master_integrate=m.integrate_log,
                     label='measure'))
s.append(fpgapulses.LongMeasurementPulse())
s.append(sequencer.Delay(REPRATE_DELAY, jump='qcool'))

m.set_seq(s, 10)
#m.generate(plot=True)
m.start_exp()
m.plot_histogram()
Beispiel #12
0
                                            np.linspace(
                                                cav_freq - 0.5e6,
                                                cav_freq + 0.5e6, 61),
                                            Qswitchseq=None)
    cspec.measure()
    bla

if 1:  # pump tone spectroscopy
    from scripts.single_cavity import cavspectroscopy
    cav_freq = 7782.70e6
    seq = sequencer.Join([
        sequencer.Delay(10000),
        sequencer.Combined([
            Qswitch_info1A.rotate(np.pi, 0),  # 250us square pulse pump
            Qswitch_info1B.rotate(np.pi, 0),
            sequencer.Repeat(sequencer.Constant(1000, 0.0001, chan=5),
                             250),  # Qubit/Readout master switch
        ]),
        sequencer.Delay(20000)
    ])
    cspec = cavspectroscopy.CavSpectroscopy(
        mclient.instruments['brick4'],
        qubit_info,
        cavity_info1B, [1.2],
        np.linspace(cav_freq - 0.5e6, cav_freq + 0.5e6, 61),
        Qswitchseq=seq,
        extra_info=[Qswitch_info1A, Qswitch_info1B])
    cspec.measure()
    bla

if 0:  #Find qubit ef
Beispiel #13
0
m = fpgameasurement.FPGAMeasurement('T2', xs=delays / 1000., fit_func=fitf)

s = sequencer.Sequence()

# FPGA style, using R13 as dynamic instruction length,
# doesn't include software detuning though.
# There's a bug in pulseseq which requires the extra label _1/_2: we need
# to make sure that the generated delays are not joined.
if 0:
    s.append(
        fpgapulses.RegOp(ye.RegisterInstruction.MOVI(13, 0),
                         master_counter0=N,
                         label='reset'))

    s.append(sequencer.Constant(512, 1, value=1, chan='m0', label='start'))
    s.append(m.qubit.rotate(np.pi / 2, 0, label='_1'))
    s.append(sequencer.Delay(100, inslength=('R13', 10)))
    s.append(m.qubit.rotate(np.pi / 2, 0, label='_2'))
    s.append(fpgapulses.LongMeasurementPulse(label='measure'))
    s.append(
        fpgapulses.RegOp(ye.RegisterInstruction.ADDI(13, DT / 4),
                         master_counter0=-1,
                         master_internal_function=ye.FPGASignals.c0))
    s.append(sequencer.Delay(REPRATE_DELAY, jump=('reset', 'start')))

# Old-school
else:
    #    m.qubit.rotate = fpgapulses.FPGAMarkerLenRotation(72, 'm0', 1)
    s.append(sequencer.Delay(256, label='start'))
    for curdelay in delays: