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
Ejemplo n.º 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 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()
Ejemplo n.º 4
0
lindmid = time.time()

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

lindend = time.time()

s.plot_expectation(*pop, 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('\n Measuring the time of the script:')
print(
    f'Lindblad approach   -- total time = {(lindend-lindstart):.5}s of which {(lindend-lindmid):.5}s of core operations.'
pink_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, white_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)
pink = me.noise_py()
pink.init_pink(X, pink_ampl, 1)
s.add_noise_obj(pink)
s.set_number_of_evalutions(samples)

lindmid = time.time()

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

lindend = time.time()

s.plot_expectation(*pop, 1)

# VonNeumann calculation and plotting

vnstart = time.time()