In [1]:
%pylab inline
from MyUnits import *
from MyFunctions import *
from qutip import *
from MyQubit import *
import mpld3


Populating the interactive namespace from numpy and matplotlib

In [2]:
def calc_spectrum_3(N, Delta, w_q, Delta_d_tilde, Delta_s_tilde, chi, Gamma_d, Gamma_s, zeta_1, zeta_2, kappa_n, gamma_rel, gamma_dep,
                    n_th_a):

    # cavity operators
    a = tensor(destroy(N), qeye(2))
    nc = a.dag() * a
    xc = a + a.dag()

    # qubit operators

    sm = tensor(qeye(N), destroy(2))
    sz = tensor(qeye(N), sigmaz())
    sx = tensor(qeye(N), sigmax())
    nq = sm.dag() * sm
    xq = sm + sm.dag()
    I = tensor(qeye(N), qeye(2))

    # coupling
    # dispersive hamiltonian

    Hr = Delta_d_tilde * (a.dag() * a + I / 2)  # Cavity
    Hq = (Delta_s_tilde / 2.0) * sz  # qubit
    Hi = chi * (a.dag() * a + I / 2) * sz  # interaction
    # extra term Unitary tranformation and RWA
    He = nc * chi ** 2 / (4 * Delta) * (w_q / Delta - I)
    Hd = (Gamma_d / 2.0) * (a + a.dag())  # Drive cavity
    Hs = (Gamma_s / 2.0) * (sm + sm.dag())  # Drive qubit
    HKerr = zeta_1 * ((a.dag() * a) ** 2) * sz + zeta_2 * (a.dag() * a) ** 2  # non linear Kerr terms

    H = Hr + Hq + Hi + Hd  + He  # total Hamiltonian

    # collapse operators

    c_op_list = []

    rate = kappa_n * (1 + n_th_a)
    if rate > 0.0:
        c_op_list.append(sqrt(rate) * a)

    rate = kappa_n * n_th_a
    if rate > 0.0:
        c_op_list.append(sqrt(rate) * a.dag())

    rate = gamma_rel * (1 + n_th_a)
    if rate > 0.0:
        c_op_list.append(sqrt(rate) * sm)

    rate = gamma_rel * (n_th_a)
    if rate > 0.0:
        c_op_list.append(sqrt(rate) * sm.dag())

    rate = (gamma_dep / 2) * (1 + n_th_a)
    if rate > 0.0:
        c_op_list.append(sqrt(rate) * sz)

    # Calculation stedy state Master equation
    rho = steadystate(H, c_op_list)

    # variables to be returned

    rho_sz = rho * sz
    rho_n = rho * (a.dag() * a + I / 2)
    rho_x = rho * (a.dag() + a)
    rho_a = rho * a

    return rho, rho_sz, rho_n, rho_x, rho_a

In [3]:
T = 60e-3 # K
f = 5.049 
n_th_a = 1/(exp(h*f/(kB*T)-1)) # Thermal occupation

w_r = (5.049) *2 * pi # bare resonator frequency

Q_l = 20000 # resonator loaded quality factor

g_ge = (0.119078293572) * 2 * pi
g_ef = 0.170964323764 * 2 * pi





kappa_n = 0.00025245000000000004 * 2 * pi

Gamma_rel = 0.00023255813953488373 * 2 * pi

Gamma_def = 0.0011403579916684755 * 2 * pi

In [3]:


In [3]:


In [276]:
N = 20 # number of states cavity

T = 60e-3 # K
n_th_a = 1/(exp(h*f/(kB*T)-1)) # Thermal occupation

w_ef = 4.1356 * 2* pi 

P_cavity = -(106 + 40) # Input power cavity
Q_c = 20000
Q_l = 20000

# Dephasing
kappa_n = 0.00025245000000000004 * 2 * pi

gamma_rel = 0.00023255813953488373 * 2 * pi

gamma_dep = 0.0011403579916684755 * 2 * pi

  # Drive amplitude qubit

Gamma_s = 0

# cavity qubit max freq
w_r_max = (5.049)  * 2 * pi
w_ge_max = 4.3864 * 2 * pi
w_ef_max = 4.1356 * 2 * pi







# cavity freq scan
f_d_i = 5.04 # qubit tone start
f_d_f = 5.075 # qubit tone final
steps_d = 100 # 
w_r = 2*pi* linspace(f_d_i,f_d_f,steps_d)

g_ge = (0.119078293572) * 2 * pi
g_ef = (0.170964323764) * 2 * pi


Delta_s_tilde = 0 # w_ge_tilde - wq 
d = 0.15

flux_values = linspace(-pi/2,0,100)

amp_sz = []
amp_n = []
amp_x = []
amp_a = []
Gamma_d = sqrt(Q_c*kappa_n*1e9*dBmtoW(P_cavity)/(2*Q_l*hbar*(w_r_max)*1e9))/1e9
Gamma_s = 0 # Gamma_d

for wd in w_r:
    
    for flux in flux_values:
        
    
        w_ge =  w_ge_max * (cos(flux)) *sqrt(1+d**2 * tan(flux)**2)
        w_ef =  (w_ef_max) * (cos(flux)) *sqrt(1+d**2 * tan(flux)**2)
        Delta_ge =  w_ge - w_r_max
        Delta_ef =  w_ef - w_r_max
        chi_ge = g_ge**2 /Delta_ge
        chi_ef = g_ef**2/Delta_ef
        chi =  chi_ge - chi_ef/2
        w_r_tilde = w_r_max - chi_ef/2
        w_ge_tilde = w_ge + chi_ge

        Delta = w_r - w_ge
        
        Delta_d_tilde = w_r_tilde - wd 
        Delta_s_tilde = w_ge - wd
        lambda_ef = g_ef/Delta_ef
        lambda_ge = g_ge/Delta_ge
        zeta_1 = chi_ef * lambda_ef**2 - 2 * chi_ge * lambda_ge**2 +\
                (7 * chi_ef*lambda_ge**2 - 5 * chi_ge * lambda_ef**2)/4
        zeta_2 = (chi_ge - chi_ef ) * (lambda_ge**2 + lambda_ef**2)
        rho,temp, temp2, temp3, temp4 = calc_spectrum(N,w_ge_tilde,Delta_d_tilde,
                                                        Delta_s_tilde,chi,Gamma_d,Gamma_s, zeta_1,zeta_2,kappa_n,
                                                        gamma_rel,gamma_dep, n_th_a)
        amp_sz.append((temp.tr()))
        amp_n.append((temp2.tr()))
        amp_x.append((temp3.tr()))
        amp_a.append((temp4.tr()))

In [277]:
Tr_sz = reshape(amp_sz,(-1,len(flux_values+1)))
Tr_n = reshape(amp_n,(-1,len(flux_values+1)))
Tr_x = reshape(amp_x,(-1,len(flux_values+1)))
Tr_a = reshape(amp_a,(-1,len(flux_values+1)))

In [278]:
fig, ax = subplots(2,2, figsize=(16,10))

im = ax[0,0].pcolor(flux_values,w_r/2/pi,abs(Tr_sz))#,vmin=0, vmax=1)
fig.colorbar(im, ax=ax[0,0])
# ax[0,0].set_xlim(4.27,4.39)
# ax[0,0].set_ylim(P_i,P_f)
ax[0,0].set_ylabel(r'Qubit Tone Power(dBm)',fontsize=10)
ax[0,0].set_xlabel(r'Qubit Tone Frequency (GHz)',fontsize=10)
ax[0,0].set_title(r'$Tr[\rho\sigma_z]$',fontsize=20)


im2 = ax[0,1].pcolor(flux_values,w_r/2/pi,abs(Tr_n))#,vmin=0, vmax=1)
fig.colorbar(im2, ax=ax[0,1])
# ax[0,1].set_ylim(P_i,P_f)
# ax[0,1].set_xlim(4.27,4.39)
ax[0,1].set_ylabel(r'Qubit Tone Power(dBm)',fontsize=10)
ax[0,1].set_xlabel(r'Qubit Tone Frequency (GHz)', fontsize=10)
ax[0,1].set_title(r'$Tr[\rho {a^{\dagger}a}]$',fontsize=20)

im3 = ax[1,0].pcolor(flux_values,w_r/2/pi,abs(Tr_x))#,vmin=0, vmax=1)
fig.colorbar(im2, ax=ax[1,0])
# ax[1,0].set_ylim(P_i,P_f)
# ax[1,0].set_xlim(4.27,4.39)
ax[1,0].set_ylabel(r'Qubit Tone Power(dBm)',fontsize=10)
ax[1,0].set_xlabel(r'Qubit Tone Frequency (GHz)', fontsize=10)
ax[1,0].set_title(r'$Tr[\rho (a^{\dagger} + a)]$',fontsize=20)

