def measure_BusEcho(self, times, artificial_detuning, MC=None):

        if MC is None:
            MC = self.MC.get_instr()

        cal_points = 4
        lengths_cal = times[-1] + \
            np.arange(1, 1+cal_points)*(times[1]-times[0])
        lengths_vec = np.concatenate((times, lengths_cal))

        mw_pulse_pars, RO_pars = self.get_pulse_pars()
        flux_pulse_pars, dist_dict = self.get_flux_pars()
        BusEcho = awg_swf.BusEcho(times_vec=times,
                                  mw_pulse_pars=mw_pulse_pars,
                                  RO_pars=RO_pars,
                                  artificial_detuning=artificial_detuning,
                                  flux_pulse_pars=flux_pulse_pars,
                                  dist_dict=dist_dict,
                                  AWG=self.AWG.get_instr(),
                                  upload=False, return_seq=True)

        exec('self.AWG.get_instr().ch%d_amp(2.)' % self.fluxing_channel())
        seq = BusEcho.pre_upload()

        MC.set_sweep_function(BusEcho)
        MC.set_sweep_points(lengths_vec)

        MC.set_detector_function(self.int_avg_det)
        self.AWG.get_instr().ch4_amp(flux_pulse_pars['swap_amp'])
        MC.run('Bus_Echo')
        ma.Ramsey_Analysis(auto=True, label='Bus_Echo')
    def measure_ramsey(self, times, artificial_detuning=0,
                       f_qubit=None, label='',
                       MC=None, analyze=True, close_fig=True, verbose=True,
                       upload=True):
        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC.get_instr()

        if f_qubit is None:
            f_qubit = self.f_qubit.get()
        self.td_source.get_instr().set(
            'frequency', f_qubit - self.f_pulse_mod.get())
        Rams_swf = awg_swf.Ramsey(
            pulse_pars=self.pulse_pars, RO_pars=self.RO_pars,
            artificial_detuning=artificial_detuning, upload=upload)
        MC.set_sweep_function(Rams_swf)
        MC.set_sweep_points(times)
        MC.set_detector_function(self.int_avg_det)
        MC.run('Ramsey'+label+self.msmt_suffix)

        if analyze:
            a = ma.Ramsey_Analysis(auto=True, close_fig=close_fig)
            if verbose:
                fitted_freq = a.fit_res.params['frequency'].value
                print('Artificial detuning: {:.2e}'.format(
                      artificial_detuning))
                print('Fitted detuning: {:.2e}'.format(fitted_freq))
                print('Actual detuning:{:.2e}'.format(
                      fitted_freq-artificial_detuning))
Exemplo n.º 3
0
    def calibrate_frequency_ramsey(self,
                                   steps=[1, 1, 3, 10, 30, 100, 300, 1000],
                                   stepsize: float = 20e-9,
                                   verbose: bool = True,
                                   update: bool = True,
                                   close_fig: bool = True):
        """
        Runs an iterative procudere of ramsey experiments to estimate
        frequency detuning to converge to the qubit frequency up to the limit
        set by T2*.

        steps:
            multiples of the initial stepsize on which to run the
        stepsize:
            smalles stepsize in ns for which to run ramsey experiments.
        """
        cur_freq = self.freq_qubit()
        # Steps don't double to be more robust against aliasing
        for n in steps:
            times = np.arange(self.mw_gauss_width() * 4, 50 * n * stepsize,
                              n * stepsize)
            artificial_detuning = 2.5 / times[-1]
            self.measure_ramsey(times,
                                artificial_detuning=artificial_detuning,
                                freq_qubit=cur_freq,
                                label='_{}pulse_sep'.format(n),
                                analyze=False)
            a = ma.Ramsey_Analysis(auto=True,
                                   close_fig=close_fig,
                                   freq_qubit=cur_freq,
                                   artificial_detuning=artificial_detuning,
                                   close_file=False)
            fitted_freq = a.fit_res.params['frequency'].value
            measured_detuning = fitted_freq - artificial_detuning
            cur_freq = a.qubit_frequency

            qubit_ana_grp = a.analysis_group.create_group(self.msmt_suffix)
            qubit_ana_grp.attrs['artificial_detuning'] = \
                str(artificial_detuning)
            qubit_ana_grp.attrs['measured_detuning'] = \
                str(measured_detuning)
            qubit_ana_grp.attrs['estimated_qubit_freq'] = str(cur_freq)
            a.finish()  # make sure I close the file
            if verbose:
                print('Measured detuning:{:.2e}'.format(measured_detuning))
                print('Setting freq to: {:.9e}, \n'.format(cur_freq))
            if times[-1] > 2. * a.T2_star['T2_star']:
                # If the last step is > T2* then the next will be for sure
                if verbose:
                    print('Breaking of measurement because of T2*')
                break
        if verbose:
            print('Converged to: {:.9e}'.format(cur_freq))
        if update:
            self.freq_qubit(cur_freq)
        return cur_freq
    def measure_ramsey(self,
                       times,
                       artificial_detuning=0,
                       f_qubit=None,
                       label='',
                       MC=None,
                       analyze=True,
                       close_fig=True,
                       verbose=True):
        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC

        # This is required because I cannot change the phase in the pulses
        if not all([
                np.round(t * 1e9) % (1 / self.f_pulse_mod.get() * 1e9) == 0
                for t in times
        ]):
            raise ValueError('timesteps must be multiples of modulation freq')

        if f_qubit is None:
            f_qubit = self.f_qubit.get()
        # this should have no effect if artificial detuning = 0
        self.td_source.set(
            'frequency',
            f_qubit - self.f_pulse_mod.get() + artificial_detuning)
        Rams_swf = awg_swf.CBox_Ramsey(
            AWG=self.AWG,
            CBox=self.CBox,
            IF=self.f_RO_mod.get(),
            pulse_delay=0,
            RO_pulse_delay=self.RO_pulse_delay.get(),
            RO_trigger_delay=self.RO_acq_marker_delay.get(),
            RO_pulse_length=self.RO_pulse_length.get())
        MC.set_sweep_function(Rams_swf)
        MC.set_sweep_points(times)
        MC.set_detector_function(
            det.CBox_integrated_average_detector(self.CBox, self.AWG))
        MC.run('Ramsey' + label + self.msmt_suffix)

        if analyze:
            a = ma.Ramsey_Analysis(auto=True, close_fig=True)

            if verbose:
                fitted_freq = a.fit_res.params['frequency'].value
                print(
                    'Artificial detuning: {:.2e}'.format(artificial_detuning))
                print('Fitted detuning: {:.2e}'.format(fitted_freq))
                print('Actual detuning:{:.2e}'.format(fitted_freq -
                                                      artificial_detuning))
