Example #1
0
def targetstate_analysis(foldernamez,foldernamex, filename='Spin_RO',date='',RO_time=''):
    zdata_norm,zdata_corr=sc.plot_feedback(foldernamez, filename='Spin_RO',d=date)
    print RO_time
    if ((RO_time=='2us') or (RO_time=='4us') or (RO_time=='6us')): 
        xdata_norm,xdata_corr=sc.plot_feedback(foldernamex, filename='Spin_RO',d=date)
        SNfit=sc.fit_sin(xdata_norm['sweep_par'],xdata_corr['FinalRO_SN'],xdata_corr['uFinalRO_SN'])
        FSfit=sc.fit_sin(xdata_norm['sweep_par'],xdata_corr['FinalRO_FS'],xdata_corr['uFinalRO_FS'])
        allfit=sc.fit_sin(xdata_norm['sweep_par'],xdata_corr['FinalRO_All'],xdata_corr['uFinalRO_All'])
        N=(xdata_norm['SN'][2]+xdata_norm['FS'][2])
        xsucces= (xdata_norm['SN'][2]*(abs(SNfit['params'][1])*2)+
			xdata_norm['FS'][2]*(abs(FSfit['params'][1])*2))/N
	uxsucces=np.sqrt(((xdata_norm['SN'][2]*abs(SNfit['error_dict']['a'])*2)/N)**2+
	                 ((xdata_norm['FS'][2]*abs(FSfit['error_dict']['a'])*2)/N)**2)
        Sx=[abs(FSfit['params'][1])*2,abs(SNfit['params'][1])*2,xsucces]
        uSx=[FSfit['error_dict']['a']*2,SNfit['error_dict']['a']*2,uxsucces,0]
	i=2
	Sz=[zdata_corr['FinalRO_FS'][i],zdata_corr['FinalRO_SN'][i],zdata_corr['FinalRO_Succes'][i]]
    else:
	Sx=[0,0,0]
	uSx=[0,0,0]
	i=1
	Sz=[1-zdata_corr['FinalRO_FS'][i],1-zdata_corr['FinalRO_SN'][i],1-zdata_corr['FinalRO_Succes'][i]]
    if (RO_time=='15us'):	
	i=2
	Sz=[zdata_corr['FinalRO_FS'][i],zdata_corr['FinalRO_SN'][i],zdata_corr['FinalRO_Succes'][i]]


    

    Sy=[0,0,0,0]
    fdata={}
    fdata['zdata_norm']=zdata_norm
    fdata['zdata_corr']=zdata_corr
    fdata['res_FS']=[2*(1-Sz[0])-1,Sx[0],Sy[0],0]
    fdata['res_SN']=[2*(1-Sz[1])-1,Sx[1],Sy[1],0]
    fdata['res_Succes']=[2*(1-Sz[2])-1,Sx[2],Sy[2],0]
    fdata['ures_FS']=[zdata_corr['uFinalRO_FS'][i]*2,uSx[0],0,0]
    fdata['ures_SN']=[zdata_corr['uFinalRO_SN'][i]*2,uSx[1],0,0]
    fdata['ures_Succes']=[zdata_corr['uFinalRO_Succes'][i]*2,uSx[2],0,0]
    #fdata['SNfit']=SNfit
    #fdata['FSfit']=FSfit
    #fdata['allfit']=allfit
    meas_strength = calc_meas_strength(50,12,1400)
    fdata['meas_strength'] = meas_strength
    fdata['res_ideal']=[np.sin(meas_strength*np.pi/2.),np.cos(meas_strength*np.pi/2.),0,0]
    fdata['dm'],fdata['f'],fdata['uf'],fdata['ideal']=tls.calc_fidelity_psi(tau,(fdata['res_Succes'][0]+1)/2.,fdata['res_Succes'][1]/2.+0.5,utau,fdata['ures_Succes'][0]/2.,fdata['ures_Succes'][1],th=th,dir=dir)
    tls.make_hist(fdata['dm'][0],np.array([[0,0],[0,0]]))

    #print 'Fidelity',f,'  +-',uf
    #print 'Ideal state:', ideal
    #print 'uz: ',uzcor,'  ux: ',uxcor
    np.savez(os.path.join(basepath,name+RO_time),**fdata)