im4 = ax[1,1].pcolor(flux_values,w_r/2/pi,
                     (abs(Tr_a)))#,vmin=0, vmax=1)
fig.colorbar(im4, ax=ax[1,1])
# ax[1,1].set_ylim(P_i,P_f)
# ax[1,1].set_xlim(4.27,4.39)
ax[1,1].set_ylabel(r'Qubit Tone Power(dBm)',fontsize=10)
ax[1,1].set_xlabel(r'Qubit Tone Frequency (GHz)', fontsize=10)
ax[1,1].set_title(r'$Tr[\rho a]$',fontsize=20)


Out[278]:
<matplotlib.text.Text at 0x16d3c6320>

In [279]:
fig, ax = subplots(1,1, figsize=(16,10))

im = ax.pcolor(flux_values,w_r/2/pi,abs(Tr_n))#,vmin=3, vmax=5)
fig.colorbar(im, ax=ax)
# ax[0,0].set_xlim(4.27,4.39)
# ax[0,0].set_ylim(P_i,P_f)
ax.set_ylabel(r'Qubit Tone Power(dBm)',fontsize=10)
ax.set_xlabel(r'Qubit Tone Frequency (GHz)',fontsize=10)
ax.set_title(r'$Tr[\rho\sigma_z]$',fontsize=20)


Out[279]:
<matplotlib.text.Text at 0x17ba59208>

In [281]:
fig, ax = subplots(1,1, figsize=(20,10))

im = ax.pcolor(flux_values,w_r/2/pi,log10(abs(Tr_a)))#,vmin=0, vmax=1)
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('dBm',size=30)
# access to cbar tick labels:
cbar.ax.tick_params(labelsize=20) 
# im.tick_params(labelsize=10) 
ax.set_xlim(-pi/2,0)
ax.tick_params(labelsize=20)
ax.tick_params(axis='z', labelsize=20)
ax.set_ylim(5.04,5.075)
ax.set_ylabel(r'Frequency (GHz)',fontsize=30)
ax.set_xlabel(r'Flux (arb. units)',fontsize=30)


Out[281]:
<matplotlib.text.Text at 0x17cb2ecc0>

In [188]:
plot(  (cos(flux_values)))
plot(  (cos(flux_values)))


Out[188]:
[<matplotlib.lines.Line2D at 0x1607d49e8>]

In [245]:
d = 0.15
plot(  abs(cos(flux_values)) *sqrt(1+d**2 * tan(flux_values)**2))


Out[245]:
[<matplotlib.lines.Line2D at 0x170a60f98>]

In [37]:


In [39]:


In [3]:
!Head Flux\ Freq\ swap\ whole\ a

M,F,A,P= ImportXYZZ("/Users/rouxinol/Dropbox/Lab LaHaye/Hugo/2014/12052014/Flux Freq swap whole a",
                    col_x=0,col_y=2,col_Amp=3,col_Phase=4)


Head: Flux Freq swap whole a: No such file or directory

In [8]:
fig, ax = subplots(1,1, figsize=(20,12))

im = ax.pcolor(M/10,F/1e9,A.T,vmin=-110, vmax=-70)
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('Transmission amplitude (dBm)',size=25)
# access to cbar tick labels:
cbar.ax.tick_params(labelsize=25) 
# im.tick_params(labelsize=10) 
ax.set_xlim(-1,1)
ax.tick_params(labelsize=25)
ax.tick_params(axis='z', labelsize=20)
ax.set_ylim(5.04,5.075)
ax.set_ylabel(r'Frequency (GHz)',fontsize=30)
ax.set_xlabel(r'Flux (arb. units)',fontsize=30)

# ax.set_title(r'$|Tr[\rho a]|$',fontsize=30)


Out[8]:
<matplotlib.text.Text at 0x11b9cbda0>

In [10]:
cd /Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12032014/after transfer/


/Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12032014/after transfer

In [11]:
M,F,A,P= ImportXYZZ("/Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12032014/after transfer/MWPower MWFreq swp Flux2pt8 a")

In [13]:
fig, ax = subplots(1,1, figsize=(20,12))

im = ax.pcolor(F/1e9,-(118+M),A)#,vmin=0, vmax=1)
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('dBm',size=30)
# access to cbar tick labels:
cbar.ax.tick_params(labelsize=30) 
# im.tick_params(labelsize=10) 
ax.set_xlim(4.27,4.39)
ax.tick_params(labelsize=25)
ax.tick_params(axis='z', labelsize=20)
ax.set_ylim(-103,-138)
ax.set_ylabel(r'Qubit Tone Power(dBm)',fontsize=30)
ax.set_xlabel(r'Qubit Tone Frequency (GHz)',fontsize=30)

# ax.set_title(r'$|Tr[\rho a]|$',fontsize=30)


Out[13]:
<matplotlib.text.Text at 0x1202ba358>

In [14]:
cd /Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12152014/


/Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12152014

In [15]:
!Head Frequency\ Rabi\ e
M,F,A,P= ImportXYZZ("/Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12152014/Frequency Rabi e",
                    col_x=1,col_y=2,col_Amp=3,col_Phase=4)












In [18]:
fig, ax = subplots(1,1, figsize=(20,12))

im = ax.pcolor(M/1e9,F,A.T)#,vmin=0, vmax=1)
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('Amplitude (dBm)',size=30)
# access to cbar tick labels:
cbar.ax.tick_params(labelsize=25) 
# im.tick_params(labelsize=10) 
ax.set_xlim(3.932,3.937)
ax.tick_params(labelsize=25)
ax.get_xaxis().get_major_formatter().set_useOffset(False)
ax.tick_params(axis='z', labelsize=20)
ax.set_ylim(0,2000)
ax.set_ylabel(r'Pulse duration (ns)',fontsize=30)
ax.set_xlabel(r'Qubit Tone Frequency (GHz)',fontsize=30)

# ax.set_title(r'$|Tr[\rho a]|$',fontsize=30)


Out[18]:
<matplotlib.text.Text at 0x111f6bb00>

In [19]:
cd /Users/rouxinol/Dropbox/Lab LaHaye/Hugo/2014/12042014


/Users/rouxinol/Dropbox/lab lahaye/Hugo/2014/12042014

In [20]:
!Head CavityAttn\ MWFreq\ swp\ Flux2pt8\ b

P,F,A,P= ImportXYZZ("/Users/rouxinol/Dropbox/Lab LaHaye/Hugo/2014/12042014/CavityAttn MWFreq swp Flux2pt8 b")

fig, axes = subplots(1,1, figsize=(16,6))
for i in range(6):
    plot(F,A[i,])

A0 = dBmtoV(A[0,])
A1 = dBmtoV(A[1,])
A2 = dBmtoV(A[2,])
A3 = dBmtoV(A[3,])
A4 = dBmtoV(A[4,])
A5 = dBmtoV(A[5,])












In [27]:
plot(F/1e9,A[3,])
xlim(4.325,4.335)
ylim(-104,-100)


Out[27]:
(-104, -100)

In [72]:
j = 8
a = destroy(10)
(a.dag()*projection(10,j,j+1) + a*projection(10,j+1,j))


Out[72]:
Quantum object: dims = [[10], [10]], shape = [10, 10], type = oper, isherm = True\begin{equation*}\left(\begin{array}{*{11}c}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 3.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 3.0\\\end{array}\right)\end{equation*}

In [75]:
w = 2 * pi * 4
w * projection(10,8,8)


Out[75]:
Quantum object: dims = [[10], [10]], shape = [10, 10], type = oper, isherm = True\begin{equation*}\left(\begin{array}{*{11}c}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 25.133 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{array}\right)\end{equation*}

In [76]:
a.dag()* a + projection(10,0,0)


Out[76]:
Quantum object: dims = [[10], [10]], shape = [10, 10], type = oper, isherm = True\begin{equation*}\left(\begin{array}{*{11}c}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 1.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 2.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 3.000 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 4.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 5.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 6.000 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 7.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 8.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 9.0\\\end{array}\right)\end{equation*}

In [87]:
N = 2
M = 3
a = tensor(destroy(N), qeye(M))

In [88]:
ustate = basis(3, 0)
excited = basis(3, 1)
ground = basis(3, 2)
sigma_ge = tensor(qeye(N), ground * excited.dag()) # |g><e| sigma_ue = tensor(qeye(N), ustate * excited.dag()) # |u><e|

In [84]:


In [ ]: