Esempio n. 1
0
    def test_freq_to_dac(self):
        f_max = 6.01e9
        dac_sweet_spot = .02
        E_c = 300e6
        dac_flux_coefficient = 1 / .2
        for asym in [0, .5, .9]:
            dac_voltages = np.linspace(-.100, .100, 201)
            freqs = fit_mods.Qubit_dac_to_freq(
                dac_voltages,
                f_max=f_max,
                E_c=E_c,
                dac_sweet_spot=dac_sweet_spot,
                dac_flux_coefficient=dac_flux_coefficient,
                asymmetry=asym)

            self.assertEqual(np.max(freqs), f_max)
            self.assertAlmostEqual(dac_voltages[np.argmax(freqs)],
                                   dac_sweet_spot)

            # Simple model excluding assymetry
            simple_freq_model = (f_max + E_c) * np.sqrt(
                abs(
                    np.cos(dac_flux_coefficient *
                           (dac_voltages - dac_sweet_spot)))) - E_c

            freqs = fit_mods.Qubit_dac_to_freq(
                dac_voltages,
                f_max=f_max,
                E_c=E_c,
                dac_sweet_spot=dac_sweet_spot,
                dac_flux_coefficient=dac_flux_coefficient,
                asymmetry=0)
            np.testing.assert_array_almost_equal(freqs, simple_freq_model)
Esempio n. 2
0
    def test_dac_to_freq(self):
        f_max = 6.01e9
        dac_sweet_spot = .02
        dac_voltages_pos_branch = np.linspace(dac_sweet_spot,
                                              3 * dac_sweet_spot, 201)
        freqs = fit_mods.Qubit_dac_to_freq(dac_voltages_pos_branch,
                                           f_max=f_max,
                                           E_c=300e6,
                                           dac_sweet_spot=dac_sweet_spot,
                                           dac_flux_coefficient=1 / .2,
                                           asymmetry=0)

        recovered_dac_voltages = fit_mods.Qubit_freq_to_dac(
            freqs,
            f_max=f_max,
            E_c=300e6,
            dac_sweet_spot=dac_sweet_spot,
            dac_flux_coefficient=1 / .2,
            asymmetry=0,
            branch='positive')

        np.testing.assert_array_almost_equal(dac_voltages_pos_branch,
                                             recovered_dac_voltages)

        dac_voltages_neg_branch = np.linspace(dac_sweet_spot,
                                              -3 * dac_sweet_spot, 201)
        freqs = fit_mods.Qubit_dac_to_freq(dac_voltages_neg_branch,
                                           f_max=f_max,
                                           E_c=300e6,
                                           dac_sweet_spot=dac_sweet_spot,
                                           dac_flux_coefficient=1 / .2,
                                           asymmetry=0)

        recovered_dac_voltages = fit_mods.Qubit_freq_to_dac(
            freqs,
            f_max=f_max,
            E_c=300e6,
            dac_sweet_spot=dac_sweet_spot,
            dac_flux_coefficient=1 / .2,
            asymmetry=0,
            branch='negative')

        np.testing.assert_array_almost_equal(dac_voltages_neg_branch,
                                             recovered_dac_voltages)
Esempio n. 3
0
    def calculate_frequency(self,
                            dac_voltage=None,
                            flux=None):
        '''
        Calculates the f01 transition frequency from the cosine arc model.
        (function available in fit_mods. Qubit_dac_to_freq)

        Parameters of the qubit object are used unless specified.
        Flux can be specified both in terms of dac voltage or flux but not
        both.
        '''

        if dac_voltage is not None and flux is not None:
            raise ValueError('Specify either dac voltage or flux but not both')

        if self.f_qubit_calc_method() is 'latest':
            f_qubit_estimate = self.f_qubit()

        elif self.f_qubit_calc_method() == 'dac':
            if dac_voltage is None:
                dac_voltage = self.IVVI.get_instr().get(
                    'dac{}'.format(self.dac_channel()))

            f_qubit_estimate = fit_mods.Qubit_dac_to_freq(
                dac_voltage=dac_voltage,
                f_max=self.f_max(),
                E_c=self.E_c(),
                dac_sweet_spot=self.dac_sweet_spot(),
                dac_flux_coefficient=self.dac_flux_coefficient(),
                asymmetry=self.asymmetry())

        elif self.f_qubit_calc_method() == 'flux':
            if flux is None:
                flux = self.FluxCtrl.get_instr().get(
                    'flux{}'.format(self.dac_channel()))
            f_qubit_estimate = fit_mods.Qubit_dac_to_freq(
                dac_voltage=flux,
                f_max=self.f_max(),
                E_c=self.E_c(),
                dac_sweet_spot=0,
                dac_flux_coefficient=1,
                asymmetry=self.asymmetry())
        return f_qubit_estimate
Esempio n. 4
0
    def calculate_frequency(self, calc_method=None, V_per_phi0=None, V=None):
        '''
        Calculates an estimate for the qubit frequency.
        Arguments are optional and parameters of the object are used if not
        specified.
        Args:
            calc_method : can be "latest" or "flux" uses last known frequency
                    or calculates using the cosine arc model as specified
                    in fit_mods.Qubit_dac_to_freq
                corresponding par. : cfg_qubit_freq_calc_method

            V_per_phi0 : dac flux coefficient, converts volts to Flux.
                    Set to 1 to reduce the model to pure flux.
                corresponding par. : fl_dc_V_per_phi
            V  : dac value used when calculating frequency
                corresponding par. : fl_dc_V

        Calculates the f01 transition frequency using the cosine arc model.
        (function available in fit_mods. Qubit_dac_to_freq)

        The parameter cfg_qubit_freq_calc_method determines how it is
        calculated.
        Parameters of the qubit object are used unless specified.
        Flux can be specified both in terms of dac voltage or flux but not
        both.
        '''
        if self.cfg_qubit_freq_calc_method() == 'latest':
            qubit_freq_est = self.freq_qubit()

        elif self.cfg_qubit_freq_calc_method() == 'flux':
            if V is None:
                V = self.fl_dc_V()
            if V_per_phi0 is None:
                V_per_phi0 = self.fl_dc_V_per_phi0()

            qubit_freq_est = fit_mods.Qubit_dac_to_freq(
                dac_voltage=V,
                f_max=self.freq_max(),
                E_c=self.E_c(),
                dac_sweet_spot=self.fl_dc_V0(),
                V_per_phi0=V_per_phi0,
                asymmetry=self.asymmetry())

        return qubit_freq_est