Esempio n. 1
0
def test_explorer():
    qbt = qubit.Fluxonium(
        EJ=2.55,
        EC=0.72,
        EL=0.12,
        flux=0.0,
        cutoff=110,
        truncated_dim=9
    )

    osc = qubit.Oscillator(
        E_osc=4.0,
        truncated_dim=5
    )

    hilbertspace = qubit.HilbertSpace([qbt, osc])

    interaction = InteractionTerm(
        g_strength=0.2,
        op1=qbt.n_operator(),
        subsys1=qbt,
        op2=osc.creation_operator() + osc.annihilation_operator(),
        subsys2=osc
    )

    interaction_list = [interaction]
    hilbertspace.interaction_list = interaction_list

    param_name = r'$\Phi_{ext}/\Phi_0$'
    param_vals = np.linspace(-0.5, 0.5, 100)

    subsys_update_list = [qbt]

    def update_hilbertspace(param_val):
        qbt.flux = param_val

    sweep = ParameterSweep(
        param_name=param_name,
        param_vals=param_vals,
        evals_count=10,
        hilbertspace=hilbertspace,
        subsys_update_list=subsys_update_list,
        update_hilbertspace=update_hilbertspace,
    )
    swp.generate_chi_sweep(sweep)
    swp.generate_charge_matrixelem_sweep(sweep)

    explorer = Explorer(
        sweep=sweep,
        evals_count=10
    )

    explorer.interact()
    def __init__(self,
                 EJ,
                 EC,
                 EL,
                 cav_freq,
                 flux,
                 Num_levels,
                 Num_sum=10,
                 Num_plots=4,
                 flux_start=0.0,
                 flux_stop=1.0):

        ### EJ: float of JJ energy
        self.EJ = EJ
        ### EC: float of charging energy
        self.EC = EC
        ### EL: float of inductive energy
        self.EL = EL
        ### cav_freq: float of cavity frequency
        self.cav_freq = cav_freq
        ### flux: float of external flux
        self.flux = flux
        ### Num_levels: int of number of levels in model
        self.Num_levels = Num_levels
        ### Num_sum: int of the number of levels to be used in calculations
        self.Num_sum = Num_sum
        ### Num_plots: int of the number plots on figure
        self.Num_plots = Num_plots
        ### flux_start is the starting flux for flux sweep
        self.flux_start = flux_start
        ### flux_stop is the stopping flux for flux sweep
        self.flux_stop = flux_stop

        # creating subplots given number requested
        # for 1-3 plots, just lay out in a row
        if self.Num_plots == 1:
            self.fig, self.subplots = (plt.subplots(1, 1, figsize=[14.0, 5.0]))
            ## subplots: list containing all subplots of the figure
            self.subplots = [self.subplots]

        elif self.Num_plots == 2:
            self.fig, self.subplots = (plt.subplots(1, 2, figsize=[14.0, 5.0]))

        elif self.Num_plots == 3:
            self.fig, self.subplots = (plt.subplots(1, 3, figsize=[14.0, 5.0]))

        elif self.Num_plots == 4:
            self.fig, self._subplots_temp = (plt.subplots(2,
                                                          2,
                                                          figsize=[14.0, 5.0]))
            #  turn format of subplots into array for simplicity
            self.subplots = np.array([
                self._subplots_temp[0, 0], self._subplots_temp[0, 1],
                self._subplots_temp[1, 0], self._subplots_temp[1, 1]
            ])

        ## fluxonium: qubit object of the fluxonium
        self.fluxonium = qubit.Fluxonium(EJ=self.EJ,
                                         EC=self.EC,
                                         EL=self.EL,
                                         flux=self.flux,
                                         cutoff=100)

        ## set all booleans to false
        self.flux_sweep = False
        self.g_mat_bool = False
        self.wavefunciton_bool = False
        self.Raman_bool = False