def gauss_phase_fix(wtpts,mtpts,origin,marker_start_buffer,marker_end_buffer,pulse_location,pulse,pulse_info,qubit_dc_offset,t0=0):

    if pulse_info['fix_phase']:
        # print "Phase of qubit pulse is being fixed"
        # print "qubit DC offset is %s" %(qubit_dc_offset)
        qubit_waveforms = ap.sideband(wtpts,
                                 ap.gauss(wtpts, pulse.amp,
                                          origin - pulse_location - 0.5*pulse.span_length,
                                          pulse.length), np.zeros(len(wtpts)),
                                 pulse.freq, phase= 360*(qubit_dc_offset+pulse.add_freq)/1e9*(wtpts+pulse_location)+ pulse.phase)
        qubit_marker = ap.square(mtpts, 1,
                                                  origin - pulse_location - pulse.span_length - marker_start_buffer,
                                                  pulse.span_length + marker_start_buffer- marker_end_buffer)
        return (qubit_waveforms,qubit_marker)




    else:
        qubit_waveforms = ap.sideband(wtpts,
                                 ap.gauss(wtpts, pulse.amp,
                                          origin - pulse_location - 0.5*pulse.span_length,
                                          pulse.length), np.zeros(len(wtpts)),
                                 pulse.freq, pulse.phase,t0=t0)
        qubit_marker = ap.square(mtpts, 1,
                                                  origin - pulse_location - pulse.span_length - marker_start_buffer,
                                                  pulse.span_length + marker_start_buffer- marker_end_buffer)
        return (qubit_waveforms,qubit_marker)
Esempio n. 2
0
    def build_sequence(self):
        PulseSequence.build_sequence(self)

        wtpts = self.get_waveform_times('qubit drive I')
        mtpts = self.get_marker_times('qubit buffer')

        ii = 0
        w = self.pi_length
        a = self.pulse_cfg['a']
        print(a)
        print(w)

        if self.pi_pulse:
            if self.pulse_type == 'square':
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.square(wtpts, a, self.origin - w - 2 * self.ramp_sigma , w,
                                            self.ramp_sigma), np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)

                self.markers['qubit buffer'][ii] = ap.square(
                    mtpts, 1, self.origin - w - 4 * self.ramp_sigma -
                    self.marker_start_buffer,
                    w + 4 * self.ramp_sigma + self.marker_start_buffer)

            if self.pulse_type == 'gauss':
                gauss_sigma = w  #covention for the width of gauss pulse
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.gauss(wtpts, a, self.origin - 2 * gauss_sigma , gauss_sigma),
                                 np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)
                self.markers['qubit buffer'][ii] = ap.square(
                    mtpts, 1,
                    self.origin - 4 * gauss_sigma - self.marker_start_buffer,
                    4 * gauss_sigma + self.marker_start_buffer)

        self.markers['readout pulse'][ii] = ap.square(
            mtpts, 1, self.origin + self.measurement_delay,
            self.measurement_width)
        self.markers['card trigger'][ii] = ap.square(
            mtpts, 1, self.origin - self.card_delay + self.measurement_delay,
            self.card_trig_width)

        # print "Saving vacuum Rabi pulse..."
        np.save('pi_pulse_vacuum_rabi', self.waveforms['qubit drive I'])
        np.save('pi_pulse_vacuum_rabi_time', wtpts)
        np.save('readout_pulse', self.markers['readout pulse'])
        np.save('readout_pulse_time', mtpts)
def flux_gauss(ftpts,pulse_location,pulse):
    waveforms_qubit_flux = ap.sideband(ftpts,
                             ap.gauss(ftpts, pulse.amp,
                                      pulse_location - 0.5*pulse.span_length,
                                      pulse.length), np.zeros(len(ftpts)),
                             pulse.freq, pulse.phase)[1]
    return waveforms_qubit_flux
def flux_square(ftpts,pulse_location,pulse,pulse_cfg):

    waveforms_qubit_flux = ap.sideband(ftpts,
                                     ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, pulse_cfg['square'][
                                                                  'ramp_sigma']), np.zeros(len(ftpts)),
                                      pulse.freq, pulse.phase,offset=False)[0]
    return waveforms_qubit_flux
