(You should click this button, you dont need to see the code).
In [2]:
%pylab inline
from scipy.optimize import curve_fit
from scipy import stats
from fid_v_dephase_helpers import *
In [32]:
rootdir = '../out/2013-08-07/fid_v_crosstau_low/'
dat = get_data(rootdir, 'crosstau')
crosstau = dat[0].astype(np.float)
grect = dat[1][0]
gdiag = dat[1][1]
gcirc = dat[1][2]
circ_ratio = -gcirc/grect
diag_ratio = gdiag/grect
def func(x, a, b):
return a - np.exp(-(x/b))
popt1, pcov = curve_fit(func, crosstau, circ_ratio)
popt2, pcov = curve_fit(func, crosstau, diag_ratio)
In [33]:
plt.figure(figsize = (16/1.5, 9/1.5))
plt.xlabel('$\\tau_{HV}$', fontsize=18) ;
plt.legend(['gdiag/grect', '-gcirc/grect'])
plt.ylim([0,1])
plt.plot(crosstau, (1. + grect + gdiag - gcirc )/4)
plt.plot(crosstau, circ_ratio, 'g--', crosstau, func(crosstau, popt1[0], popt1[1]), 'g-')
plt.plot(crosstau, diag_ratio, 'r--', crosstau, func(crosstau, popt2[0], popt2[1]), 'r-')
plt.legend(['fidelity', 'circ_ratio', 'fit', 'diag_ratio', 'fit'])
Out[33]:
In [34]:
coherence = 1./(1. + 1./crosstau)
slope1, intercept1, a, b, c= stats.linregress(coherence, diag_ratio)
slope2, intercept2, a, b, c= stats.linregress(coherence, circ_ratio)
In [36]:
plt.figure(figsize=(16/1.5, 9/1.5))
plt.subplot(211)
plt.ylabel('Degree of corr ratio')
plt.xlim([0, 1])
plt.plot(coherence, diag_ratio, 'b--', coherence, intercept1 + slope1*coherence, 'b-')
plt.legend(['D/L'])
plt.subplot(212)
plt.xlabel('Coherence') ; plt.ylabel('Degree of corr ratio')
plt.xlim([0, 1])
plt.plot(coherence, circ_ratio, 'r--', coherence, intercept2 + slope2*coherence, 'r-')
plt.legend(['- C/L'])
Out[36]:
In [8]:
crosstau_temp = np.linspace(0.1, 10, 500)
coherence_temp = 1./(1. + 1./crosstau_temp)
plt.plot(crosstau_temp, coherence_temp, 'b--')
plt.xlabel('$\\tau_{HV}$', fontsize=18) ; plt.ylabel('Coherence', fontsize=18)
Out[8]:
In [39]:
rootdir = '../out/2013-08-07/fid_v_crosstau_fss1_longint/'
dat = get_data(rootdir, 'crosstau')
crosstau = dat[0].astype(np.float)
grect = dat[1][0]
gdiag = dat[1][1]
gcirc = dat[1][2]
circ_ratio = -gcirc/grect
diag_ratio = gdiag/grect
def func(x, a, b):
return a - np.exp(-(x/b))
popt1, pcov = curve_fit(func, crosstau, circ_ratio)
popt2, pcov = curve_fit(func, crosstau, diag_ratio)
In [40]:
plt.figure(figsize = (16/1.5, 9/1.5))
plt.xlabel('$\\tau_{HV}$', fontsize=18) ;
plt.legend(['gdiag/grect', '-gcirc/grect'])
plt.ylim([0,1])
plt.plot(crosstau, (1. + grect + gdiag - gcirc )/4)
plt.plot(crosstau, circ_ratio, 'g--', crosstau, func(crosstau, popt1[0], popt1[1]), 'g-')
plt.plot(crosstau, diag_ratio, 'r--', crosstau, func(crosstau, popt2[0], popt2[1]), 'r-')
plt.legend(['fidelity', 'circ_ratio', 'fit', 'diag_ratio', 'fit'])
Out[40]:
In [41]:
coherence = 1./(1. + 1./crosstau)
slope1, intercept1, a, b, c= stats.linregress(coherence[2:], diag_ratio[2:])
slope2, intercept2, a, b, c= stats.linregress(coherence[2:], circ_ratio[2:])
In [43]:
plt.figure(figsize=(16/1.5, 9/1.5))
plt.subplot(211)
plt.ylabel('Degree of corr ratio')
plt.xlim([0, 1]) ; plt.ylim([0,1])
plt.plot(coherence, (1. + grect + gdiag - gcirc )/4)
plt.plot(coherence, diag_ratio, 'b--', coherence[2:], intercept1 + slope1*coherence[2:], 'b-')
plt.legend(['Fid', 'D/L'])
plt.subplot(212)
plt.xlabel('Coherence') ; plt.ylabel('Degree of corr ratio')
plt.xlim([0, 1]) ; plt.ylim([0,1])
plt.plot(coherence, (1. + grect + gdiag - gcirc )/4)
plt.plot(coherence, circ_ratio, 'r--', coherence[2:], intercept2 + slope2*coherence[2:], 'r-')
plt.legend(['Fid', '- C/L'])
Out[43]:
In [ ]: