In [ ]:
## Benchmark testing the code for finding the optimal green value for evaporation
In [2]:
import optevap
In [3]:
%%timeit
optevap.optimal( s0=7., wL=45., wC=28.)
In [46]:
import optevap
s=7.0
aS=650.
def ext( wIR, alpha ):
if alpha <= 0.85:
e = 1.10*wIR
elif alpha <=0.90:
e = 1.20*wIR
elif alpha < 0.95:
e = 1.30*wIR
elif alpha <= 1.:
e = 1.40*wIR
elif alpha <= 1.05:
e = 1.45*wIR
elif alpha <= 1.10:
e = 1.50*wIR
elif alpha <= 1.13:
e = 1.50*wIR
elif alpha <= 1.16:
e = 1.50*wIR
elif alpha <= 1.18:
e = 1.50*wIR
elif alpha <= 1.20:
e = 1.50*wIR
elif alpha <= 1.30:
e = 1.45*wIR
else:
e = 1.30*wIR
estr = "wIR=%.2f, alpha=%.3f --> extents=%.2f"%(wIR,alpha,e)
return e, estr
savefile = 'alpha_opt/001.dat'
open(savefile, 'w').close()
wIR = 47.
wGRs = np.arange( 28., 72., 0.5)
for wGR in wGRs:
if np.abs( wIR/wGR - 1.17 ) < 0.0:
continue
else:
print " wGR=%d"%wGR,
#print "wGR=%d.." % (wGR),
T=0.2; extents, extstr = ext( wIR, wIR/wGR)
try:
res = np.array( [ [s, wIR, wGR]+ \
optevap.optimal( s0=s, wL=wIR, wC=wGR, a_s=aS, T_Er=T, \
extents=extents) ] )
f_handle = file(savefile, 'a')
np.savetxt(f_handle, res, fmt='%.4g')
f_handle.close()
except Exception as e:
print " wIR=%d,wGR=%d->ERR"%(wIR,wGR)
print extstr
print e
raise
We create a pandas data frame with the optimized data
In [47]:
import pandas as pd
dat = np.loadtxt('alpha_opt/001.dat')
df = pd.DataFrame( dat, columns=['v0', 'wIR', 'wGR', 'g0', 'EtaF', 'N', 'SN', 'HWHM', 'HWHMwL', 'DeltaF'])
df['alpha'] = df['wIR'] / df['wGR']
df
Out[47]:
Then we plot the optimization results
In [55]:
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
color = ['blue', 'green', 'red', 'black']
dat = np.loadtxt('alpha_opt/001.dat')
df = pd.DataFrame( dat, columns=['v0', 'wIR', 'wGR', 'g0', 'EtaF', 'N', 'SN', 'HWHM', 'HWHMwL', 'DeltaF'])
T = 0.2
fig = plt.figure(figsize=(8.5,2.4))
gs = matplotlib.gridspec.GridSpec(1,4, wspace=0.36, hspace=0.35,\
left=0.05, right=0.99, bottom=0.18, top=0.93)
axL = [ fig.add_subplot( gs[i] ) for i in range(4) ]
axL[0].plot( df['wIR']/df['wGR'], df['g0'], 'o-', color='black', ms=3)
axL[1].plot( df['wIR']/df['wGR'], df['EtaF'], 'o-', color='black', ms=3)
axL[2].plot( df['wIR']/df['wGR'], df['DeltaF'], 'o-', color='black', ms=3)
axL[3].plot( df['wIR']/df['wGR'], df['SN'], 'o-', color='black', ms=3)
YLAB = ['$g_{0}$', '$\eta_{F}$', '$\Delta_{F}$', '$S/N$']
for i,ax in enumerate(axL):
ax.set_xlabel(r'$\alpha_{\mathrm{w}}$')
ax.set_xlim(0.85,1.22)
ax.set_ylabel( YLAB[i] )
ax.grid(alpha=0.3)
ax.xaxis.set_major_locator( matplotlib.ticker.MultipleLocator(0.1))
ax.xaxis.set_minor_locator( matplotlib.ticker.MultipleLocator(0.05))
ax.tick_params(axis='both', which='major', length=2.5)
ax.tick_params(axis='both', which='minor', length=1.5)
ax.axvline(1.136, color='0.2', alpha=0.5, lw=2.)
ax.text( 0.78, 1.01, r'$\alpha_{\mathrm{evap}}$', \
ha='center', va='bottom', transform=ax.transAxes)
axL[0].set_ylim(3.2,4.6)
axL[1].set_ylim(0.8, 3.2)
axL[2].set_ylim(0.,1.8)
#axL[4].set_ylim(0.,10.)
#axL[4].legend( bbox_to_anchor = (0.,1.1), loc='upper left', \
# numpoints=1, labelspacing=0.2, prop={'size':8},\
# handlelength=1.1, handletextpad=0.5 )
fig.savefig('alpha_opt/001.png', dpi=300)
In [36]:
import optevap
s=7.0
aS=650.
import pandas as pd
dat = np.loadtxt('alpha_opt/001.dat')
df = pd.DataFrame( dat, columns=['v0', 'wIR', 'wGR', 'g0', 'EtaF', 'N', 'SN', 'HWHM', 'HWHMwL', 'DeltaF'])
df['alpha'] = df['wIR'] / df['wGR']
from scipy.interpolate import interp1d
g0f = interp1d( df['alpha'].values[::-1], df['g0'].values[::-1] )
def ext( wIR, alpha ):
if alpha <= 0.85:
e = 1.10*wIR
elif alpha <=0.90:
e = 1.20*wIR
elif alpha < 0.95:
e = 1.30*wIR
elif alpha <= 1.:
e = 1.40*wIR
elif alpha <= 1.05:
e = 1.45*wIR
elif alpha <= 1.10:
e = 1.50*wIR
elif alpha <= 1.13:
e = 1.50*wIR
elif alpha <= 1.16:
e = 1.50*wIR
elif alpha <= 1.18:
e = 1.50*wIR
elif alpha <= 1.20:
e = 1.50*wIR
elif alpha <= 1.30:
e = 1.45*wIR
else:
e = 1.30*wIR
estr = "wIR=%.2f, alpha=%.3f --> extents=%.2f"%(wIR,alpha,e)
return e, estr
savefile = 'alpha_opt/002.dat'
open(savefile, 'w').close()
wIRs = [45., 50., 55., 60., 65., 70.]
for wIR in wIRs:
print " wIR=%d"%wIR,
wGRs = np.arange( 28., 72., 1.)
for wGR in wGRs:
alpha = wIR/wGR
if alpha < 0.8 or alpha > 1.3:
continue
T=0.2; extents, extstr = ext( wIR, wIR/wGR)
try:
g0 = g0f(alpha) -0.02
res = np.array( [ [s, wIR, wGR]+ \
optevap.get_trap_results( s0=s, wL=wIR, wC=wGR, a_s=aS, T_Er=T, \
extents=extents, g0=g0) ] )
f_handle = file(savefile, 'a')
np.savetxt(f_handle, res, fmt='%.4g')
f_handle.close()
except Exception as e:
print "\n\nwIR=%d,wGR=%d->ERR"%(wIR,wGR)
print alpha
print g0f(alpha) - 0.02
print optevap.optimal( s0=s, wL=wIR, wC=wGR, a_s=aS, T_Er=T, \
extents=extents)
print extstr
print e
raise
In [65]:
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
color = ['blue', 'green', 'red', 'black']
dat = np.loadtxt('alpha_opt/002.dat')
df = pd.DataFrame( dat, columns=['v0', 'wIR', 'wGR', 'g0', 'EtaF', 'N', 'SN', 'HWHM', 'HWHMwL', 'DeltaF'])
T = 0.2
fig = plt.figure(figsize=(5.3,2.3))
gs = matplotlib.gridspec.GridSpec(1,2, wspace=0.36, hspace=0.35,\
left=0.08, right=0.99, bottom=0.16, top=0.93)
axL = [ fig.add_subplot( gs[i] ) for i in range(2) ]
for wIR in np.unique(df['wIR']):
subdf = df[ df['wIR'] == wIR ]
axL[0].plot( subdf['wIR']/subdf['wGR'], subdf['N']/1e5, 'o-', ms=3, label=r'${:d}$'.format(int(wIR)))
axL[1].plot( subdf['wIR']/subdf['wGR'], subdf['HWHMwL'], 'o-', ms=3)
YLAB = ['$N/10^{5}$', '$\mathrm{HWHM}/w_{L}$']
for i,ax in enumerate(axL):
ax.set_xlabel(r'$\alpha_{\mathrm{w}}$')
ax.set_xlim(0.85,1.22)
ax.set_ylabel( YLAB[i] )
ax.grid(alpha=0.3)
ax.xaxis.set_major_locator( matplotlib.ticker.MultipleLocator(0.1))
ax.xaxis.set_minor_locator( matplotlib.ticker.MultipleLocator(0.05))
ax.tick_params(axis='both', which='major', length=2.5)
ax.tick_params(axis='both', which='minor', length=1.5)
ax.axvline(1.136, color='0.2', alpha=0.5, lw=2.)
ax.text( 0.76, 1.01, r'$\alpha_{\mathrm{evap}}$', \
ha='center', va='bottom', transform=ax.transAxes)
#axL[0].set_ylim(3.2,4.6)
#axL[1].set_ylim(0.8, 3.2)
#axL[4].set_ylim(0.,10.)
axL[0].legend( bbox_to_anchor = (0.05,0.95), loc='upper left', title='$w_{L}\,(\mu\mathrm{m})$',\
numpoints=1, labelspacing=0.2, prop={'size':8},\
handlelength=1.1, handletextpad=0.5 )
fig.savefig('alpha_opt/002.png', dpi=300)
In [7]:
import scubic
import lda
s=7.
g=4.35
wIR=71.
wGR=80.
T = 0.2
extents=50.
pot = scubic.sc(allIR=s, allGR=g, allIRw=wIR, allGRw=wGR)
test = lda.lda(potential = pot, Temperature=T, a_s=650., extents=extents, globalMu='halfMott', verbose=True, ignoreExtents=True)
print test.Number
fig = lda.plotLine( test , line_direction='111', extents=extents)
print test.getRadius() / wIR
In [10]:
import scubic
import lda
s=7.
g=4.3479
wIR=60.
wGR=60.
pot = scubic.sc(allIR=s, allGR=g, allIRw=wIR, allGRw=wGR)
test = lda.lda(potential = pot, Temperature=0.26, a_s=650., extents=50., globalMu='halfMott', verbose=True)
print test.Number
fig = lda.plotLine( test , line_direction='111', extents=50.)
In [32]:
import optevap
wIR = 47.
wGR = 40.
s=7.
results = []
results.append( [s, wIR, wGR]+optevap.optimal( s0=s, wL=wIR, wC=wGR, T_Er=0.383, a_s=650., extents=100. ))
print results
In [34]:
import scubic
import lda
s=7.
g=4.0066
wIR=47.
wGR=40.
pot = scubic.sc(allIR=s, allGR=g, allIRw=wIR, allGRw=wGR)
test = lda.lda(potential = pot, a_s=650., globalMu='halfMott', Temperature=0.383, extents=100., verbose=True)
fig = lda.plotLine( test , line_direction='111', extents=50.)
In [37]:
import optevap
wIR = 32.
wGR = 27.
s=7.
results = []
results.append( [s, wIR, wGR]+optevap.optimal( s0=s, wL=wIR, wC=wGR, T_Er=0.383, a_s=650., extents=80. ))
print results
In [39]:
import scubic
import lda
s=7.
g=3.938
wIR=32.
wGR=27.
pot = scubic.sc(allIR=s, allGR=g, allIRw=wIR, allGRw=wGR)
test = lda.lda(potential = pot, a_s=650., globalMu='halfMott', Temperature=0.383, extents=80., verbose=True)
fig = lda.plotLine( test , line_direction='111', extents=50.)
In [ ]: