Ejemplo n.º 1
0
    def test_Rabi_other_params(self):

        a = ma.Rabi_Analysis(timestamp='20170607_160504')
        self.assertAlmostEqual(1 / a.fit_result.values['frequency'],
                               0.3839,
                               places=2)

        a = ma.Rabi_Analysis(timestamp='20170607_160504')
        self.assertAlmostEqual(a.rabi_amplitudes['piPulse'],
                               0.3839 / 2,
                               places=2)
Ejemplo n.º 2
0
    def calibrate_pulse_amplitude_coarse(self,
                                         amps=np.linspace(-.5, .5, 31),
                                         close_fig=True,
                                         verbose=False,
                                         MC=None,
                                         update=True,
                                         take_fit_I=False):
        """
        Calibrates the pulse amplitude using a single rabi oscillation
        """

        self.measure_rabi(amps, n=1, MC=MC, analyze=False)
        a = ma.Rabi_Analysis(close_fig=close_fig)
        # Decide which quadrature to take by comparing the contrast
        if take_fit_I or len(a.measured_values) == 1:
            ampl = abs(a.fit_res[0].params['period'].value) / 2.
        elif (
                np.abs(max(a.measured_values[0]) - min(a.measured_values[0]))
        ) > (np.abs(max(a.measured_values[1]) - min(a.measured_values[1]))):
            ampl = a.fit_res[0].params['period'].value / 2.
        else:
            ampl = a.fit_res[1].params['period'].value / 2.

        if update:
            self.Q_amp180.set(ampl)
        return ampl
Ejemplo n.º 3
0
    def find_amp90_scaling(self,
                           scales=0.5,
                           N_steps=[5, 9],
                           max_n=100,
                           close_fig=True,
                           verbose=False,
                           MC=None,
                           update=True,
                           take_fit_I=False):
        '''
        Finds the scaling factor of pi/2 pulses w.r.t pi pulses using a rabi
        type with each pi pulse replaced by 2 pi/2 pulses.

        If scales is an array it starts by fitting a cos to a Rabi experiment
        to get an initial guess for the amplitude.

        This experiment is only useful after carefully calibrating the pi pulse
        using flipping sequences.
        '''
        if MC is None:
            MC = self.MC
        if np.size(scales) != 1:
            self.measure_rabi_amp90(scales=scales, n=1, MC=MC, analyze=False)
            a = ma.Rabi_Analysis(close_fig=close_fig)
            if take_fit_I:
                scale = abs(a.fit_res[0].params['period'].value) / 2
            else:
                if (a.fit_res[0].params['period'].stderr <=
                        a.fit_res[1].params['period'].stderr):
                    scale = abs(a.fit_res[0].params['period'].value) / 2
                else:
                    scale = abs(a.fit_res[1].params['period'].value) / 2
        else:
            scale = scales
        if verbose:
            print('Initial scaling factor:', scale, '\n')

        for n in N_steps:
            if n > max_n:
                break
            else:
                scale_span = 0.3 * scale / n
                scales = np.linspace(scale - scale_span, scale + scale_span,
                                     15)
                self.measure_rabi_amp90(scales, n=n, MC=MC, analyze=False)
                a = ma.Rabi_parabola_analysis(close_fig=close_fig)
                if take_fit_I:
                    scale = a.fit_res[0].params['x0'].value
                else:
                    if (a.fit_res[0].params['x0'].stderr <=
                            a.fit_res[1].params['x0'].stderr):
                        scale = a.fit_res[0].params['x0'].value
                    else:
                        scale = a.fit_res[1].params['x0'].value
                if verbose:
                    print('Founcaleitude', scale, '\n')
        if update:
            self.amp90_scale(scale)
            print("should be updated")
            print(scale)
Ejemplo n.º 4
0
    def test_Rabi_analysis(self):
        rabis = [
            ma.Rabi_Analysis(timestamp='20170412_185618'),
            ma.Rabi_Analysis(timestamp='20170412_183928'),
            ma.Rabi_Analysis(timestamp='20170413_134244')
        ]
        for rabi_an in rabis:
            for tt in range(2):
                rabi_amp = rabi_an.fit_res[tt].values['period'] / 2.
                amp_low = 0.63
                amp_high = 0.8

                self.assertGreaterEqual(rabi_amp, amp_low)
                self.assertGreaterEqual(amp_high, rabi_amp)

        a = ma.Rabi_Analysis(timestamp='20170607_160504')
        self.assertAlmostEqual(a.fit_res[0].values['period'], 0.3839, places=2)
        self.assertAlmostEqual(a.fit_res[1].values['period'], 0.3839, places=2)

        a = ma.Rabi_Analysis(timestamp='20170607_160504', auto=False)
        self.assertAlmostEqual(a.get_measured_amp180(), 0.3839 / 2, places=2)
    def measure_rabi_amp90(self,
                           scales=np.linspace(-0.7, 0.7, 31), n=1,
                           MC=None, analyze=True, close_fig=True,
                           verbose=False):
        self.prepare_for_timedomain()
        if MC is None:
            MC = self.MC.get_instr()

        MC.set_sweep_function(awg_swf.Rabi_amp90(
            pulse_pars=self.pulse_pars, RO_pars=self.RO_pars, n=n))
        MC.set_sweep_points(scales)
        MC.set_detector_function(self.int_avg_det)
        MC.run('Rabi_amp90_scales_n{}'.format(n)+self.msmt_suffix)
        if analyze:
            ma.Rabi_Analysis(auto=True, close_fig=close_fig)
    def measure_rabi(self, amps=np.linspace(-.5, .5, 31), n=1,
                     MC=None, analyze=True, close_fig=True,
                     verbose=False, upload=True):
        # prepare for timedomain takes care of rescaling
        self.prepare_for_timedomain()
        # # Extra rescaling only happens if the amp180 was far too low for the Rabi
        if max(abs(amps))*2 > self.AWG.get_instr().get('{}_amp'.format(self.pulse_I_channel())):
            logging.warning('Auto rescaling AWG amplitude as amp180 {}'.format(
                            self.amp180()) +
                            ' was set very low in comparison to Rabi range')
            self.AWG.get_instr().set('{}_amp'.format(self.pulse_I_channel()),
                                     np.max(abs(amps))*3.0)
            self.AWG.get_instr().set('{}_amp'.format(self.pulse_Q_channel()),
                                     np.max(abs(amps))*3.0)
        if MC is None:
            MC = self.MC.get_instr()

        MC.set_sweep_function(awg_swf.Rabi(
            pulse_pars=self.pulse_pars, RO_pars=self.RO_pars, n=n, upload=upload))
        MC.set_sweep_points(amps)
        MC.set_detector_function(self.int_avg_det)
        MC.run('Rabi-n{}'.format(n)+self.msmt_suffix)
        if analyze:
            ma.Rabi_Analysis(auto=True, close_fig=close_fig)
Ejemplo n.º 7
0
    def test_Rabi_single_weight(self):
        a = ma.Rabi_Analysis(timestamp='20170607_211203')
        self.assertAlmostEqual(a.fit_res[0].values['period'], 0.3839, places=2)

        a = ma.Rabi_Analysis(timestamp='20170607_211203', auto=False)
        self.assertAlmostEqual(a.get_measured_amp180(), 0.3839 / 2, places=2)