def add_nuclear_and_charge_noise(sim_object):
	'''
	Adds the niose to the simulation. Configured to be:
		T2* for J oscillations  1.6 us if white, 
								1.2 us if static gaussian
	T2* qubit 1 = 1 us
	T2* qubit 2 = 0.6 us 
	''' 

	# # # J = 6MHZ @ epsilon 835e9, t = 210e6
	chargingE = 850e9*np.pi*2
	detuningE = 828.6e9*np.pi*2
	
	# T2* qubit 1 -- nuclear
	B_noise_1 = me.noise_py()
	B_noise_1.init_gauss(sim_object.H_B_field1,1.1e-6)

	# T2* qubit 2 -- nuclear
	B_noise_2 = me.noise_py()
	B_noise_2.init_gauss(sim_object.H_B_field2,0.75e-6)

	# Add noise object to simulation object.
	sim_object.add_noise_object(B_noise_1)
	sim_object.add_noise_object(B_noise_2)

	# Electrical noise ++ (static with realtionchip form the J plots). --- note here everything expressed in form of pauli matrices and not spin matrices (bi)
	charge_noise = me.noise_py()
	charge_noise.init_white(np.zeros([6,6],dtype=np.complex), 1.08e3)
	charge_noise.add_param_matrix_dep(sim_object.H_B_field1*2.4 + 0.78*sim_object.H_B_field2 + sim_object.H_B_field1*sim_object.H_B_field2, (4,4), np.array([[0,-1/detuningE],[0,chargingE]], dtype=np.complex))
	charge_noise.add_param_matrix_dep(sim_object.H_B_field1*0.45 + 0.93*sim_object.H_B_field2, (4, 4), np.array([[0,1/detuningE],[0,chargingE-detuningE]], dtype=np.complex))

	sim_object.add_noise_object(charge_noise)

	return sim_object
Beispiel #2
0
def add_nuclear_and_charge_noise(sim_object, T2_electric=0.82e-6):
    # Adds the noise. Charge noise is taken so T2* of J oscillations is 1.6us.

    # # # J = 6MHZ @ epsilon 835e9, t = 210e6
    chargingE = 850e9 * np.pi * 2
    detuningE = 828.6e9 * np.pi * 2

    # T2* qubit 1 -- nuclear
    B_noise_1 = me.noise_py()
    B_noise_1.init_gauss(sim_object.H_B_field1, 1.2e-6)

    # T2* qubit 2 -- nuclear
    B_noise_2 = me.noise_py()
    B_noise_2.init_gauss(sim_object.H_B_field2, 0.8e-6)

    # Add noise object to simulation object.
    sim_object.add_noise_object(B_noise_1)
    sim_object.add_noise_object(B_noise_2)

    # Electrical noise ++ (static with realtionchip form the J plots). --- note here everything expressed in form of pauli matrices and not spin matrices (bi)
    charge_noise = me.noise_py()
    charge_noise.init_gauss(np.zeros([6, 6], dtype=np.complex), T2_electric)
    charge_noise.add_param_matrix_dep(
        2.4 * sim_object.H_B_field1 + 0.78 * sim_object.H_B_field2 +
        sim_object.H_B_field1 * sim_object.H_B_field2, (4, 4),
        np.array([[0, 1 / detuningE], [0, chargingE]], dtype=np.complex))
    charge_noise.add_param_matrix_dep(
        0.45 * sim_object.H_B_field1 + 0.93 * sim_object.H_B_field2, (4, 4),
        np.array([[0, -1 / detuningE], [0, chargingE - detuningE]],
                 dtype=np.complex))

    sim_object.add_noise_object(charge_noise)

    return sim_object
    def mw_pulse(self,
                 freq,
                 phase,
                 rabi_f,
                 t_start,
                 t_stop,
                 sigma_Gauss=None,
                 RWA=True):
        self.H_mw_qubit_1 = np.array(
            list(
                qt.basis(6, 0) * qt.basis(6, 2).dag() +
                qt.basis(6, 1) * qt.basis(6, 3).dag()))[:, 0]
        self.H_mw_qubit_2 = np.array(
            list(
                qt.basis(6, 0) * qt.basis(6, 1).dag() +
                qt.basis(6, 2) * qt.basis(6, 3).dag()))[:, 0]

        if RWA == True:
            if sigma_Gauss == None:
                # Note RWA
                self.solver_obj.add_H1_MW_RF_RWA(self.H_mw_qubit_1,
                                                 rabi_f * (np.pi), phase,
                                                 freq - self.f_qubit1, t_start,
                                                 t_stop)
                self.solver_obj.add_H1_MW_RF_RWA(self.H_mw_qubit_2,
                                                 rabi_f * (np.pi), phase,
                                                 freq - self.f_qubit2, t_start,
                                                 t_stop)
                # if you want not to do the RWA, DO: (not if you frequency is high, you will need a lot of simulation points!)
                # self.solver_obj.add_H1_MW_RF_RWA(self.H_mw_qubit_1, rabi_f/(2*np.pi), -phase, -freq-self.f_qubit1, t_start, t_stop)
                # self.solver_obj.add_H1_MW_RF_RWA(self.H_mw_qubit_2, rabi_f/(2*np.pi), -phase, -freq-self.f_qubit2, t_start, t_stop)
            else:
                # Add microwave oject, where the gaussian is defined.
                mw_obj_1 = ME.microwave_RWA()
                mw_obj_1.init(rabi_f * (np.pi), phase, freq - self.f_qubit1,
                              t_start, t_stop)
                mw_obj_1.add_gauss_mod(sigma_Gauss)
                mw_obj_2 = ME.microwave_RWA()
                mw_obj_2.init(rabi_f * (np.pi), phase, freq - self.f_qubit2,
                              t_start, t_stop)
                mw_obj_2.add_gauss_mod(sigma_Gauss)
                self.solver_obj.add_H1_MW_RF_obj(self.H_mw_qubit_1, mw_obj_1)
                self.solver_obj.add_H1_MW_RF_obj(self.H_mw_qubit_2, mw_obj_2)
        else:
            MW_obj_1 = ME.microwave_pulse()
            MW_obj_1.init_normal(rabi_f * np.pi, phase, freq - self.f_qubit1,
                                 t_start, t_stop,
                                 self.H_mw_qubit_1 + self.H_mw_qubit_1.T)
            self.solver_obj.add_H1_MW_RF_obj(MW_obj_1)
            MW_obj_2 = ME.microwave_pulse()
            MW_obj_2.init_normal(rabi_f * np.pi, phase, freq - self.f_qubit2,
                                 t_start, t_stop,
                                 self.H_mw_qubit_2 + self.H_mw_qubit_2.T)
            self.solver_obj.add_H1_MW_RF_obj(MW_obj_2)
 def plot_pulse(self, mat, my_filter):
     pulse = ME.test_pulse()
     t_tot = (mat[-1, 0] - mat[0, 0])
     t_0 = mat[0, 0] - t_tot * .3
     t_e = mat[-1, 0] + t_tot
     pulse.init(mat, my_filter)
     pulse.plot_pulse(t_0, t_e, 1e4)
def test_noise(noise_type):
    '''
	function that test the noise types implemented.
	noise types can be:
		Static Gaussian
		White noise
		1/f^alpha voltage noise
	'''

    # define hamiltonian
    db = double_dot_hamiltonian(18.4e9, 19.7e9, 850e9, 840e9, 0 * 0.250e9)
    # # # J = 6MHZ @ epsilon 835e9, t = 210e6
    chargingE = 850e9 * np.pi * 2
    detuningE = 828.6e9 * np.pi * 2

    # Add noise to qubit 1
    B_noise_1 = me.noise_py()

    if noise_type == 'pink':
        B_noise_1.init_pink(db.H_B_field1, 1e7, 1)
    if noise_type == 'white':
        B_noise_1.init_white(db.H_B_field1, 4e3)
    if noise_type == 'static_gauss':
        B_noise_1.init_gauss(db.H_B_field1, 30e-9 * np.sqrt(2))

    # Add noise object to simulation object.
    db.add_noise_object(B_noise_1)

    # Init wavefuntion
    psi0 = np.array(
        list(
            basis(6, 0) * basis(6, 0).dag() + basis(6, 2) * basis(6, 0).dag() +
            basis(6, 0) * basis(6, 2).dag() +
            basis(6, 2) * basis(6, 2).dag()))[:, 0] / 2

    # 5000 simulations to average.
    db.number_of_sim_for_static_noise(5000)
    db.calc_time_evolution(psi0, 0e-9, 100e-9, 500)
    db.plot_expect()

    x = np.linspace(0, 100e-9, 500)
    if noise_type == 'white':
        y = np.exp(-x / 31e-9)
        plt.plot(x * 1e9, y, label='fit')
        plt.savefig('White_noise.png')
    if noise_type == 'static_gauss':
        y = np.exp(-(x / 31e-9)**2)
        plt.plot(x * 1e9, y, label='fit')
        plt.savefig('Static_gauss_noise.png')
    if noise_type == 'pink':
        y = np.exp(-(x / 27e-9)**2)
        plt.plot(x * 1e9, y, label='fit')
        plt.savefig('Pink_noise.png')
    plt.show()
    def mw_pulse(self, freq, phase, rabi_f, t_start, t_stop):

        self.H_mw_qubit_1 = np.array(
            list(
                qt.basis(4, 0) * qt.basis(4, 2).dag() +
                qt.basis(4, 1) * qt.basis(4, 3).dag()))[:, 0]
        self.H_mw_qubit_2 = np.array(
            list(
                qt.basis(4, 0) * qt.basis(4, 1).dag() +
                qt.basis(4, 2) * qt.basis(4, 3).dag()))[:, 0]

        MW_obj_1 = ME.microwave_pulse()
        MW_obj_1.init_normal(rabi_f * np.pi, phase, freq, t_start, t_stop,
                             self.H_mw_qubit_1 + self.H_mw_qubit_1.T)
        self.solver_obj.add_H1_MW_RF_obj(MW_obj_1)

        MW_obj_2 = ME.microwave_pulse()
        MW_obj_2.init_normal(rabi_f * np.pi, phase, freq, t_start, t_stop,
                             self.H_mw_qubit_2 + self.H_mw_qubit_2.T)
        self.solver_obj.add_H1_MW_RF_obj(MW_obj_2)
    def __init__(self, f1, f2):

        self.f_qubit1 = f1
        self.f_qubit2 = f2

        # define hamiltonian for two qubits (zeeman on qubit 1, zeeman on qubit 2, exchange between qubits) -- convert from qutip to numpy (brackets)
        self.B1 = qt.tensor(qt.sigmaz() / 2, qt.qeye(2))[:, :]
        self.B2 = qt.tensor(qt.qeye(2), qt.sigmaz() / 2)[:, :]
        self.J = (qt.tensor(qt.sigmax(), qt.sigmax()) +
                  qt.tensor(qt.sigmay(), qt.sigmay()) +
                  qt.tensor(qt.sigmaz(), qt.sigmaz()))[:, :] / 4

        self.my_Hamiltonian = 2 * np.pi * (f1 * self.B1 + f2 * self.B2)
        # Create the solver
        self.solver_obj = ME.VonNeumann(4)
        # Add the init hamiltonian
        self.solver_obj.add_H0(self.my_Hamiltonian)