Example #2
0
    data_norm['FinalRO_FF']=data['FinalRO_FF']/(data['FF']+0.)
    data_norm['FinalRO_Succes']=(data['FinalRO_SN']+data['FinalRO_FS'])/(data['SN']+data['FS']+0.)
    data_norm['FinalRO_All']=(data['FinalRO_SN']+data['FinalRO_FS']+data['FinalRO_FF'])/(reps+0.)

    print data['FS']
    for i in np.arange(len(data['SN'])):
        z+=data['FinalRO_FS'][i]
        zrep+=data['FS'][i]
    print zrep
    znorm=z/(zrep+0.)
    data.close()

phasecor,uphasecor=sc.get_nuclear_ROC(phasenorm,rep,sc.get_latest_data('SSRO',date=d))
zcor, uzcor=sc.get_nuclear_ROC(znorm,zrep,sc.get_latest_data('SSRO',date=zd))
figure1=plt.figure(2)
ax=figure1.add_subplot(111)
ax.errorbar(x,phasenorm,fmt='o',yerr=1/sqrt(rep),color='Crimson')
ax.errorbar(x,phasecor,fmt='o',yerr=uphasecor,color='RoyalBlue')
phase_fit=sc.fit_sin(x,phasecor,uphasecor)
xcor=np.abs(phase_fit['params'][1])+np.abs(phase_fit['params'][2])
uxcor=np.sqrt(phase_fit['error_dict']['A']**2+phase_fit['error_dict']['a']**2)

dm,f,uf,ideal=tls.calc_fidelity_psi(tau,1-zcor,xcor,utau,uzcor,uxcor,th=th,dir=dir)
idr=tls.make_rho(ideal[0]**2,ideal[1]*ideal[0])
print idr

tls.make_hist(dm[0],np.array([[0,0],[0,0]]))
print 'Fidelity',f,'  +-',uf
print 'Ideal state:', ideal
print 'uz: ',uzcor,'  ux: ',uxcor
    uxcor = result_xmeas["uy"][index]
    uycor = result_ymeas["uy"][index]
else:
    zcor = result_zcond["y_cond"][index]
    xcor = result_xcond["y_cond"][index]
    ycor = result_ycond["y_cond"][index]

    uzcor = result_zcond["uy_cond"][index]
    uxcor = result_xcond["uy_cond"][index]
    uycor = result_ycond["uy_cond"][index]
dm, f, uf, ideal = tls.calc_fidelity_psi(tau, zcor, xcor, utau, uzcor, uxcor, y=ycor, uy=uycor, th=th, dir=dir)
idr = tls.make_rho(ideal[0] ** 2, ideal[1] * ideal[0])
print idr

tls.make_hist(
    dm[0], np.array([[0, 0], [0, 0]]), path=r"D:\machielblok\Desktop\PhD\QTlab\data\output\backaction", title=t
)
print "Fidelity", f, "  +-", uf
print "Ideal state:", ideal
print "uz: ", uzcor, "  ux: ", uxcor
"""

result_25ns=sc.plot_rabi(sc.get_latest_data(datafolders[0],datapath=dp),fid=corr)
result_125ns=sc.plot_rabi(sc.get_latest_data(datafolders[1],datapath=dp),fid=corr)
result_225ns=sc.plot_rabi(sc.get_latest_data(datafolders[2],datapath=dp),fid=corr)

date='20130116'
dp=os.path.join(meas_folder, date)
result_zmeas=sc.plot_data_MBI(sc.get_latest_data('180000',datapath=dp),fid=corr)
rho_25 = make_rho(result_zmeas['y'][3],abs(result_25ns[0]['params'][1]))
rho_125 =make_rho(result_zmeas['y'][11],abs(result_125ns[0]['params'][1]))
    data.close()

phasecor, uphasecor = sc.get_nuclear_ROC(phasenorm, rep,
                                         sc.get_latest_data('SSRO', date=d))
zcor, uzcor = sc.get_nuclear_ROC(znorm, zrep,
                                 sc.get_latest_data('SSRO', date=zd))
figure1 = plt.figure(2)
ax = figure1.add_subplot(111)
ax.errorbar(x, phasenorm, fmt='o', yerr=1 / sqrt(rep), color='Crimson')
ax.errorbar(x, phasecor, fmt='o', yerr=uphasecor, color='RoyalBlue')
phase_fit = sc.fit_sin(x, phasecor, uphasecor)
xcor = np.abs(phase_fit['params'][1]) + np.abs(phase_fit['params'][2])
uxcor = np.sqrt(phase_fit['error_dict']['A']**2 +
                phase_fit['error_dict']['a']**2)

dm, f, uf, ideal = tls.calc_fidelity_psi(tau,
                                         1 - zcor,
                                         xcor,
                                         utau,
                                         uzcor,
                                         uxcor,
                                         th=th,
                                         dir=dir)
idr = tls.make_rho(ideal[0]**2, ideal[1] * ideal[0])
print idr

tls.make_hist(dm[0], np.array([[0, 0], [0, 0]]), path=p, title=t)
print 'Fidelity', f, '  +-', uf
print 'Ideal state:', ideal
print 'uz: ', uzcor, '  ux: ', uxcor
Example #5
0
    uzcor=result_zmeas['uy'][index]
    uxcor=result_xmeas['uy'][index]
    uycor=result_ymeas['uy'][index]
else:
    zcor=result_zcond['y_cond'][index]
    xcor=result_xcond['y_cond'][index]
    ycor=result_ycond['y_cond'][index]

    uzcor=result_zcond['uy_cond'][index]
    uxcor=result_xcond['uy_cond'][index]
    uycor=result_ycond['uy_cond'][index]
dm,f,uf,ideal=tls.calc_fidelity_psi(tau,zcor,xcor,utau,uzcor,uxcor,y=ycor,uy=uycor,th=th,dir=dir)
idr=tls.make_rho(ideal[0]**2,ideal[1]*ideal[0])
print idr

tls.make_hist(dm[0],np.array([[0,0],[0,0]]),path=r'D:\machielblok\Desktop\PhD\QTlab\data\output\backaction',title=t)
print 'Fidelity',f,'  +-',uf
print 'Ideal state:', ideal
print 'uz: ',uzcor,'  ux: ',uxcor
'''

result_25ns=sc.plot_rabi(sc.get_latest_data(datafolders[0],datapath=dp),fid=corr)
result_125ns=sc.plot_rabi(sc.get_latest_data(datafolders[1],datapath=dp),fid=corr)
result_225ns=sc.plot_rabi(sc.get_latest_data(datafolders[2],datapath=dp),fid=corr)

date='20130116'
dp=os.path.join(meas_folder, date)
result_zmeas=sc.plot_data_MBI(sc.get_latest_data('180000',datapath=dp),fid=corr)
rho_25 = make_rho(result_zmeas['y'][3],abs(result_25ns[0]['params'][1]))
rho_125 =make_rho(result_zmeas['y'][11],abs(result_125ns[0]['params'][1]))
rho_225 =make_rho(result_zmeas['y'][-1],abs(result_225ns[0]['params'][1]))
Example #6
0
def targetstate_analysis(foldernamez,
                         foldernamex,
                         filename='Spin_RO',
                         date='',
                         RO_time=''):
    zdata_norm, zdata_corr = sc.plot_feedback(foldernamez,
                                              filename='Spin_RO',
                                              d=date)
    print RO_time
    if ((RO_time == '2us') or (RO_time == '4us') or (RO_time == '6us')):
        xdata_norm, xdata_corr = sc.plot_feedback(foldernamex,
                                                  filename='Spin_RO',
                                                  d=date)
        SNfit = sc.fit_sin(xdata_norm['sweep_par'], xdata_corr['FinalRO_SN'],
                           xdata_corr['uFinalRO_SN'])
        FSfit = sc.fit_sin(xdata_norm['sweep_par'], xdata_corr['FinalRO_FS'],
                           xdata_corr['uFinalRO_FS'])
        allfit = sc.fit_sin(xdata_norm['sweep_par'], xdata_corr['FinalRO_All'],
                            xdata_corr['uFinalRO_All'])
        N = (xdata_norm['SN'][2] + xdata_norm['FS'][2])
        xsucces = (xdata_norm['SN'][2] *
                   (abs(SNfit['params'][1]) * 2) + xdata_norm['FS'][2] *
                   (abs(FSfit['params'][1]) * 2)) / N
        uxsucces = np.sqrt(
            ((xdata_norm['SN'][2] * abs(SNfit['error_dict']['a']) * 2) /
             N)**2 +
            ((xdata_norm['FS'][2] * abs(FSfit['error_dict']['a']) * 2) / N)**2)
        Sx = [
            abs(FSfit['params'][1]) * 2,
            abs(SNfit['params'][1]) * 2, xsucces
        ]
        uSx = [
            FSfit['error_dict']['a'] * 2, SNfit['error_dict']['a'] * 2,
            uxsucces, 0
        ]
        i = 2
        Sz = [
            zdata_corr['FinalRO_FS'][i], zdata_corr['FinalRO_SN'][i],
            zdata_corr['FinalRO_Succes'][i]
        ]
    else:
        Sx = [0, 0, 0]
        uSx = [0, 0, 0]
        i = 1
        Sz = [
            1 - zdata_corr['FinalRO_FS'][i], 1 - zdata_corr['FinalRO_SN'][i],
            1 - zdata_corr['FinalRO_Succes'][i]
        ]
    if (RO_time == '15us'):
        i = 2
        Sz = [
            zdata_corr['FinalRO_FS'][i], zdata_corr['FinalRO_SN'][i],
            zdata_corr['FinalRO_Succes'][i]
        ]

    Sy = [0, 0, 0, 0]
    fdata = {}
    fdata['zdata_norm'] = zdata_norm
    fdata['zdata_corr'] = zdata_corr
    fdata['res_FS'] = [2 * (1 - Sz[0]) - 1, Sx[0], Sy[0], 0]
    fdata['res_SN'] = [2 * (1 - Sz[1]) - 1, Sx[1], Sy[1], 0]
    fdata['res_Succes'] = [2 * (1 - Sz[2]) - 1, Sx[2], Sy[2], 0]
    fdata['ures_FS'] = [zdata_corr['uFinalRO_FS'][i] * 2, uSx[0], 0, 0]
    fdata['ures_SN'] = [zdata_corr['uFinalRO_SN'][i] * 2, uSx[1], 0, 0]
    fdata['ures_Succes'] = [zdata_corr['uFinalRO_Succes'][i] * 2, uSx[2], 0, 0]
    #fdata['SNfit']=SNfit
    #fdata['FSfit']=FSfit
    #fdata['allfit']=allfit
    meas_strength = calc_meas_strength(50, 12, 1400)
    fdata['meas_strength'] = meas_strength
    fdata['res_ideal'] = [
        np.sin(meas_strength * np.pi / 2.),
        np.cos(meas_strength * np.pi / 2.), 0, 0
    ]
    fdata['dm'], fdata['f'], fdata['uf'], fdata[
        'ideal'] = tls.calc_fidelity_psi(tau,
                                         (fdata['res_Succes'][0] + 1) / 2.,
                                         fdata['res_Succes'][1] / 2. + 0.5,
                                         utau,
                                         fdata['ures_Succes'][0] / 2.,
                                         fdata['ures_Succes'][1],
                                         th=th,
                                         dir=dir)
    tls.make_hist(fdata['dm'][0], np.array([[0, 0], [0, 0]]))

    #print 'Fidelity',f,'  +-',uf
    #print 'Ideal state:', ideal
    #print 'uz: ',uzcor,'  ux: ',uxcor
    np.savez(os.path.join(basepath, name + RO_time), **fdata)
Example #7
0
    data.close()

phasecor, uphasecor = sc.get_nuclear_ROC(phasenorm, rep,
                                         sc.get_latest_data('SSRO', date=d))
zcor, uzcor = sc.get_nuclear_ROC(znorm, zrep,
                                 sc.get_latest_data('SSRO', date=zd))
figure1 = plt.figure(2)
ax = figure1.add_subplot(111)
ax.errorbar(x, phasenorm, fmt='o', yerr=1 / sqrt(rep), color='Crimson')
ax.errorbar(x, phasecor, fmt='o', yerr=uphasecor, color='RoyalBlue')
phase_fit = sc.fit_sin(x, phasecor, uphasecor)
xcor = np.abs(phase_fit['params'][1]) + np.abs(phase_fit['params'][2])
uxcor = np.sqrt(phase_fit['error_dict']['A']**2 +
                phase_fit['error_dict']['a']**2)

dm, f, uf, ideal = tls.calc_fidelity_psi(tau,
                                         1 - zcor,
                                         xcor,
                                         utau,
                                         uzcor,
                                         uxcor,
                                         th=th,
                                         dir=dir)
idr = tls.make_rho(ideal[0]**2, ideal[1] * ideal[0])
print idr

tls.make_hist(dm[0], np.array([[0, 0], [0, 0]]))
print 'Fidelity', f, '  +-', uf
print 'Ideal state:', ideal
print 'uz: ', uzcor, '  ux: ', uxcor