Esempio n. 5
0
def square(wtpts,
           mtpts,
           origin,
           marker_start_buffer,
           marker_end_buffer,
           pulse_location,
           pulse,
           pulse_cfg,
           t0=0):
    # code test 4/26/2017
    qubit_waveforms = ap.sideband(wtpts,
                                  ap.square(
                                      wtpts, pulse.amp,
                                      origin - pulse_location - pulse.length -
                                      0.5 * (pulse.span_length - pulse.length),
                                      pulse.length,
                                      pulse_cfg['square']['ramp_sigma']),
                                  np.zeros(len(wtpts)),
                                  pulse.freq,
                                  pulse.phase,
                                  t0=t0)
    qubit_marker = ap.square(
        mtpts, 1,
        origin - pulse_location - pulse.span_length - marker_start_buffer,
        pulse.span_length + marker_start_buffer - marker_end_buffer)
    # qubit_waveforms = ap.sideband(wtpts,
    #                          ap.square(wtpts, pulse.amp,
    #                                    origin - pulse_location - pulse.length - 0.5*(pulse.span_length - pulse.length), pulse.length,
    #                                    pulse_cfg['square']['ramp_sigma']),
    #                          np.zeros(len(wtpts)),
    #                          pulse.freq, 360*(pulse.add_freq)/1e9*(wtpts+pulse_location)+pulse.phase)
    # qubit_marker = ap.square(mtpts, 1, origin - pulse_location - pulse.span_length - marker_start_buffer,
    #                                                           pulse.span_length + marker_start_buffer - marker_end_buffer)

    return (qubit_waveforms, qubit_marker)
Esempio n. 6
0
def flux_gauss(ftpts, pulse_location, pulse):
    waveforms_qubit_flux = ap.sideband(
        ftpts,
        ap.gauss(ftpts, pulse.amp,
                 pulse_location - 0.5 * pulse.span_length, pulse.length),
        np.zeros(len(ftpts)), pulse.freq, pulse.phase)[1]
    return waveforms_qubit_flux
Esempio n. 7
0
    def build_sequence(self):
        PulseSequence.build_sequence(self)

        wtpts = self.get_waveform_times('qubit drive I')
        mtpts = self.get_marker_times('qubit buffer')

        ii = 0
        w =self.pi_length
        a=self.pulse_cfg['a']
        print(a)
        print(w)

        if self.pi_pulse:
            if self.pulse_type == 'square':
                    self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                        ap.sideband(wtpts,
                                     ap.square(wtpts, a, self.origin - w - 2 * self.ramp_sigma , w,
                                                self.ramp_sigma), np.zeros(len(wtpts)),
                                     self.pulse_cfg['iq_freq'], 0)

                    self.markers['qubit buffer'][ii] = ap.square(mtpts, 1,
                                                                  self.origin - w - 4 * self.ramp_sigma - self.marker_start_buffer,
                                                                  w + 4 * self.ramp_sigma + self.marker_start_buffer)

            if self.pulse_type == 'gauss':
                gauss_sigma = w  #covention for the width of gauss pulse
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.gauss(wtpts, a, self.origin - 2 * gauss_sigma , gauss_sigma),
                                 np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)
                self.markers['qubit buffer'][ii] = ap.square(mtpts, 1, self.origin - 4 * gauss_sigma - self.marker_start_buffer ,
                                                              4 * gauss_sigma + self.marker_start_buffer)

        self.markers['readout pulse'][ii] = ap.square(mtpts, 1, self.origin + self.measurement_delay,
                                                       self.measurement_width)
        self.markers['card trigger'][ii] = ap.square(mtpts, 1,
                                                      self.origin - self.card_delay + self.measurement_delay,
                                                      self.card_trig_width)

        # print "Saving vacuum Rabi pulse..."
        np.save('pi_pulse_vacuum_rabi',self.waveforms['qubit drive I'])
        np.save('pi_pulse_vacuum_rabi_time',wtpts)
        np.save('readout_pulse',self.markers['readout pulse'])
        np.save('readout_pulse_time',mtpts)
Esempio n. 8
0
def gauss_phase_fix(wtpts,
                    mtpts,
                    origin,
                    marker_start_buffer,
                    marker_end_buffer,
                    pulse_location,
                    pulse,
                    pulse_info,
                    qubit_dc_offset,
                    t0=0):

    if pulse_info['fix_phase']:
        # print "Phase of qubit pulse is being fixed"
        # print "qubit DC offset is %s" %(qubit_dc_offset)
        qubit_waveforms = ap.sideband(
            wtpts,
            ap.gauss(wtpts, pulse.amp,
                     origin - pulse_location - 0.5 * pulse.span_length,
                     pulse.length),
            np.zeros(len(wtpts)),
            pulse.freq,
            phase=360 * (qubit_dc_offset + pulse.add_freq) / 1e9 *
            (wtpts + pulse_location) + pulse.phase)
        qubit_marker = ap.square(
            mtpts, 1,
            origin - pulse_location - pulse.span_length - marker_start_buffer,
            pulse.span_length + marker_start_buffer - marker_end_buffer)
        return (qubit_waveforms, qubit_marker)

    else:
        qubit_waveforms = ap.sideband(
            wtpts,
            ap.gauss(wtpts, pulse.amp,
                     origin - pulse_location - 0.5 * pulse.span_length,
                     pulse.length),
            np.zeros(len(wtpts)),
            pulse.freq,
            pulse.phase,
            t0=t0)
        qubit_marker = ap.square(
            mtpts, 1,
            origin - pulse_location - pulse.span_length - marker_start_buffer,
            pulse.span_length + marker_start_buffer - marker_end_buffer)
        return (qubit_waveforms, qubit_marker)