Exemplo n.º 5
0
    def calibrate_frequency_ramsey(self,
                                   steps=[1, 1, 3, 10, 30, 100, 300, 1000],
                                   stepsize=None,
                                   verbose=True,
                                   update=True,
                                   close_fig=True):
        if stepsize is None:
            stepsize = abs(1 / self.f_pulse_mod.get())
        cur_freq = self.f_qubit.get()
        # Steps don't double to be more robust against aliasing
        for n in steps:
            times = np.arange(self.pulse_delay.get(), 50 * n * stepsize,
                              n * stepsize)
            artificial_detuning = 2.5 / times[-1]
            self.measure_ramsey(times,
                                artificial_detuning=artificial_detuning,
                                f_qubit=cur_freq,
                                label='_{}pulse_sep'.format(n),
                                analyze=False)
            a = ma.Ramsey_Analysis(auto=True,
                                   close_fig=close_fig,
                                   qb_name=self.name,
                                   artificial_detuning=artificial_detuning,
                                   close_file=False)
            fitted_freq = a.fit_res.params['frequency'].value
            measured_detuning = fitted_freq - artificial_detuning
            cur_freq -= measured_detuning

            qubit_ana_grp = a.analysis_group.create_group(self.msmt_suffix)
            qubit_ana_grp.attrs['artificial_detuning'] = \
                str(artificial_detuning)
            qubit_ana_grp.attrs['measured_detuning'] = \
                str(measured_detuning)
            qubit_ana_grp.attrs['estimated_qubit_freq'] = str(cur_freq)
            a.finish()  # make sure I close the file
            if verbose:
                print('Measured detuning:{:.2e}'.format(measured_detuning))
                print('Setting freq to: {:.9e}, \n'.format(cur_freq))

            if times[-1] > 2. * a.T2_star['T2_star']:
                # If the last step is > T2* then the next will be for sure
                if verbose:
                    print('Breaking of measurement because of T2*')
                break
        if verbose:
            print('Converged to: {:.9e}'.format(cur_freq))
        if update:
            self.f_qubit.set(cur_freq)
        return cur_freq
    def measure_echo(self, times, label='', MC=None,
                     artificial_detuning=None, upload=True,
                     analyze=True, close_fig=True, verbose=True):
        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC.get_instr()

        Echo_swf = awg_swf.Echo(
            pulse_pars=self.pulse_pars, RO_pars=self.RO_pars,
            artificial_detuning=artificial_detuning, upload=upload)
        MC.set_sweep_function(Echo_swf)
        MC.set_sweep_points(times)
        MC.set_detector_function(self.int_avg_det)
        MC.run('Echo'+label+self.msmt_suffix)

        if analyze:
            a = ma.Ramsey_Analysis(
                auto=True, close_fig=close_fig, label='Echo')
            return a
Exemplo n.º 7
0
 def test_ramsey_single_weight(self):
     a = ma.Ramsey_Analysis(timestamp='20170607_211144')
     fpar = a.fit_res.best_values
     self.assertAlmostEqual(fpar['tau'] * 1e6, 8.9793, places=2)
     self.assertAlmostEqual(fpar['exponential_offset'], 0.5057, places=2)
     self.assertAlmostEqual(fpar['frequency'], 61135.024, places=2)
Exemplo n.º 8
0
 def test_ramsey_IQ_data(self):
     a = ma.Ramsey_Analysis(timestamp='20170607_145645')
     fpar = a.fit_res.best_values
     self.assertAlmostEqual(fpar['tau'] * 1e6, 19.577, places=2)
     self.assertAlmostEqual(fpar['exponential_offset'], 0.5057, places=2)
     self.assertAlmostEqual(fpar['frequency'], 250349.150, places=2)