本文整理汇总了Python中frame.Frame.render方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.render方法的具体用法?Python Frame.render怎么用?Python Frame.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frame.Frame
的用法示例。
在下文中一共展示了Frame.render方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PdfPages
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
x = b*(.8+.2*np.arange(nx)/nx)
dx = np.squeeze(collect("dx",path=path,xind=[0,0]))
dy = np.squeeze(collect("dz",path=path,xind=[0,0]))
q = q0*np.power(x/aa,2.0)/(1.0- np.power(1.0-x/aa,nu+1.0)*(x<aa))
#pri
#q = q0*np.power(x/aa,2.0)
#pp = PdfPages('Ullmann.pdf')
fig = plt.figure()
a_mean = Frame(a.mean(axis=1),meta={'dx':dx,'sigma':a.std(axis=1),'stationary':True,
'ylabel':r'$\frac{2 \rho_s}{L_{\parallel}}$','linewidth':3,
'xlabel':r'$x/\rho_s$','title':'average ' +r'$\alpha$',
'fontsz':30})
a_mean.render(fig,111)
a_mean.ax.set_xlim(0, dx*nx)
plt.tick_params(axis='both',direction='in',which='both',labelsize=20)
formatter = ticker.ScalarFormatter()
formatter.set_powerlimits((-2, 2))
a_mean.ax.yaxis.set_major_formatter(formatter)
a_mean.ax.xaxis.set_label_coords(.5, -0.07)
plt.tight_layout()
fig.savefig('AverageAlpha.eps')#,pad_inches=.25,bbox_inches='tight')
fig.savefig('AverageAlpha.pdf')
fig = plt.figure()
a_mean = Frame(a.mean(axis=1),
meta={'dx':dx,'sigma':[np.max(a[:,2:-2],axis=1)-a.mean(axis=1),-np.min((a[:,2:-2]),axis=1)+a.mean(axis=1)],'stationary':True,
'ylabel':r'$\frac{2 \rho_s}{L_{\parallel}}$','linewidth':3,
'xlabel':r'$x/\rho_s$','title':'average ' +r'$\alpha$',
示例2: Frame
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
gamma_th = Frame(np.array(soln['gammamax'][1:ny/10]),meta={'dx':dky,'x0':dky,'stationary':True,'nt':gamma_exp.nt,'yscale':'linear','title':r'$\gamma_{linear}$','fontsz':28,'ylabel':r'$\frac{\gamma}{ \omega_{ci}}$','xlabel':r'$k_y \rho_s$','ticksize':28,'style':'--','linewidth':15})
#let's create single frame
import matplotlib.ticker as ticker
from matplotlib.ticker import FormatStrFormatter
lin_formatter = ticker.ScalarFormatter()
from pylab import legend
lin_formatter.set_powerlimits((1, 1))
#plt.autoscale(axis='x',tight=True)
#self.ax.axis('tight')
#pp = PdfPages('gamma.pdf')
fig = plt.figure()
gamma_exp.ax = None
gamma_exp.t = 100
gamma_th.ax = None
gamma_exp.render(fig,111)
gamma_th.render(fig,111)
plt.tick_params(axis='both',direction='in',which='both',labelsize=20)
print dir( gamma_th.ax.yaxis.get_offset_text())
gamma_th.ax.yaxis.get_offset_text().set_size(20)
#exit()
gamma_exp.ax.yaxis.set_major_formatter(lin_formatter)
plt.setp(gamma_th.img, color='b', linewidth=5.0,alpha=.7)
plt.setp(gamma_exp.img, color='r', linewidth=5.0,alpha=.7)
gamma_exp.ax.xaxis.set_label_coords(.65, -0.05)
plt.autoscale(axis='x',tight=True)
print 'gamma.img: ',gamma_exp.img
leg = plt.legend([gamma_exp.img,gamma_th.img],
('BOUT++', 'analytic'),
'best', shadow=False, fancybox=True,
示例3: read_data
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
#print all_pvtus[0:1]
data = read_data(base_dir,all_pvtus,pos,cached=True)
nt,nx,ny = data.shape
fftn = np.fft.fft2(data)
Ak = np.sqrt(fftn.conj()*fftn)
pp = PdfPages('summary.pdf')
fig = plt.figure()
frm_data = Frame(data[-1,:,:],meta={'mask':True,'dx':dx,'dy':dy,'title':'n',
'stationary':True})
frm_data.render(fig,221)
dkx = 1.
dky = (2.*np.pi)/Ly
power = Frame(np.real(Ak)[-1,0:30,0:30],meta={'mask':True,'dx':dkx,'dy':dky,'title':'n',
'stationary':True})
power.render(fig,222)
dt = 20
time = dt*np.arange(nt)
gamma_num = (np.gradient(np.log(np.real(Ak)))[0])/(np.gradient(time)[0])
gamma_ave = np.mean(gamma_num[-80:-20,:,:],axis=0)
analytic_soln = gamma_theory(ny,dky)
gamma_th = Frame(np.array(analytic_soln['gammamax'][1:ny/3]),
示例4: curve_fit
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
#return curve_fit(expfall2, x.flatten(), y.flatten(),p0=p0)
t1 = tstart
t2 = t1+tchunk
if debug:
print debug
n,u,Ak,phi,Te = get_data(t1,t2)
pp = PdfPages('debug.pdf')
fig = plt.figure()
print a_smooth.shape,path
vy = -((np.gradient(phi)[2])/dy)
debug_frm = Frame(np.mean(np.mean(vy,axis=2),axis=0),meta={'dx':dx,
'stationary':True,'xlabel':'x['+r'$\rho_s$'+']',
'ylabel':r'$v_y[C_s]$','yscale2':1,'ylabel2':''})
debug_frm.render(fig,111)
fig.savefig(pp, format='pdf')
pp.close()
exit()
while t2<=tstop:
n,u,Ak,phi,Te = get_data(t1,t2)
print n.shape
nt,nx,ny = n.shape
time = np.squeeze(collect("t_array",path=path,xind=[0,0]))[t1:t2+1]
phi_bias = np.squeeze(collect("bias_phi",zind=[0,0],path=path))
示例5: PdfPages
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
import matplotlib.ticker as ticker
from matplotlib.ticker import FormatStrFormatter
lin_formatter = ticker.ScalarFormatter()
from pylab import legend
lin_formatter.set_powerlimits((1, 1))
#plt.autoscale(axis='x',tight=True)
#self.ax.axis('tight')
#let's create single frame
pp = PdfPages('gamma.pdf')
fg = plt.figure()
gamma.ax = None
gamma.t = nt-2
gamma_th.ax = None
gamma.render(fig,111)
gamma_th.render(fig,111)
gamma.ax.yaxis.set_major_formatter(lin_formatter)
plt.setp(gamma_th.img, color='b', linewidth=3.0,alpha=.7)
plt.setp(gamma.img, color='r', linewidth=2.0,alpha=.7)
plt.autoscale(axis='x',tight=True)
print 'gamma.img: ',gamma.img
leg = plt.legend([gamma.img,gamma_th.img],('BOUT++', 'analytic'),
'best', shadow=False, fancybox=True)
leg.get_frame().set_alpha(0.6)
fig.savefig(pp,format='pdf')
plt.close(fig)
pp.close()
示例6: curve_fit
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
#return curve_fit(expfall2, x.flatten(), y.flatten(),p0=p0)
t1 = tstart
t2 = t1+tchunk
if debug:
print debug
n,u,Ak,phi,Te = get_data(t1,t2)
pp = PdfPages('debug.pdf')
fig = plt.figure()
print a_smooth.shape,path
vy = -((np.gradient(phi)[2])/dy)
debug_frm = Frame(np.mean(np.mean(vy,axis=2),axis=0),meta={'dx':dx,
'stationary':True,'xlabel':'x['+r'$\rho_s$'+']',
'ylabel':r'$v_y[C_s]$','yscale2':1,'ylabel2':''})
debug_frm.render(fig,111)
fig.savefig(pp, format='pdf')
pp.close()
exit()
print 'enter main loop'
while t2<=tstop:
print 'about to get data'
n,u,Ak,phi,Te = get_data(t1,t2)
#print 'shape:', Ak.shape
nt,nx,ny = n.shape
time = np.squeeze(collect("t_array",path=path,xind=[0,0]))[t1:t2+1]
示例7: movie
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
def movie(self,data2=None,moviename='output',norm=False,
overcontour=True,aspect='auto',meta=None,
cache='/tmp/',hd=False,nlevels = 9,removeZero=True,
t_array=None,outline=True,bk=None,fps=5.0,fast=True,
encoder='mencoder'):
data = self.raw_data
size = data.shape
ndims = len(size)
nt,nx,nz = size
if norm:
data_n = normalize(data)
else:
data_n = data
if data2 != None:
data_c = data2
else:
data_c = data
if norm:
data_c = normalize(data_c)
if fast:
dpi = 100
else:
dpi = 240
amp = self.amp
kx_max = self.kx_max
kz_max = self.ky_max
fft_data = self.fft
power = self.power
acorr = self.acorr
kx = self.kx
kz = self.ky
k = np.sqrt(kx**2 + kz**2)
axhandle = []
lin_formatter = ticker.ScalarFormatter()
lin_formatter.set_powerlimits((-2, 2))
font = {'family' : 'normal',
'weight' : 'normal',
'size' : 4}
axes = {'linewidth': .5}
tickset ={'markeredgewidth': .25}
rc('font', **font)
rc('axes',**axes)
rc('lines',**tickset)
plt.tick_params(axis='both',direction='in',which='both')
jet = plt.get_cmap('jet',2000)
#this is where we start using the frame object to make it happen
frm_data = Frame(self.raw_data,meta={'mask':True,'data_c':data_c})
frm_power = Frame(self.power,meta={'zoom':True,'coords':'k','center':True})
frm_amp = Frame(self.amp)
frm_cm = Frame(np.array(self.xmoment[1]))
frm_acorr = Frame(self.acorr,meta={'center':True})
fig = plt.figure()
frm_data.render(fig,231)
frm_power.render(fig,232)
frm_amp.render(fig,233)
frm_cm.render(fig,234)
frm_acorr.render(fig,235)
def update_img(t):
print t
frm_data.update()
frm_power.update()
frm_amp.update()
frm_cm.update()
frm_acorr.update()
ani = animation.FuncAnimation(fig,update_img,self.nt-2)
ani.save(moviename+'.mp4',writer=encoder,dpi=dpi,bitrate=20000,fps=5)
#plt.savefig('output.pdf',dpi=dpi)
# frames[1].render(fig,221)
# plt.savefig('output.pdf',dpi=dpi)
plt.close(fig)
return 0
示例8: StringIO
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import render [as 别名]
offset.append(popt[0])
nmax.append(n.max())
print n.shape,phi.shape
print 'time:', time
sys.stdout = mystdout = StringIO()
pp = PdfPages(save_path+key+'lam.pdf')
fig = plt.figure()
lam_history = Frame(lam,meta={'dx':tchunk,'stationary':False,'fontsz':18,'ylabel':'',
'xlabel':r'$t$','ticksize':14,'title':r'$\lambda$','xlabel':r't'})
lam_history.ax = fig.add_subplot(111)
lam_history.ax.set_ylim([0.0,100.*np.round((lam_history[-1]+100.)/100.)])
lam_history.render(fig,111)
print lam_history.x
fig.savefig(pp,format='pdf')
plt.close(fig)
pp.close()
pp = PdfPages(save_path+'/'+key+'compare_lam.pdf')
fig = plt.figure()
lam_history.ax = None
lam_history.yscale='linear'
#lam_history = Frame(lam,meta={'stationary':False,'title':'','fontsz':18,'ylabel':'','xlabel':r'$t$',
# 'ticksize':14,'yscale':'linear'})
lam_rough_history = Frame(lam_rough,meta={'stationary':False,'title':'','fontsz':18,'ylabel':'','xlabel':r'$t$',
'ticksize':14,'yscale':'linear','dx':tchunk})