def gauss(wtpts,mtpts,origin,marker_start_buffer,marker_end_buffer,pulse_location,pulse):
    qubit_waveforms = ap.sideband(wtpts,
                             ap.gauss(wtpts, pulse.amp,
                                      origin - pulse_location - 0.5*pulse.span_length,
                                      pulse.length), np.zeros(len(wtpts)),
                             pulse.freq, pulse.phase)
    qubit_marker = ap.square(mtpts, 1,
                                              origin - pulse_location - pulse.span_length - marker_start_buffer,
                                              pulse.span_length + marker_start_buffer- marker_end_buffer)
    return (qubit_waveforms,qubit_marker)
Esempio n. 10
0
    def build_sequence(self):
        PulseSequence.build_sequence(self)

        wtpts = self.get_waveform_times('qubit drive I')
        mtpts = self.get_marker_times('qubit buffer')

        for ii, d in enumerate(self.histo_pts):
            self.markers['readout pulse'][ii] = ap.square(
                mtpts, 1, self.origin + self.measurement_delay,
                self.measurement_width)
            self.markers['card trigger'][ii] = ap.square(
                mtpts, 1,
                self.origin - self.card_delay + self.measurement_delay,
                self.card_trig_width)

            w = self.pi_length
            a = d * self.a

            if self.pulse_type == 'square':
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.square(wtpts, a, self.origin - w - 2 * self.ramp_sigma , w,
                                            self.ramp_sigma), np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)

                self.markers['qubit buffer'][ii] = ap.square(
                    mtpts, 1, self.origin - w - 4 * self.ramp_sigma -
                    self.marker_start_buffer,
                    w + 4 * self.ramp_sigma + self.marker_start_buffer)

            if self.pulse_type == 'gauss':
                gauss_sigma = w  #covention for the width of gauss pulse
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.gauss(wtpts, a, self.origin - 3 * gauss_sigma , gauss_sigma),
                                 np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)

                self.markers['qubit buffer'][ii] = ap.square(
                    mtpts, 1,
                    self.origin - 6 * gauss_sigma - self.marker_start_buffer,
                    6 * gauss_sigma + self.marker_start_buffer)
def flux_square_tt(ftpts,pulse_location,pulse,pulse_cfg):
    freq_c = pulse_cfg['twotonecfreq']
    relphase = pulse_cfg['twotonephase']
    waveforms_qubit_flux = ap.sideband(ftpts,
                                     ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, pulse_cfg['square'][
                                                                  'ramp_sigma']), np.zeros(len(ftpts)),
                                      freq_c-pulse.freq/2.0, pulse.phase,offset=False)[0] + ap.sideband(ftpts,
                                     ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, pulse_cfg['square'][
                                                                  'ramp_sigma']), np.zeros(len(ftpts)),
                                      freq_c+pulse.freq/2.0, pulse.phase + relphase,offset=False)[0]
    return waveforms_qubit_flux
Esempio n. 12
0
def gauss(wtpts, mtpts, origin, marker_start_buffer, marker_end_buffer,
          pulse_location, pulse):
    qubit_waveforms = ap.sideband(
        wtpts,
        ap.gauss(wtpts, pulse.amp,
                 origin - pulse_location - 0.5 * pulse.span_length,
                 pulse.length), np.zeros(len(wtpts)), pulse.freq, pulse.phase)
    qubit_marker = ap.square(
        mtpts, 1,
        origin - pulse_location - pulse.span_length - marker_start_buffer,
        pulse.span_length + marker_start_buffer - marker_end_buffer)
    return (qubit_waveforms, qubit_marker)
Esempio n. 13
0
def flux_square(ftpts, pulse_location, pulse, pulse_cfg):

    waveforms_qubit_flux = ap.sideband(
        ftpts,
        ap.square(
            ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
            (pulse.span_length - pulse.length), pulse.length,
            pulse_cfg['square']['ramp_sigma']),
        np.zeros(len(ftpts)),
        pulse.freq,
        pulse.phase,
        offset=False)[0]
    return waveforms_qubit_flux
Esempio n. 14
0
def flux_square_tt(ftpts, pulse_location, pulse, pulse_cfg):
    freq_c = pulse_cfg['twotonecfreq']
    relphase = pulse_cfg['twotonephase']
    waveforms_qubit_flux = ap.sideband(
        ftpts,
        ap.square(
            ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
            (pulse.span_length - pulse.length), pulse.length,
            pulse_cfg['square']['ramp_sigma']),
        np.zeros(len(ftpts)),
        freq_c - pulse.freq / 2.0,
        pulse.phase,
        offset=False)[0] + ap.sideband(
            ftpts,
            ap.square(
                ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                (pulse.span_length - pulse.length), pulse.length,
                pulse_cfg['square']['ramp_sigma']),
            np.zeros(len(ftpts)),
            freq_c + pulse.freq / 2.0,
            pulse.phase + relphase,
            offset=False)[0]
    return waveforms_qubit_flux
Esempio n. 15
0
    def build_sequence(self):
        PulseSequence.build_sequence(self)

        wtpts = self.get_waveform_times('qubit drive I')
        mtpts = self.get_marker_times('qubit buffer')

        for ii, d in enumerate(self.histo_pts):
            self.markers['readout pulse'][ii] = ap.square(mtpts, 1, self.origin + self.measurement_delay,
                                                           self.measurement_width)
            self.markers['card trigger'][ii] = ap.square(mtpts, 1,
                                                          self.origin - self.card_delay + self.measurement_delay,
                                                          self.card_trig_width)

            w = self.pi_length
            a = d * self.a

            if self.pulse_type == 'square':
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.square(wtpts, a, self.origin - w - 2 * self.ramp_sigma , w,
                                            self.ramp_sigma), np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)

                self.markers['qubit buffer'][ii] = ap.square(mtpts, 1,
                                                              self.origin - w - 4 * self.ramp_sigma - self.marker_start_buffer,
                                                              w + 4 * self.ramp_sigma + self.marker_start_buffer)

            if self.pulse_type == 'gauss':
                gauss_sigma = w  #covention for the width of gauss pulse
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.gauss(wtpts, a, self.origin - 3 * gauss_sigma , gauss_sigma),
                                 np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)

                self.markers['qubit buffer'][ii] = ap.square(mtpts, 1, self.origin - 6 * gauss_sigma - self.marker_start_buffer ,
                                                              6 * gauss_sigma + self.marker_start_buffer)
def flux_square_phase_fix(ftpts,pulse_location,pulse,pulse_cfg, mm_target_info, flux_pulse_info):

    if flux_pulse_info['chirp'] and flux_pulse_info['fix_phase']:
        if pulse.name[-1] == "f":
            dc_offset = mm_target_info['dc_offset_freq_ef']
            shifted_frequency = mm_target_info['flux_pulse_freq_ef']
            offset_fit_quad_ef=dc_offset/(mm_target_info['a_ef']**2)
            time_step = ftpts[1]-ftpts[0]
            f_integ_array = 360.0*np.cumsum(offset_fit_quad_ef*ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, mm_target_info['ramp_sigma_ef'])**2)*time_step/1.0e9
            # print f_integ_array[-1]
            # print f_integ_array[0]
            # print np.shape(f_integ_array)

            bare_frequency = shifted_frequency+dc_offset
            waveforms_qubit_flux = ap.sideband(ftpts,
                                             ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, mm_target_info['ramp_sigma_ef']), np.zeros(len(ftpts)),freq=bare_frequency, phase= 360*(pulse.add_freq)/1e9*(ftpts-pulse_location)+pulse.phase - f_integ_array ,offset=True,offset_fit_quad=offset_fit_quad_ef)[0]

        else:
            dc_offset = mm_target_info['dc_offset_freq']
            print(dc_offset)
            shifted_frequency = mm_target_info['flux_pulse_freq']
            bare_frequency = shifted_frequency+dc_offset
            waveforms_qubit_flux = ap.sideband(ftpts,
                                             ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length,mm_target_info['ramp_sigma']), np.zeros(len(ftpts)),freq=bare_frequency, phase= 360*(-dc_offset+pulse.add_freq)/1e9*(ftpts-pulse_location)+pulse.phase,offset=False)[0]


    elif flux_pulse_info['fix_phase']:

        if pulse.name[-1] == "f":
            dc_offset = mm_target_info['dc_offset_freq_ef']
            shifted_frequency = mm_target_info['flux_pulse_freq_ef']
            bare_frequency = shifted_frequency+dc_offset
            # print mm_target_info['ramp_sigma_ef']
            waveforms_qubit_flux = ap.sideband(ftpts,
                                             ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, mm_target_info['ramp_sigma_ef']), np.zeros(len(ftpts)),freq=bare_frequency, phase= 360*(-dc_offset + pulse.add_freq)/1e9*(ftpts-pulse_location)+pulse.phase,offset=False)[0]

        else:
            dc_offset = mm_target_info['dc_offset_freq']
            shifted_frequency = mm_target_info['flux_pulse_freq']
            bare_frequency = shifted_frequency+dc_offset
            waveforms_qubit_flux = ap.sideband(ftpts,
                                             ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length,mm_target_info['ramp_sigma']), np.zeros(len(ftpts)),freq=bare_frequency, phase= 360*(-dc_offset+pulse.add_freq)/1e9*(ftpts-pulse_location)+pulse.phase,offset=False)[0]

    else:
        if pulse.name[-1] == "f":
            waveforms_qubit_flux = ap.sideband(ftpts,
                                               ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, mm_target_info['ramp_sigma_ef']), np.zeros(len(ftpts)),
                                              mm_target_info['flux_pulse_freq_ef'], pulse.phase,offset=False)[0]

        else:
            waveforms_qubit_flux = ap.sideband(ftpts,
                                   ap.square(ftpts, pulse.amp, pulse_location-pulse.length-0.5*(pulse.span_length - pulse.length) , pulse.length, mm_target_info['ramp_sigma']), np.zeros(len(ftpts)),
                                  pulse.freq, pulse.phase,offset=False)[0]

    # print np.shape(waveforms_qubit_flux)

    return waveforms_qubit_flux
def square(wtpts,mtpts,origin,marker_start_buffer,marker_end_buffer,pulse_location,pulse,pulse_cfg,t0=0):
    # code test 4/26/2017
    qubit_waveforms = ap.sideband(wtpts,
                             ap.square(wtpts, pulse.amp,
                                       origin - pulse_location - pulse.length - 0.5*(pulse.span_length - pulse.length), pulse.length,
                                       pulse_cfg['square']['ramp_sigma']),
                             np.zeros(len(wtpts)),
                             pulse.freq, pulse.phase,t0=t0)
    qubit_marker = ap.square(mtpts, 1, origin - pulse_location - pulse.span_length - marker_start_buffer,
                                                              pulse.span_length + marker_start_buffer - marker_end_buffer)
    # qubit_waveforms = ap.sideband(wtpts,
    #                          ap.square(wtpts, pulse.amp,
    #                                    origin - pulse_location - pulse.length - 0.5*(pulse.span_length - pulse.length), pulse.length,
    #                                    pulse_cfg['square']['ramp_sigma']),
    #                          np.zeros(len(wtpts)),
    #                          pulse.freq, 360*(pulse.add_freq)/1e9*(wtpts+pulse_location)+pulse.phase)
    # qubit_marker = ap.square(mtpts, 1, origin - pulse_location - pulse.span_length - marker_start_buffer,
    #                                                           pulse.span_length + marker_start_buffer - marker_end_buffer)


    return (qubit_waveforms,qubit_marker)
Esempio n. 18
0
    def build_sequence(self):
        PulseSequence.build_sequence(self)
        wtpts = self.get_waveform_times('qubit drive I')
        mtpts = self.get_marker_times('qubit buffer')
        ftpts = self.get_waveform_times('qubit 1 flux')
        print(len(ftpts))

        print("max = " +str(np.max(ftpts)))
        print("min = " +str(np.min(ftpts)))

        ii = 0
        w =self.pi_length
        a=self.pulse_cfg['a']
        if self.load_photon:
            start_pi = -self.flux_length
        else:
            start_pi = 0

        print(a)
        print(w)

        if self.pi_pulse:
            if self.pulse_type == 'square':
                    self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                        ap.sideband(wtpts,
                                     ap.square(wtpts, a, self.origin - start_pi - 2 * self.ramp_sigma , w,
                                                self.ramp_sigma), np.zeros(len(wtpts)),
                                     self.pulse_cfg['iq_freq'], 0)

                    self.markers['qubit buffer'][ii] = ap.square(mtpts, 1,
                                                                  self.origin - w - 4 * self.ramp_sigma - self.marker_start_buffer,
                                                                  w + 4 * self.ramp_sigma + self.marker_start_buffer)

            if self.pulse_type == 'gauss':
                gauss_sigma = w  #covention for the width of gauss pulse
                self.waveforms['qubit drive I'][ii], self.waveforms['qubit drive Q'][ii] = \
                    ap.sideband(wtpts,
                                 ap.gauss(wtpts, a, self.origin + start_pi - 2 * gauss_sigma , gauss_sigma),
                                 np.zeros(len(wtpts)),
                                 self.pulse_cfg['iq_freq'], 0)
                self.markers['qubit buffer'][ii] = ap.square(mtpts, 1, self.origin + start_pi - 4 * gauss_sigma - self.marker_start_buffer ,
                                                              4 * gauss_sigma + self.marker_start_buffer)


        if self.load_photon:

            print("Amp = " + str(self.a_flux))
            # self.waveforms['qubit 1 flux'] = ap.sideband(ftpts,0.5, np.zeros(len(ftpts)),
            #                           self.flux_pulse_freq, 0,offset=False)[0]
            self.waveforms['qubit 1 flux'] = ap.sideband(ftpts,ap.square(ftpts, self.a_flux, 0, self.ramp_sigma_flux), np.zeros(len(ftpts)),
                                      self.flux_pulse_freq, 0,offset=False)[0]
            np.save("fpulse",self.waveforms['qubit 1 flux'])
            self.waveforms['qubit 1 flux'] = np.reshape(self.waveforms['qubit 1 flux'],(1,np.shape(self.waveforms['qubit 1 flux'])[0]))
            self.markers_ch3m1 = ap.square(mtpts, 1,
                                                self.origin - self.flux_length - self.tek2_trigger_delay,
                                                self.card_trig_width)



        self.markers['readout pulse'][ii] = ap.square(mtpts, 1, self.origin + self.measurement_delay,
                                                       self.measurement_width)
        self.markers['card trigger'][ii] = ap.square(mtpts, 1,
                                                      self.origin - self.card_delay + self.measurement_delay,
                                                      self.card_trig_width)
        print(self.a_flux)
        np.save("qtime",wtpts)
        np.save("qpulse",self.waveforms['qubit drive I'])
        np.save("ftime",ftpts)
        np.save("fpulse2",self.waveforms['qubit 1 flux'])
        np.save("rtime",mtpts)
        np.save("rpulse",self.markers['readout pulse'])