Beispiel #8
0
	def __init__(self, f1, f2):

		self.f_qubit1 = f1
		self.f_qubit2 = f2

		self.H_mw_qubit_1 = np.array(list(basis(4,0)*basis(4,2).dag() + basis(4,1)*basis(4,3).dag()))[:,0]
		self.H_mw_qubit_2 = np.array(list(basis(4,0)*basis(4,1).dag() + basis(4,2)*basis(4,3).dag()))[:,0]

		# define hamiltonian for two qubits (zeeman on qubit 1, zeeman on qubit 2, exchange between qubits) -- convert from qutip to numpy (brackets)
		self.B1 = qt.tensor(qt.sigmaz()/2, qt.qeye(2))[:,:]
		self.B2 = qt.tensor(qt.qeye(2), qt.sigmaz()/2)[:,:]

		# transformed into rotating frame, so energy is 0
		self.my_Hamiltonian = 0*self.B1
		# Create the solver
		self.solver_obj = ME.VonNeumann(4)
		# Add the init hamiltonian
		self.solver_obj.add_H0(self.my_Hamiltonian)
Beispiel #9
0
vn_samples = int(1e3)
evo_steps = int(2e4)
noise_ampl = 0.5
total_t = 10

Z = np.array([[1, 0], [0, -1]], dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Z0 = np.array([[0, 0], [0, 1]], dtype=complex)
Z1 = Z + Z0
pop = (np.array([Z0, Z1]), ['0', '1'])

# Lindblad calculation and plotting
lindstart = time.time()

s = me.Lindblad(
    2
)  # this is a copy of VonNeumann with added support for lindblad operators
s.add_H0(Z)  # works exactly like for VonNeumann
s.add_lindbladian(
    X, noise_ampl**2
)  # produces the same results of a white noise, but takes as second input the noise variance instead of the amplitude (var = ampl^2)

lindmid = time.time()

s.calculate_evolution(Z0, 0, total_t, evo_steps)

lindend = time.time()

s.plot_expectation(*pop, 1)

# VonNeumann calculation and plotting
vn_samples = int(1e1)
evo_steps = int(2e4)
noise_ampl = 0.5
total_t = 10

Z = np.array([[1, 0], [0, -1]], dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Z0 = np.array([[0, 0], [0, 1]], dtype=complex)
Z1 = Z + Z0
pop = (np.array([Z0, Z1]), ['0', '1'])

# VonNeumann calculation and plotting

vnstart = time.time()

v = me.VonNeumann(2)
v.add_H0(Z)
white = me.noise_py()
white.init_white(X, noise_ampl)
v.add_noise_obj(white)
v.set_number_of_evalutions(vn_samples)

vnmid = time.time()

v.calculate_evolution(Z0, 0, total_t, evo_steps)

vnend = time.time()

v.plot_expectation(*pop, 2)

print(
 def RF_exchange(self, rabi, freq, t_start, t_stop, phase):
     MW_obj_1 = ME.microwave_pulse()
     MW_obj_1.init_normal(rabi * 2 * np.pi, phase, freq, t_start, t_stop,
                          self.J)
     self.solver_obj.add_H1_MW_RF_obj(MW_obj_1)
Beispiel #12
0
    def __init__(self, B_1, B_2, chargingE1, chargingE2, tunnel_coupling):
        # Generate static part of hamiltonian (using numpy/qutip stuff)
        # All energy's should be expressed in Hz
        # H_bar = 1
        self.H_charg1 = np.array(list(qt.basis(6, 4) *
                                      qt.basis(6, 4).dag()))[:, 0]
        self.H_charg2 = np.array(list(qt.basis(6, 5) *
                                      qt.basis(6, 5).dag()))[:, 0]

        self.H_B_field1 = np.array(
            list(-qt.basis(6, 0) * qt.basis(6, 0).dag() - qt.basis(6, 1) *
                 qt.basis(6, 1).dag() + qt.basis(6, 2) * qt.basis(6, 2).dag() +
                 qt.basis(6, 3) * qt.basis(6, 3).dag()))[:, 0] / 2
        self.H_B_field2 = np.array(
            list(-qt.basis(6, 0) * qt.basis(6, 0).dag() + qt.basis(6, 1) *
                 qt.basis(6, 1).dag() - qt.basis(6, 2) * qt.basis(6, 2).dag() +
                 qt.basis(6, 3) * qt.basis(6, 3).dag()))[:, 0] / 2

        self.H_exchange = np.array(
            list(-qt.basis(6, 1) * qt.basis(6, 1).dag() - qt.basis(6, 2) *
                 qt.basis(6, 2).dag() + qt.basis(6, 1) * qt.basis(6, 2).dag() +
                 qt.basis(6, 2) * qt.basis(6, 1).dag()))[:, 0] / 2
        self.H_tunnel = np.array(
            list(
                qt.basis(6, 1) * qt.basis(6, 4).dag() -
                qt.basis(6, 2) * qt.basis(6, 4).dag() +
                qt.basis(6, 1) * qt.basis(6, 5).dag() -
                qt.basis(6, 2) * qt.basis(6, 5).dag() +
                qt.basis(6, 4) * qt.basis(6, 1).dag() -
                qt.basis(6, 4) * qt.basis(6, 2).dag() +
                qt.basis(6, 5) * qt.basis(6, 1).dag() -
                qt.basis(6, 5) * qt.basis(6, 2).dag()))[:, 0]

        self.B_1 = B_1
        self.B_2 = B_2
        self.chargingE1 = chargingE1
        self.chargingE2 = chargingE2
        self.tunnel_coupling = tunnel_coupling
        self.my_Hamiltonian = 2 * np.pi * (self.H_charg1 * chargingE1 +
                                           self.H_charg2 * chargingE2 +
                                           self.H_tunnel * tunnel_coupling)
        self.h_raw = self.my_Hamiltonian / 2 / np.pi + self.H_B_field1 * B_1 + self.H_B_field2 * B_2
        # Clock of rotating frame
        self.f_qubit1 = B_1
        self.f_qubit2 = B_2

        # Init params
        self.amp_noise_1 = 0
        self.amp_noise_2 = 0
        self.number_of_samples = 1
        self.one_f_noise = 0

        # Create the solver
        self.solver_obj = ME.VonNeumann(6)
        # Add the init hamiltonian
        self.solver_obj.add_H0(self.my_Hamiltonian)

        if self.f_qubit1 - self.f_qubit2 != 0:
            # add time dependent tunnelcouplings (see presentation)
            locations_1 = np.array([[1, 4], [1, 5]], dtype=np.int32)
            self.solver_obj.add_cexp_time_dep(
                locations_1, (self.f_qubit1 - self.f_qubit2) / 2)

            locations_1 = np.array([[2, 4], [2, 5]], dtype=np.int32)
            self.solver_obj.add_cexp_time_dep(
                locations_1, (self.f_qubit2 - self.f_qubit1) / 2)
evo_steps = int(2e4)
noise_ampl = 0.5  # TODO: did not yet check how to convert to T1
total_t = 10

Z = np.array([[1, 0], [0, -1]], dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Z0 = np.array([[0, 0], [0, 1]], dtype=complex)
Z1 = Z + Z0
jumpdown = np.array([[0, 0], [1, 0]], dtype=complex)
pop = (np.array([Z0, Z1]), ['0', '1'])

# Lindblad calculation and plotting
lindstart = time.time()

s = me.Lindblad(
    2
)  # this is a copy of VonNeumann with added support for lindblad operators
s.add_H0(Z)  # works exactly like for VonNeumann
s.add_lindbladian(jumpdown, noise_ampl**2)  # with jumpdown, produces T1 decay.

lindmid = time.time()

s.calculate_evolution(Z1, 0, total_t, evo_steps)

lindend = time.time()

s.plot_expectation(*pop, 1)

print('\n Measuring the time of the script:')
print(
    f'total time = {(lindend-lindstart):.5}s of which {(lindend-lindmid):.5}s of core operations.'