当前位置: 首页>>代码示例>>Python>>正文


Python setting.setProperty函数代码示例

本文整理汇总了Python中pyramids.plot.setting.setProperty函数的典型用法代码示例。如果您正苦于以下问题:Python setProperty函数的具体用法?Python setProperty怎么用?Python setProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setProperty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: drawEnergy

def drawEnergy(ax, relative = False, divided = 1.0, popFirstStep = True, label = ''):
  """
  Draw the KS Energy and Total Energy in the ax
  """
  X, temp, E_KS, Etot, volume, pressure  =  tdp.getEnergyTemperaturePressure()
  
  refEnergy=E_KS[0]
  if relative:
    E_KS = E_KS - refEnergy
    Etot = Etot - refEnergy
  
  if popFirstStep:
    ax.plot(X[1:],E_KS[1:]/divided,'-',linewidth=3.0,label = 'KS'+ label)#,color=ma.colors[0]
    ax.plot(X[1:],Etot[1:]/divided,'--',linewidth=3.0,label = 'Total'+ label)#,color=ma.colors[2]
  else:
    ax.plot(X,E_KS/divided,'-',linewidth=3.0,label = 'KS' + label)#,color=ma.colors[0]
    ax.plot(X,Etot/divided,'--',linewidth=3.0,label = 'Total' + label)#,color=ma.colors[2]
  
  kargs = ma.getPropertyFromPosition(index=None, 
                                         xlabel=r'Time(fs)',ylabel=r'Energy(eV)',title='', 
                                         xticks=None, yticks=None, 
                                         xticklabels=None, yticklabels=None,
                                         xlimits=None, ylimits=None)
                                 
  ma.setProperty(ax, **kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:25,代码来源:PlotUtility.py

示例2: case

def case(indexCase, folderCase):
  data = scanFolder(getTime)
  selectedProcesses = ['evolve','DHSCF','PostSCF','siesta'] #,'TDbuildD'
  explainations = ['Propagation', 'Build H', 'Postprocess','Total'] #,'Build DM'
  image = data[-1][-1]['Prg.tot']
  pieData = image[selectedProcesses[:-1]]
  other = image[selectedProcesses[-1]] - np.sum(pieData.values)
  
  ax = axsall[1][indexCase]
  explode = np.zeros(len(pieData)) + 0.04
  explode[0]  = 0.07
  patches, texts, autotexts = ax.pie(pieData.values, explode=explode, labels=explainations[:-1], 
                                     labeldistance = 0.2, autopct='%.0f%%',pctdistance = 0.7,
                                     shadow=True, textprops={'fontsize':'xx-large','color':'gold'})
  for text in texts:
    text.set_fontsize(0) 
    
  kargs=ma.getPropertyFromPosition(indexCase + 3, title='')
  ma.setProperty(ax,**kargs) 
  
  for key,label in zip(selectedProcesses,explainations):
    totalTimes = np.array([time['Prg.tot'][key] for index, folder, time in data])/60.0
    situations = np.array([int(folder) for index, folder, time in data])
    ax = axsall[0][indexCase]
    ax.semilogy(situations, totalTimes,'-o', mew = 3, alpha=0.8 ,ms=12, label = label)
#    from scipy.optimize import curve_fit  
#    popt, pcov = curve_fit(errorFunc, situations, totalTimes)    
#    xfit = np.linspace(2,25,1000)
#    ax.semilogy(xfit, errorFunc(xfit,*popt),'--',lw=3, )
  ax.grid(which='major',axis=u'both')
  kargs=ma.getPropertyFromPosition(indexCase, ylabel=r'Clock Time (Mimute)',title=folderCase,
                                   #xlimits = [0,10]
                                   )
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:34,代码来源:plotTimeAll.py

示例3: plotExcitation

def plotExcitation(ax, label=''):
  time, exe = dp.getExcitedElectrons()  
  ax.plot(time, exe - exe[0],'-', lw=2)
  kargs=ma.getPropertyFromPosition(ylabel=r'n(e)', xlabel='Time (fs)',
                                   title='Excited Electrons')

  print exe[-1] - exe[0]
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:8,代码来源:PlotUtility.py

示例4: plotRMSD

def plotRMSD(ax, label=''):
  dp.getTrajactory()
  import pyramids.process.struct as pps
  time, distance = pps.calculateRMSD()
  ax.plot(time, distance, lw=2, label=label)
  kargs=ma.getPropertyFromPosition(xlabel='Time (fs)', ylabel=r'$\langle u \rangle^\frac{1}{2}$ ($\AA$)', 
                                   title='RMSD')
  ma.setProperty(ax,**kargs)  
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:8,代码来源:PlotUtility.py

示例5: plotEField

def plotEField(ax, label=''):
  time, Efield = dp.getEField()
  directions = ['x', 'y', 'z']
  for direct in range(3):
    if max(Efield[:,direct]) > 1E-10:
      ax.plot(time,Efield[:,direct],
              label=directions[direct], lw=2, alpha=1.0) 
  kargs=ma.getPropertyFromPosition(ylabel=r'$\varepsilon$ (a.u.)',xlabel='Time(fs)',
                                   title='Electric Field')
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:10,代码来源:PlotUtility.py

示例6: plotKpoints

def plotKpoints(kpts):
  #Plot the K points
  from pyramids.plot.setting import setProperty, getPropertyFromPosition
  fig, ax = plt.subplots(1,1)
  ax.plot(kpts[:,0],kpts[:,1],'o')
  setProperty(ax,**getPropertyFromPosition(title='K points',xlabel=r'$k_x(1/\AA)$',ylabel=r'$k_y(1/\AA)$'))
  plt.axis('equal')
  plt.tight_layout()
  plt.savefig('Kpoints.pdf',dpi=600)
  plt.show()
  #plt.close()
  
#unit = reciprocal_vectors/grid
#KIndex = np.dot(kpts,np.linalg.inv(unit)) + [nkx/2, nky/2, nkz/2]
#kIndex = np.array(KIndex, dtype=int)
#skpts = np.array([kpts + np.dot([i,j,k],reciprocal_vectors)
#         for i in [0,-1,1] for j in [0,-1,1] for k in [0,-1,1]])
#skIndex = np.array(np.dot(skpts,np.linalg.inv(unit)) + [0.5,0.5,0], dtype=int)            
#print kIndex.shape, #skIndex.shape
#print kIndex

#Ef = 6.0
#T = 300
#qOrder = 2     
#susp = np.zeros([qOrder,qOrder,qOrder],dtype=float) 
#
#
#for ik, ikpt in enumerate(kpts):
#  kxy = kIndex[ik] 
#  for i in range(-qOrder,qOrder):
#    for j in range(-qOrder,qOrder):
#      for k in range(-qOrder,qOrder):
#        qxy = (kxy + np.array([i,j,k])) % np.array([nkx,nky,nkz])
#        iq = qxy[0]*nky*nkz + qxy[1]*nkz + qxy[2]
#        #susp[i,j,k] = susFunc(eigValueAllK,ik,iq,Ef,T)
#        pass
#print susp

#if __name__ == "__main__":
#  nkx = 12
#  nky = 12
#  nkz = 1
#  # Read the structure information from POSCAR
#  from ase.io import read
#  atoms = read('POSCAR')  
#  # Generate K points, 
#  # Selection: Monkhorst-Pack or Line-Mode
#  grid = np.array([nkx,nky,nkz],dtype=int)
#  kpts = getMPKpts(atoms,grid)
#  #kpts = getBandKpoints(atoms,npoints=50)
#  x, v, u = calculateEigenPairs(kpts)
#  plotBands(x, v)
#  plotKpoints(kpts)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:53,代码来源:wannier.py

示例7: drawPartition

def drawPartition(ax, label = ''):
  """
  Draw the KS Energy and Total Energy in the ax
  """
  X,qo  =  tdp.getPartition()
  ax.plot(X,qo,'-',linewidth=3.0,label = 'Partitions '+ label)#,color=ma.colors[0]
  kargs = ma.getPropertyFromPosition(index=None, 
                                         xlabel=r'Time(fs)',ylabel=r'Partition',title='', 
                                         xticks=None, yticks=None, 
                                         xticklabels=None, yticklabels=None,
                                         xlimits=None, ylimits=None)               
  ma.setProperty(ax, **kargs) 
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:12,代码来源:PlotUtility.py

示例8: plotBands

def plotBands(xall,eigValueAllK):
  from pyramids.plot.setting import setProperty, getPropertyFromPosition
  fig, ax = plt.subplots(1,1)
  #Plot the eigenvalues 
  for index in range(eigValueAllK.shape[0]):
    ax.plot(xall[index,:],eigValueAllK[index,:],'ob',lw=1)
  setProperty(ax,**getPropertyFromPosition(title='Energy Bands',xlabel=r'',ylabel=r'Energy(eV)',xticklabels=[]))
  #Set tight layout and output 
  plt.axis('tight')
  plt.tight_layout()
  plt.savefig('Bands.pdf',dpi=600)
  plt.show()
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:12,代码来源:wannier.py

示例9: drawPressure

def drawPressure(ax, label = ''):
  """
  Draw the KS Energy and Total Energy in the ax
  """
  X, temp, E_KS, Etot, volume, pressure  =  tdp.getEnergyTemperaturePressure()
  ax.plot(X,pressure,'-',linewidth=3.0,label = 'Pressure '+ label)#,color=ma.colors[0]

  kargs = ma.getPropertyFromPosition(index=None, 
                                         xlabel=r'Time(fs)',ylabel=r'Pressure(KBar)',title='', 
                                         xticks=None, yticks=None, 
                                         xticklabels=None, yticklabels=None,
                                         xlimits=None, ylimits=None)               
  ma.setProperty(ax, **kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:13,代码来源:PlotUtility.py

示例10: plotDOS

def plotDOS(ax, step, ylimits=[0,None], bins=100, **kargs):
  xlabel = 'Energy (eV)'
  ylabel = 'DOS'
  
  eDosInterp, yDosInterp, yParInterp = dp.calculateDOS(step,bins=bins)
  ax.fill_between(eDosInterp, yParInterp, color='b')
  ax.fill_between(eDosInterp,-yParInterp, color='r')
  ax.fill_between(eDosInterp, yDosInterp, lw=3, color='g',alpha=0.2)
  
  kargs = ma.getPropertyFromPosition(xlabel=xlabel, ylabel=ylabel, 
                                     ylimits=ylimits, yticklabels=[], 
                                     **kargs)
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:13,代码来源:PlotUtility.py

示例11: animate

def animate(i): 
  i = i % len(dataAndAtoms)
  z = (dataAndAtoms[i][0]-pho0)[slide,:,:] 
  atoms = dataAndAtoms[i][1]
  print z.min(), z.max()
  axs[0].contourf(x, y, z, 100,vmin = vmin,vmax =vmax, cmap = cm.jet)
  for pos, Z in zip(atoms.positions, atoms.numbers):
    axs[0].scatter(pos[2],pos[1],c=tuple(cpk_colors[Z]),s=400*covalent_radii[Z])
  setProperty(axs[0],**getPropertyFromPosition(0,xlimits=[2,6],ylimits=[2,6],
              xlabel = r'distance($\AA$)',ylabel = r'distance($\AA$)')) 
  scatter.set_data(time[selectedTimeSteps[i]],light[selectedTimeSteps[i],2])
  setProperty(axs[1],**getPropertyFromPosition(1,
              xlabel = r'time(fs)',ylabel = r'E-Field(a.u.)'))
  plt.tight_layout()
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:14,代码来源:chargeWithMatplotLib.py

示例12: drawRDF

def drawRDF(ax,step=None, label = ''):
  """
  Draw the KS Energy and Total Energy in the ax
  """
  if step == None:
    step = tdp.getNumStep()
  
  systemLabel,timestep = tdp.getSystemLabelTimpstep()
  tdp.splitMDCAR()
  hist,bin_edges = tdp.calculateRDF(step-1)
  ax.plot(bin_edges[:-1],hist,linewidth=3.0,label='RDF '+str((step)*timestep)+' fs'+ label) #,color=ma.colors[0]
  kargs = ma.getPropertyFromPosition(index=None, 
                                         xlabel=r'Radius($\AA$)',ylabel=r'RDF(a.u.)',title='', 
                                         xticks=None, yticks=None, 
                                         xticklabels=None, yticklabels=None,
                                         xlimits=None, ylimits=None)           
  ma.setProperty(ax, **kargs) 
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:17,代码来源:PlotUtility.py

示例13: drawRMSD

def drawRMSD(ax,selected=None, label = '', init = 0):
  """
  Draw the KS Energy and Total Energy in the ax
  """
  systemLabel,timestep = tdp.getSystemLabelTimpstep()
  if selected == None:
    selected = range(0,tdp.getNumStep(),int(1.0/timestep))
    
  tdp.splitMDCAR()
  time,distance,velocity = tdp.calculateRMSD(selected, init=init)
  
  #os.remove('POSCAR')
  ax.plot(time,distance,linewidth=3.0,label='RMSD'+ label)#,color=ma.colors[0])
  kargs = ma.getPropertyFromPosition(index=None, 
                                         xlabel=r'Time(fs)',ylabel=r'RMSD($\AA$)',title='', 
                                         xticks=None, yticks=None, 
                                         xticklabels=None, yticklabels=None,
                                         xlimits=None, ylimits=None)           
  ma.setProperty(ax, **kargs) 
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:19,代码来源:PlotUtility.py

示例14: plotDistribution

def plotDistribution(ax, step, bins=100, intepNum=2000, ylimits=[0,1], **kargs):
  xlabel = 'Energy (eV)'
  ylabel = 'FD'
  yticklabels=[]
  
  eDos, dos, par = dp.calculateDOS(step, ref=False, interp=False,bins=bins)
  distribution = ((par))/((dos)+1E-10)
  
  def interp(xin,yin,xout):
    from scipy.interpolate import interp1d
    spline = interp1d(xin, yin, kind='cubic')
    return spline(xout) 
  
  x = np.linspace(eDos[0], eDos[-1], intepNum)
  y = interp(eDos, distribution, x)
  
  #print (np.abs(yDosInterp)+0.001).min()
  ax.fill_between(x, y, color='b')
  #print yDosInterp.min()
  kargs = ma.getPropertyFromPosition(xlabel=xlabel, ylabel=ylabel, ylimits=ylimits, **kargs)
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:21,代码来源:PlotUtility.py

示例15: action

def action(index,folder):
  ls = ['-','-','-','-']
  ax = axs[0]
  time, Efield = dP.getEField()
  #directions = ['x', 'y', 'z']
  for direct in range(3):
    if max(Efield[:,direct]) > 1E-10:
      ax.plot(time,Efield[:,direct],
              label=folder,lw=2,alpha=0.5) 
  kargs=ma.getPropertyFromPosition(ylabel=r'$\varepsilon$(a.u.)',xlabel='Time(fs)',
                                   title='Electric Field')
  ma.setProperty(ax,**kargs)
  ax.ticklabel_format(style='sci',axis='y',scilimits=[0,0])
  #------------------------------------------------------------------------------
  ax = axs[1]
  time, T, E_ks, E_tot, Vol, P  = dP.getEnergyTemperaturePressure(ave=True)
#  for i in range(2,E_ks.shape[0]-1):
#    if E_ks[i+1] - (E_ks[i] + E_ks[i-1])*0.5 > 2.0:
#      E_ks[i+1] = (E_ks[i] + E_ks[i-1])*0.5
  ax.plot(time[2:], E_ks[2:] - E_ks[2],'-', lw=1, alpha=1, label=folder)
  kargs=ma.getPropertyFromPosition(ylabel=r'E(eV)',title='Excitation Energy')
  ma.setProperty(ax,**kargs)
开发者ID:charleslian,项目名称:PYRAMIDS,代码行数:22,代码来源:plotEnergiesScan.py


注:本文中的pyramids.plot.setting.setProperty函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。