Esempio n. 19
0
def flux_square_phase_fix(ftpts, pulse_location, pulse, pulse_cfg,
                          mm_target_info, flux_pulse_info):

    if flux_pulse_info['chirp'] and flux_pulse_info['fix_phase']:
        if pulse.name[-1] == "f":
            dc_offset = mm_target_info['dc_offset_freq_ef']
            shifted_frequency = mm_target_info['flux_pulse_freq_ef']
            offset_fit_quad_ef = dc_offset / (mm_target_info['a_ef']**2)
            time_step = ftpts[1] - ftpts[0]
            f_integ_array = 360.0 * np.cumsum(offset_fit_quad_ef * ap.square(
                ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                (pulse.span_length - pulse.length), pulse.length,
                mm_target_info['ramp_sigma_ef'])**2) * time_step / 1.0e9
            # print f_integ_array[-1]
            # print f_integ_array[0]
            # print np.shape(f_integ_array)

            bare_frequency = shifted_frequency + dc_offset
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma_ef']),
                np.zeros(len(ftpts)),
                freq=bare_frequency,
                phase=360 * (pulse.add_freq) / 1e9 * (ftpts - pulse_location) +
                pulse.phase - f_integ_array,
                offset=True,
                offset_fit_quad=offset_fit_quad_ef)[0]

        else:
            dc_offset = mm_target_info['dc_offset_freq']
            print(dc_offset)
            shifted_frequency = mm_target_info['flux_pulse_freq']
            bare_frequency = shifted_frequency + dc_offset
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma']),
                np.zeros(len(ftpts)),
                freq=bare_frequency,
                phase=360 * (-dc_offset + pulse.add_freq) / 1e9 *
                (ftpts - pulse_location) + pulse.phase,
                offset=False)[0]

    elif flux_pulse_info['fix_phase']:

        if pulse.name[-1] == "f":
            dc_offset = mm_target_info['dc_offset_freq_ef']
            shifted_frequency = mm_target_info['flux_pulse_freq_ef']
            bare_frequency = shifted_frequency + dc_offset
            # print mm_target_info['ramp_sigma_ef']
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma_ef']),
                np.zeros(len(ftpts)),
                freq=bare_frequency,
                phase=360 * (-dc_offset + pulse.add_freq) / 1e9 *
                (ftpts - pulse_location) + pulse.phase,
                offset=False)[0]

        else:
            dc_offset = mm_target_info['dc_offset_freq']
            shifted_frequency = mm_target_info['flux_pulse_freq']
            bare_frequency = shifted_frequency + dc_offset
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma']),
                np.zeros(len(ftpts)),
                freq=bare_frequency,
                phase=360 * (-dc_offset + pulse.add_freq) / 1e9 *
                (ftpts - pulse_location) + pulse.phase,
                offset=False)[0]

    else:
        if pulse.name[-1] == "f":
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma_ef']),
                np.zeros(len(ftpts)),
                mm_target_info['flux_pulse_freq_ef'],
                pulse.phase,
                offset=False)[0]

        else:
            waveforms_qubit_flux = ap.sideband(
                ftpts,
                ap.square(
                    ftpts, pulse.amp, pulse_location - pulse.length - 0.5 *
                    (pulse.span_length - pulse.length), pulse.length,
                    mm_target_info['ramp_sigma']),
                np.zeros(len(ftpts)),
                pulse.freq,
                pulse.phase,
                offset=False)[0]

    # print np.shape(waveforms_qubit_flux)

    return waveforms_qubit_flux
Esempio n. 20
0
    def build(self, pulse_sequence_matrix, total_flux_pulse_span_length_list):
        '''
        Parse the pulse sequence matrix generated previously.
        For each pulse sequence, location of readout and card is fixed.
        Pulses are appended backward, from the last pulse to the first pulse.
        '''
        self.origin = self.max_length - round_samples(
            (self.measurement_delay + self.measurement_width +
             self.start_end_buffer),
            increment=1. / 1.2)
        self.uses_tek2 = False
        for ii in range(len(pulse_sequence_matrix)):

            self.markers_readout[ii] = ap.square(
                self.mtpts, 1, self.origin + self.measurement_delay,
                self.measurement_width)
            self.markers_card[ii] = ap.square(
                self.mtpts, 1,
                self.origin - self.card_delay + self.measurement_delay,
                self.card_trig_width)
            self.waveforms_qubit_I[ii], self.waveforms_qubit_Q[ii] = \
                ap.sideband(self.wtpts,
                            np.zeros(len(self.wtpts)), np.zeros(len(self.wtpts)),
                            0, 0)
            self.waveforms_qubit_flux[ii] = ap.sideband(
                self.ftpts, np.zeros(len(self.ftpts)),
                np.zeros(len(self.ftpts)), 0, 0)[0]
            self.markers_qubit_buffer[ii] = ap.square(self.mtpts, 0, 0, 0)
            pulse_location = 0
            flux_pulse_location = total_flux_pulse_span_length_list[ii]
            flux_pulse_started = False
            flux_end_location = 0
            # The range defined in this way means having the for loop with index backward.
            for jj in range(len(pulse_sequence_matrix[ii]) - 1, -1, -1):
                pulse_defined = True
                pulse = pulse_sequence_matrix[ii][jj]

                if pulse.target == "q":
                    if pulse.type == "square":
                        qubit_waveforms, qubit_marker = square(
                            self.wtpts,
                            self.mtpts,
                            self.origin,
                            self.marker_start_buffer,
                            self.marker_end_buffer,
                            pulse_location - pulse.delay,
                            pulse,
                            self.pulse_cfg,
                            t0=self.origin)
                    elif pulse.type == "gauss":
                        pulse_info = self.cfg['pulse_info']

                        if pulse.name == "cal_pi":
                            if pulse_info['fix_cal_pi']:
                                #print "fix qubit dc offset pi"
                                qubit_dc_offset = pulse_info[
                                    'qubit_dc_offset_pi']
                                qubit_waveforms, qubit_marker = gauss_phase_fix(
                                    self.wtpts,
                                    self.mtpts,
                                    self.origin,
                                    self.marker_start_buffer,
                                    self.marker_end_buffer,
                                    pulse_location - pulse.delay,
                                    pulse,
                                    pulse_info,
                                    qubit_dc_offset,
                                    t0=self.origin)
                            else:
                                qubit_waveforms, qubit_marker = gauss(
                                    self.wtpts, self.mtpts, self.origin,
                                    self.marker_start_buffer,
                                    self.marker_end_buffer,
                                    pulse_location - pulse.delay, pulse)

                        elif pulse.name == 'pi':
                            if pulse_info['fix_pi']:

                                qubit_dc_offset = pulse_info[
                                    'qubit_dc_offset_pi']
                                qubit_waveforms, qubit_marker = gauss_phase_fix(
                                    self.wtpts,
                                    self.mtpts,
                                    self.origin,
                                    self.marker_start_buffer,
                                    self.marker_end_buffer,
                                    pulse_location - pulse.delay,
                                    pulse,
                                    pulse_info,
                                    qubit_dc_offset,
                                    t0=self.origin)
                            else:
                                # print "testt"
                                qubit_dc_offset = pulse_info[
                                    'qubit_dc_offset_pi']
                                qubit_waveforms, qubit_marker = gauss_phase_fix(
                                    self.wtpts,
                                    self.mtpts,
                                    self.origin,
                                    self.marker_start_buffer,
                                    self.marker_end_buffer,
                                    pulse_location - pulse.delay,
                                    pulse,
                                    pulse_info,
                                    qubit_dc_offset,
                                    t0=self.origin)
                        # elif pulse.name[:7] == 'half_pi' or pulse.name[:11] == 'neg_half_pi':
                        elif 'ef' in pulse.name:
                            #print "fix qubit ef dc offset"
                            qubit_dc_offset = pulse_info['qubit_ef_dc_offset']
                            #print qubit_dc_offset
                            qubit_waveforms, qubit_marker = gauss_phase_fix(
                                self.wtpts,
                                self.mtpts,
                                self.origin,
                                self.marker_start_buffer,
                                self.marker_end_buffer,
                                pulse_location - pulse.delay,
                                pulse,
                                pulse_info,
                                qubit_dc_offset,
                                t0=self.origin)

                        else:
                            #print "fix qubit dc offset"
                            qubit_dc_offset = pulse_info['qubit_dc_offset']
                            qubit_waveforms, qubit_marker = gauss_phase_fix(
                                self.wtpts,
                                self.mtpts,
                                self.origin,
                                self.marker_start_buffer,
                                self.marker_end_buffer,
                                pulse_location - pulse.delay,
                                pulse,
                                pulse_info,
                                qubit_dc_offset,
                                t0=self.origin)
                            if pulse.name == '0':
                                qubit_marker = 0 * qubit_marker

                    else:
                        raise ValueError('Wrong pulse type has been defined')
                    if pulse_defined:
                        self.waveforms_qubit_I[ii] += qubit_waveforms[0]
                        self.waveforms_qubit_Q[ii] += qubit_waveforms[1]
                        self.markers_qubit_buffer[ii] += qubit_marker

                elif pulse.target[:4] == "q,mm":
                    self.uses_tek2 = True
                    if flux_pulse_started == False:
                        flux_end_location = pulse_location
                        flux_pulse_started = True
                    mm_target = int(pulse.target[4:])
                    mm_target_info = self.cfg['multimodes'][mm_target]
                    flux_pulse_info = self.cfg['flux_pulse_info']
                    if pulse.type == "square":
                        # waveforms_qubit_flux = flux_square(self.ftpts, flux_pulse_location, pulse,
                        #                                    self.cfg['flux_pulse_info'])

                        waveforms_qubit_flux = flux_square_phase_fix(
                            self.ftpts, flux_pulse_location, pulse,
                            self.cfg['flux_pulse_info'], mm_target_info,
                            flux_pulse_info)
                    elif pulse.type == "gauss":
                        waveforms_qubit_flux = flux_gauss(
                            self.ftpts, flux_pulse_location, pulse)
                    else:
                        raise ValueError('Wrong pulse type has been defined')
                    if pulse_defined:
                        self.waveforms_qubit_flux[ii] += waveforms_qubit_flux
                elif pulse.target[:4] == "q:mm":
                    self.uses_tek2 = True
                    if flux_pulse_started == False:
                        flux_end_location = pulse_location
                        flux_pulse_started = True
                    if pulse.type == "square":
                        waveforms_qubit_flux = flux_square(
                            self.ftpts, flux_pulse_location, pulse,
                            self.cfg['flux_pulse_info'])
                    elif pulse.type == "gauss":
                        waveforms_qubit_flux = flux_gauss(
                            self.ftpts, flux_pulse_location, pulse)
                    else:
                        raise ValueError('Wrong pulse type has been defined')
                    if pulse_defined:
                        self.waveforms_qubit_flux[ii] += waveforms_qubit_flux
                elif pulse.target[:4] == "q:tt":
                    self.uses_tek2 = True
                    if flux_pulse_started == False:
                        flux_end_location = pulse_location
                        flux_pulse_started = True
                    if pulse.type == "square":
                        waveforms_qubit_flux = flux_square_tt(
                            self.ftpts, flux_pulse_location, pulse,
                            self.cfg['flux_pulse_info'])
                    elif pulse.type == "gauss":
                        waveforms_qubit_flux = flux_gauss(
                            self.ftpts, flux_pulse_location, pulse)
                    else:
                        raise ValueError('Wrong pulse type has been defined')
                    if pulse_defined:
                        self.waveforms_qubit_flux[ii] += waveforms_qubit_flux

                elif pulse.target == "idle":
                    pass

                high_values_indices = self.markers_qubit_buffer[ii] > 1
                self.markers_qubit_buffer[ii][high_values_indices] = 1

                pulse_location += pulse.span_length
                if flux_pulse_started:
                    flux_pulse_location -= pulse.span_length

            if False:  #ii % 2 == 0:
                self.markers_ch4m1[ii] = np.ones(len(self.wtpts))

            if self.uses_tek2:
                self.markers_ch3m1[ii] = ap.square(
                    self.mtpts, 1, self.origin - flux_end_location -
                    total_flux_pulse_span_length_list[ii] -
                    self.tek2_trigger_delay, self.card_trig_width)

        # np.save("q_c_mm_ef_ramsey3",self.waveforms_qubit_flux[0])
        # print np.shape(self.ftpts)
        # np.save("time3",self.ftpts)

        return (self.markers_readout, self.markers_card,
                self.waveforms_qubit_I, self.waveforms_qubit_Q,
                self.waveforms_qubit_flux, self.markers_qubit_buffer,
                self.markers_ch3m1, self.markers_ch4m1)