def graceHistogramaTc(nAmostras): plo = GracePlot() # A grace session opens s1 = Symbol(symbol=symbols.none, fillcolor=3) l1 = Line(type=lines.none) l2 = Line(type=lines.solid) histogramaTc = [] histogramaSu = [] for resultado in nAmostras: t, mag, mag2, logmag2, energia, calor, su, cumo, cumuE, p = resultado histogramaTc.append((p, t[su.argmax()])) histogramaSu.append((p, su.max())) graficos = [] for p in concentracao: dados = [x[1] for x in histogramaTc if x[0] == p] hists, bin_edges = np.histogram(dados, 10) d1 = DataBar(x=bin_edges[:-1], y=hists, symbol=s1, line=l1) graficos.append(d1) mu, std = norm.fit(dados) x = np.linspace(min(bin_edges), max(bin_edges), 100) y = norm.pdf(x, mu, std) d1 = Data(x=x, y=y, symbol=s1, line=l2) graficos.append(d1) g = plo[0] g.plot(graficos) #g.text('test',.51,.51,color=2) g.title('histograma de TC') g.yaxis(label=Label('Tc', font=2, charsize=1.5)) g.xaxis(label=Label('p', font=5, charsize=1.5)) plo.save(dir + '/resultado/histograma.agr')
def graceDiagrama(diagrama): p = GracePlot() # A grace session opens s1 = Symbol(symbol=symbols.circle, fillcolor=colors.red) l1 = Line(type=lines.none) a, b = ([x[0] for x in diagrama], [x[1] for x in diagrama]) d1 = Data(x=a, y=b, symbol=s1, line=l1) g = p[0] g.plot(d1) #g.text('test',.51,.51,color=2) g.title('Diagrama') g.yaxis(label=Label('Tc', font=2, charsize=1.5)) g.xaxis(label=Label('p', font=5, charsize=1.5)) p.save(dir + '/resultado/diagrama.agr')
def plotarDiagramaGausianas(diagramas): print 'iniciando plot gaussianas' pp = GracePlot() # A grace session opens s1 = Symbol(symbol=symbols.circle, fillcolor=colors.red) l1 = Line(type=lines.none) TcP = [] diagramaM = [] for p in concentracao: TcP = [x[1] for x in diagramas if x[0] == p] TcMedio, std = norm.fit(TcP) diagramaM.append((p, TcMedio)) a, b = ([x[0] for x in diagrama], [x[1] for x in diagrama]) d1 = Data(x=a, y=b, symbol=s1, line=l1) g = pp[0] g.plot(d1) g.title('Diagrama') g.yaxis(label=Label('Tc', font=2, charsize=1.5)) g.xaxis(label=Label('p', font=5, charsize=1.5)) pp.save(dir + '/resultado/diagramaMedio.agr')
def plotarMaximos(amostras): print 'iniciando plot amostras ' pSus = GracePlot() pCalor = GracePlot() s1 = Symbol(symbol=symbols.circle) l1 = Line(type=lines.none) histogramaTcSus = [] histogramaSus = [] histogramaTcCalor = [] histogramaCalor = [] for resultado in amostras: t, mag, mag2, logmag2, energia, calor, su, cumo, cumuE, p = resultado histogramaTcSus.append((p, t[su.argmax()])) histogramaSus.append((p, su.max())) histogramaTcCalor.append((p, t[calor.argmax()])) histogramaCalor.append((p, calor.max())) graficosSus = [] graficosCalor = [] for p in concentracao: dadosTcSus = [x[1] for x in histogramaTcSus if x[0] == p] dadosSus = [x[1] for x in histogramaSus if x[0] == p] dadosTcCalor = [x[1] for x in histogramaTcCalor if x[0] == p] dadosCalor = [x[1] for x in histogramaCalor if x[0] == p] dSus = Data(x=dadosTcSus, y=dadosSus, symbol=s1, line=l1) graficosSus.append(dSus) dCalor = Data(x=dadosTcCalor, y=dadosCalor, symbol=s1, line=l1) graficosCalor.append(dCalor) gSus = pSus[0] gSus.plot(graficosSus) gSus.title('distribuicao susceptibilidade maxima') gSus.yaxis(label=Label('susceptibilidade', font=2, charsize=1.5)) gSus.xaxis(label=Label('Tc', font=5, charsize=1.5)) pSus.save(dir + '/resultado/distribuicaoSus.agr') gCalor = pCalor[0] gCalor.plot(graficosCalor) gCalor.title('Distribuicao calor máximo') gCalor.yaxis(label=Label('calor', font=2, charsize=1.5)) gCalor.xaxis(label=Label('tc', font=5, charsize=1.5)) pCalor.save(dir + '/resultado/distribuicaoCalor.agr') print 'finalizando plot dos máximos '
from GracePlot import * import math p = GracePlot() # A grace session opens l1 = Line(type=lines.none) x1 = map(lambda x: x / 10., range(0, 100)) y1 = map(math.sin, x1) y2 = map(math.cos, x1) d2 = Data(x=x1, y=y1, symbol=Symbol(symbol=symbols.circle, fillcolor=colors.red), line=l1) d3 = Data(x=x1, y=y2, symbol=Symbol(symbol=symbols.circle, fillcolor=colors.blue), line=l1) g = p[0] g.plot([d2, d3]) g.xaxis(label=Label('X axis', font=5, charsize=1.5), tick=Tick(majorgrid=True, majorlinestyle=lines.dashed, majorcolor=colors.blue, minorgrid=True, minorlinestyle=lines.dotted, minorcolor=colors.blue))
for col in args.colors: colo[ll] = col ll += 1 if (args.mp or args.eps != 'noeps'): import matplotlib.font_manager as fnt import matplotlib.pyplot as plt xlab = args.xlabel fig = plt.figure(1) graf = fig.add_axes([0.13, 0.1, 0.8, 0.8]) if args.xg: scriptpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(scriptpath + '/graceplot') import GracePlot as xg pgr = xg.GracePlot() pg = pgr[0] pg.title(args.title) s1 = xg.Symbol(symbol=0, fillcolor=0) l1 = xg.Line(type=1, linewidth=1) xlabel = xg.Label(args.xlabel) ylabel = xg.Label(args.ylabel) pg.xaxis(label=xlabel) pg.yaxis(label=ylabel) if (args.scale == 'logx' or args.scale == 'logxy'): pg.xaxis(scale='logarithmic') if (args.scale == 'logy' or args.scale == 'logxy'): pg.yaxis(scale='logarithmic') colcount = 0 legcount = 0
#%[files,labels,ed,dw,fd,rho_ef]=textread('Pt_3d_electonic_structure.csv','%s%s%n%n%n%n','headerlines',1); from GracePlot import * from math import * from Numeric import * rhod_ef=[1.65, 2.04, 2.80, 3.58, 4.23, 4.78, 4.78, 5.19] rhod_ef.reverse() rho_ef=array([31.65, 33.14, 36.60, 33.86, 25.20, 20.37, 16.55, 16.74])*0.17 sf=6.75/8; ed=[-2.44, -2.60, -2.74, -2.84, -3.00, -3.12, -3.18, -3.16]; dw=[9.11, 9.70, 10.47, 11.10, 12.14, 12.84, 13.21, 13.03]; p=GracePlot(3.0,4) p.SetView(0.15,0.15,0.9,1.25) #set(gcf,'Units','inches','Position',[1 1 6.75 4],'PaperPositionMode','auto','PaperSize',[6.75 4]) d1=Data(ed,rho_ef, symbol=Symbol(symbol=square,fillcolor=black,size=1.4), line=Line(linestyle=0), legend='Density of states \\cW\C 0.17') d2=Data(ed,rhod_ef,symbol=Symbol(symbol=circle,fillcolor=gray,size=1.4), line=Line(linestyle=0), legend='Density of d-states') p.plot(d1,d2) p.xaxis(-3.2,-2.4) p.yaxis(1,7.5) p.xlabel('d-band center (eV)') p.ylabel('\\f{12}r\\f{2}\sE\sf\N (arbitrary units)')
from GracePlot import * import math import random p = GracePlot(width=8, height=6) # A grace session opens x=[1,2,3,4,5,6,7,8,9,10] y=[1,2,3,4,5,6,7,8,9,10] labels=['pt1','pt2','Iridium','Na','Ti','hydrogen','Mo '+format_scientific("1.23e3") ,'Ta','pokemon','digital'] dy=map(lambda x:random.random()*2.,x) s1=Symbol(symbol=symbols.square,fillcolor=colors.cyan) l1=Line(type=lines.none) d1=DataXYDY(x=x,y=y,dy=dy,symbol=s1,line=l1) g=p[0] g.xaxis(xmin=0, xmax=12) g.yaxis(ymin=0, ymax=12) g.plot(d1, autoscale=False) for i in range(len(labels)): g.text(' '+labels[i],x[i],y[i],color=colors.violet,charsize=1.2) g.line(x1=3, y1=1, x2=8, y2=2, linewidth=3, color=colors.green4)
def plotarMediaQuantidades(Amostras): s1 = Symbol(symbol=symbols.none, fillcolor=colors.red) l1 = Line(type=lines.solid) pMag = GracePlot() pMag2 = GracePlot() pLogmag2 = GracePlot() pEnergia = GracePlot() pCalor = GracePlot() pSus = GracePlot() pCumu = GracePlot() pCumuE = GracePlot() vMag = [] vMag2 = [] vLogmag2 = [] vEnergia = [] vCalor = [] vSus = [] vCumu = [] vCumuE = [] for p in concentracao: t = dadosMag = [x[0] for x in amostras if x[9] == p] mag = dadosMag = [x[1] for x in amostras if x[9] == p] mag2 = dadosMag = [x[2] for x in amostras if x[9] == p] logmag2 = dadosMag = [x[3] for x in amostras if x[9] == p] energia = dadosMag = [x[4] for x in amostras if x[9] == p] calor = dadosMag = [x[5] for x in amostras if x[9] == p] sus = dadosMag = [x[6] for x in amostras if x[9] == p] cumu = dadosMag = [x[7] for x in amostras if x[9] == p] cumuE = dadosMag = [x[8] for x in amostras if x[9] == p] t = sum(t) / len(t) mag = sum(mag) / len(mag) mag2 = sum(mag2) / len(mag2) logmag2 = sum(logmag2) / len(logmag2) energia = sum(energia) / len(energia) calor = sum(calor) / len(calor) sus = sum(sus) / len(sus) cumu = sum(cumu) / len(cumu) cumuE = sum(cumuE) / len(cumuE) dMag = Data(x=t, y=mag, symbol=s1, line=l1) dMag2 = Data(x=t, y=mag2, symbol=s1, line=l1) dLogmag2 = Data(x=t, y=logmag2, symbol=s1, line=l1) dEnergia = Data(x=t, y=energia, symbol=s1, line=l1) dCalor = Data(x=t, y=calor, symbol=s1, line=l1) dSus = Data(x=t, y=sus, symbol=s1, line=l1) dCumu = Data(x=t, y=cumu, symbol=s1, line=l1) dCumuE = Data(x=t, y=cumuE, symbol=s1, line=l1) vMag.append(dMag) vMag2.append(dMag2) vLogmag2.append(dLogmag2) vEnergia.append(dEnergia) vCalor.append(dCalor) vSus.append(dSus) vCumu.append(dCumu) vCumuE.append(dCumuE) gMag = pMag[0] gMag.plot(vMag) gMag.title('Magnetizacao x Temperatura') gMag.yaxis(label=Label('magnetizacao', font=5, charsize=1.5)) gMag.xaxis(label=Label('T', font=5, charsize=1.5)) pMag.save(dir + '/resultado/mag.agr') gMag2 = pMag2[0] gMag2.plot(vMag2) gMag2.title('magnetizacao2 x Temperatura') gMag2.yaxis(label=Label('mag2', font=5, charsize=1.5)) gMag2.xaxis(label=Label('T', font=5, charsize=1.5)) pMag2.save(dir + '/resultado/mag2.agr') gLogmag2 = pLogmag2[0] gLogmag2.plot(vLogmag2) gLogmag2.title('logmag2 x Temperatura') gLogmag2.yaxis(label=Label('logmag2', font=5, charsize=1.5)) gLogmag2.xaxis(label=Label('T', font=5, charsize=1.5)) pLogmag2.save(dir + '/resultado/logmag2.agr') gEnergia = pEnergia[0] gEnergia.plot(vEnergia) gEnergia.title('energia x Temperatura') gEnergia.yaxis(label=Label('energia', font=5, charsize=1.5)) gEnergia.xaxis(label=Label('T', font=5, charsize=1.5)) pEnergia.save(dir + '/resultado/energia.agr') gCalor = pCalor[0] gCalor.plot(vCalor) gCalor.title('Calor especifico x Temperatura') gCalor.yaxis(label=Label('Calor', font=2, charsize=1.5)) gCalor.xaxis(label=Label('T', font=5, charsize=1.5)) pCalor.save(dir + '/resultado/calor.agr') gSus = pSus[0] gSus.plot(vSus) gSus.title('Susceptibilidade x Temperatura') gSus.yaxis(label=Label('Susceptibilidade', font=5, charsize=1.5)) gSus.xaxis(label=Label('T', font=5, charsize=1.5)) pSus.save(dir + '/resultado/sus.agr') gCumu = pCumu[0] gCumu.plot(vCumu) gCumu.title('cumulante da magnetizacao x Temperatura') gCumu.yaxis(label=Label('cumulante', font=5, charsize=1.5)) gCumu.xaxis(label=Label('T', font=5, charsize=1.5)) pCumu.save(dir + '/resultado/cumu.agr') gCumuE = pCumuE[0] gCumuE.plot(vCumuE) gCumuE.title('cumulante da energia x Temperatura') gCumuE.yaxis(label=Label('cumulante', font=5, charsize=1.5)) gCumuE.xaxis(label=Label('T', font=5, charsize=1.5)) pCumuE.save(dir + '/resultado/cumue.agr') print "plot da quantidades finalizado "
def plotarGausianas(amostras): print 'iniciando plot gaussianas ' pTcSus = GracePlot() pSus = GracePlot() pTcCalor = GracePlot() pCalor = GracePlot() s1 = Symbol(symbol=symbols.none, fillcolor=3) l1 = Line(type=lines.solid) histogramaTcSus = [] histogramaSus = [] histogramaTcCalor = [] histogramaCalor = [] for resultado in amostras: t, mag, mag2, logmag2, energia, calor, su, cumo, cumuE, p = resultado histogramaTcSus.append((p, t[su.argmax()])) histogramaSus.append((p, su.max())) histogramaTcCalor.append((p, t[calor.argmax()])) histogramaCalor.append((p, calor.max())) graficosTcSus = [] graficosSus = [] graficosTcCalor = [] graficosCalor = [] for p in concentracao: dadosTcSus = [x[1] for x in histogramaTcSus if x[0] == p] dadosSus = [x[1] for x in histogramaSus if x[0] == p] dadosTcCalor = [x[1] for x in histogramaTcCalor if x[0] == p] dadosCalor = [x[1] for x in histogramaCalor if x[0] == p] mu, std = norm.fit(dadosTcSus) a = mu - 2 * std b = mu + 2 * std x = np.linspace(a, b, 100) y = norm.pdf(x, mu, std) dTcSus = Data(x=x, y=y, symbol=s1, line=l1) graficosTcSus.append(dTcSus) mu, std = norm.fit(dadosSus) a = mu - 2 * std b = mu + 2 * std x = np.linspace(a, b, 100) y = norm.pdf(x, mu, std) dSus = Data(x=x, y=y, symbol=s1, line=l1) graficosSus.append(dSus) mu, std = norm.fit(dadosTcCalor) a = mu - 2 * std b = mu + 2 * std x = np.linspace(a, b, 100) y = norm.pdf(x, mu, std) dTcCalor = Data(x=x, y=y, symbol=s1, line=l1) graficosTcCalor.append(dTcCalor) mu, std = norm.fit(dadosCalor) a = mu - 2 * std b = mu + 2 * std x = np.linspace(a, b, 100) y = norm.pdf(x, mu, std) dCalor = Data(x=x, y=y, symbol=s1, line=l1) graficosCalor.append(dCalor) gTcSus = pTcSus[0] gTcSus.plot(graficosTcSus) gTcSus.title('gausiana Tc sus') gTcSus.yaxis(label=Label('P(Tc)', font=2, charsize=1.5)) gTcSus.xaxis(label=Label('Tc', font=5, charsize=1.5)) pTcSus.save(dir + '/resultado/gassianaTcSus.agr') gSus = pSus[0] gSus.plot(graficosSus) gSus.title('Gaussiana sus') gSus.yaxis(label=Label('P(susceptibilidade)', font=2, charsize=1.5)) gSus.xaxis(label=Label('susceptibilidade', font=5, charsize=1.5)) pSus.save(dir + '/resultado/gassianaSus.agr') gTcCalor = pTcCalor[0] gTcCalor.plot(graficosTcCalor) gTcCalor.title('gausiana TC calor') gTcCalor.yaxis(label=Label('P(Tc)', font=2, charsize=1.5)) gTcCalor.xaxis(label=Label('Tc', font=5, charsize=1.5)) pTcCalor.save(dir + '/resultado/gassianaTcCalor.agr') gCalor = pCalor[0] gCalor.plot(graficosCalor) gCalor.title('Gausiana calor') gCalor.yaxis(label=Label('Tc', font=2, charsize=1.5)) gCalor.xaxis(label=Label('p', font=5, charsize=1.5)) pCalor.save(dir + '/resultado/gassianaCalor.agr') print 'finalizando plot gaussianas '
#%[files,labels,ed,dw,fd,rho_ef]=textread('Pt_3d_electonic_structure.csv','%s%s%n%n%n%n','headerlines',1); from GracePlot import * from math import * rhod_ef=[1.65, 2.04, 2.80, 3.58, 4.23, 4.78, 4.78, 5.19].reverse() rho_ef=[31.65, 33.14, 36.60, 33.86, 25.20, 20.37, 16.55, 16.74]; sf=6.75/8; ed=[-2.44, -2.60, -2.74, -2.84, -3.00, -3.12, -3.18, -3.16]; dw=[9.11, 9.70, 10.47, 11.10, 12.14, 12.84, 13.21, 13.03]; p=GracePlot(3,4) p.SetView(0.15,0.15,0.9,1.25) #set(gcf,'Units','inches','Position',[1 1 6.75 4],'PaperPositionMode','auto','PaperSize',[6.75 4]) d1=Data(ed,map(lambda x:sqrt(x), dw), symbol=Symbol(symbol=circle,fillcolor=black,size=1.6), line=Line(linestyle=0), legend='data') fit=Data([-3.2,-2.6],[-1.*-3.2+0.5,-1.*-2.6+0.5], line=Line(linestyle=1,color=black,linewidth=4), legend='y=0.5-x') def line(x): return -1.2*(x+2.44)+sqrt(9.27) model_fit=Data([-3.2,-2.6],[line(-3.2),line(-2.6)], line=Line(linestyle=1,color=black,linewidth=4), legend='y=0.5-x') vline=Data([-2.9, -2.9],[0.5+2.9,0.5+2.9+.1],
def plotarQuantidades(Amostras): s1 = Symbol(symbol=symbols.none, fillcolor=colors.red) l1 = Line(type=lines.solid) pMag = GracePlot() pMag2 = GracePlot() pLogmag2 = GracePlot() pEnergia = GracePlot() pCalor = GracePlot() pSus = GracePlot() pCumu = GracePlot() pCumuE = GracePlot() vMag = [] vMag2 = [] vLogmag2 = [] vEnergia = [] vCalor = [] vSus = [] vCumu = [] vCumuE = [] mag = [] magMedia = np.array(mag, float) magMedia += np.array() for resultado in Amostras: t, mag, mag2, logmag2, energia, calor, sus, cumu, cumuE, pp = resultado dMag = Data(x=t, y=mag, symbol=s1, line=l1) dMag2 = Data(x=t, y=mag2, symbol=s1, line=l1) dLogmag2 = Data(x=t, y=logmag2, symbol=s1, line=l1) dEnergia = Data(x=t, y=energia, symbol=s1, line=l1) dCalor = Data(x=t, y=calor, symbol=s1, line=l1) dSus = Data(x=t, y=sus, symbol=s1, line=l1) dCumu = Data(x=t, y=cumu, symbol=s1, line=l1) dCumuE = Data(x=t, y=cumuE, symbol=s1, line=l1) vMag.append(dMag) vMag2.append(dMag2) vLogmag2.append(dLogmag2) vEnergia.append(dEnergia) vCalor.append(dCalor) vSus.append(dSus) vCumu.append(dCumu) vCumuE.append(dCumuE) gMag = pMag[0] gMag.plot(vMag) gMag.title('Magnetizacao x Temperatura') gMag.yaxis(label=Label('magnetizacao', font=5, charsize=1.5)) gMag.xaxis(label=Label('T', font=5, charsize=1.5)) pMag.save(dir + '/resultado/mag.agr') gMag2 = pMag2[0] gMag2.plot(vMag2) gMag2.title('magnetizacao2 x Temperatura') gMag2.yaxis(label=Label('mag2', font=5, charsize=1.5)) gMag2.xaxis(label=Label('T', font=5, charsize=1.5)) pMag2.save(dir + '/resultado/mag2.agr') gLogmag2 = pLogmag2[0] gLogmag2.plot(vLogmag2) gLogmag2.title('logmag2 x Temperatura') gLogmag2.yaxis(label=Label('logmag2', font=5, charsize=1.5)) gLogmag2.xaxis(label=Label('T', font=5, charsize=1.5)) pLogmag2.save(dir + '/resultado/logmag2.agr') gEnergia = pEnergia[0] gEnergia.plot(vEnergia) gEnergia.title('energia x Temperatura') gEnergia.yaxis(label=Label('energia', font=5, charsize=1.5)) gEnergia.xaxis(label=Label('T', font=5, charsize=1.5)) pEnergia.save(dir + '/resultado/energia.agr') gCalor = pCalor[0] gCalor.plot(vCalor) gCalor.title('Calor especifico x Temperatura') gCalor.yaxis(label=Label('Calor', font=2, charsize=1.5)) gCalor.xaxis(label=Label('T', font=5, charsize=1.5)) pCalor.save(dir + '/resultado/calor.agr') gSus = pSus[0] gSus.plot(vSus) gSus.title('Susceptibilidade x Temperatura') gSus.yaxis(label=Label('Susceptibilidade', font=5, charsize=1.5)) gSus.xaxis(label=Label('T', font=5, charsize=1.5)) pSus.save(dir + '/resultado/sus.agr') gCumu = pCumu[0] gCumu.plot(vCumu) gCumu.title('cumulante da magnetizacao x Temperatura') gCumu.yaxis(label=Label('cumulante', font=5, charsize=1.5)) gCumu.xaxis(label=Label('T', font=5, charsize=1.5)) pCumu.save(dir + '/resultado/cumu.agr') gCumuE = pCumuE[0] gCumuE.plot(vCumuE) gCumuE.title('cumulante da energia x Temperatura') gCumuE.yaxis(label=Label('cumulante', font=5, charsize=1.5)) gCumuE.xaxis(label=Label('T', font=5, charsize=1.5)) pCumuE.save(dir + '/resultado/cumue.agr') print "plot da quantidades finalizado "
if args.colors: for index, col in enumerate(args.colors): colo[index] = col if (args.mp or args.eps != 'noeps'): import matplotlib.font_manager as fnt import matplotlib.pyplot as plt fig = plt.figure(1) graf = fig.add_axes([0.13, 0.1, 0.8, 0.8]) if args.xg: scriptpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(scriptpath + '/graceplot') import GracePlot as xg pgr = xg.GracePlot() pg = pgr[0] pg.title(args.title) s1 = xg.Symbol(symbol=0, fillcolor=0) l1 = xg.Line(type=1, linewidth=1) xlabel = xg.Label(args.xlabel) ylabel = xg.Label(args.ylabel) pg.xaxis(label=xlabel) pg.yaxis(label=ylabel) if (args.scale == 'logx' or args.scale == 'logxy'): pg.xaxis(scale='logarithmic') if (args.scale == 'logy' or args.scale == 'logxy'): pg.yaxis(scale='logarithmic') fpat = re.compile(r'(?P<nom>[^/\.]+)\.') for tiq, doc in enumerate(args.files):
#%[files,labels,ed,dw,fd,rho_ef]=textread('Pt_3d_electonic_structure.csv','%s%s%n%n%n%n','headerlines',1); from GracePlot import * from math import * rhod_ef=[1.65, 2.04, 2.80, 3.58, 4.23, 4.78, 4.78, 5.19].reverse() rho_ef=[31.65, 33.14, 36.60, 33.86, 25.20, 20.37, 16.55, 16.74]; sf=6.75/8; ed=[-2.44, -2.60, -2.74, -2.84, -3.00, -3.12, -3.18, -3.16]; dw=[9.11, 9.70, 10.47, 11.10, 12.14, 12.84, 13.21, 13.03]; p=GracePlot() #p.SetView(0.15,0.15,0.9,1.1) #set(gcf,'Units','inches','Position',[1 1 6.75 4],'PaperPositionMode','auto','PaperSize',[6.75 4]) d1=Data(ed,map(lambda x:sqrt(x), dw), symbol=Symbol(symbol=circle,fillcolor=orange,size=1.4), line=Line(linestyle=0), legend='data') fit=Data([-3.2,-2.6],[-1.*-3.2+0.5,-1.*-2.6+0.5], line=Line(linestyle=1,color=black,linewidth=4), legend='y=0.5-x') p.plot(d1,fit) p.xaxis(-3.3,-2.5) p.yaxis(3,3.7) p.xlabel('d-band center (eV)') #p.ylabel("""\\x\\c\\z{1.4}V\\m{1}\\z{0.9}\\v{0.75}>>>>>\\N\\C\\f{}\M{1}d-band width""") p.ylabel("""rms d-band width""") # #p.text(x=-2.6,y=3.65,string='(a.)',charsize=1.4,font=2)
labels=['Pt','Ni','Co','Fe','Mn','Cr','V','Ti'] #interlayer spacing d=array([2.34,2.04,2.04,2.05,2.01,2.04,2.10,2.14]) #matrix elements V_pt3d=7.62*(rd*pt_rd)**1.5/d**5 #Real band data W2=array([9.11,9.7,10.47,11.1,12.14,12.84,13.21,13.03]) W=sqrt(W2) p=GracePlot(3.,4) p.SetView(0.15,0.15,0.95,1.25) d=Data(tb_Wd,W,symbol=Symbol(symbol=circle,fillcolor=red), line=Line(type=0)) # from best fit of the data #width=0.92*V_pt3d/min(V_pt3d)+0.92 V_data=Data(V_pt3d,W,symbol=Symbol(symbol=circle,fillcolor=black), line=Line(type=0)) p.plot(V_data) for i in range(len(labels)): p.text(labels[i],x=V_pt3d[i]+0.002,y=W[i],font=2,charsize=1.4)
string loctype %(coordinates)s string %(x)g, %(y)g string color %(color)d string rot %(angle)f string font %(font)d string just %(just)d string char size %(size)f string def "%(text)s" """ % locals() self.write(strg) c = GracePlot.colors stylecolors = [c.green, c.blue, c.red, c.orange, c.magenta, c.black] s1, s2, s3, s4, s5, s6 = [ GracePlot.Symbol(symbol=GracePlot.symbols.circle, fillcolor=sc, size=0.3, linestyle=GracePlot.lines.none) for sc in stylecolors ] l1, l2, l3, l4, l5, l6 = [ GracePlot.Line(type=GracePlot.lines.solid, color=sc, linewidth=2.0) for sc in stylecolors ] noline = GracePlot.Line(type=GracePlot.lines.none) graceSession = myGrace(width=11, height=8) g = graceSession[0] g.xlimit(-1, 16) g.ylimit(-1, 22)
from GracePlot import * labels=['Pt', 'Ni','Co','Fe','Mn','Cr','V','Ti'] ed=[-2.44, -2.60, -2.74, -2.84, -3.0, -3.12, -3.18, -3.16]; dissH_H=[-0.63, -0.27, -0.06, 0.05, 0.30, 0.49, 0.64, 0.75]; dissH_O=[-1.27, -0.61, -0.40,-0.29, -0.17, 0.18, 0.28, 0.78]; dissH_O_450=[-1.47, -0.82, -0.59, -0.54, -0.40, -0.07, 0.20, 0.63]; p=GracePlot(6,4) #p.SetView(.15,.15,.9,1.1) hdata=Data(ed,dissH_H,symbol=Symbol(symbol=circle,fillcolor=red,size=1.4), line=Line(linestyle=0), legend='H\s2') odata=Data(ed,dissH_O_450,symbol=Symbol(symbol=square,fillcolor=orange,size=1.4), line=Line(linestyle=0), legend='O\s2') zero=Data([-3.2,-2.4],[0,0], symbol=Symbol(symbol=0), line=Line(color=black)) p.plot(hdata,odata,zero) p.xaxis(-3.2,-2.4) p.yaxis(-2,1) p.legend(x=-2.6,y=0.7,font=2,charsize=1.3)
sweeptime = sweeptime - 2 # synch issue ssweeptime = "%s" % sweeptime ## prevents extra points lockin.write("slen " + ssweeptime + "\n") lockin.write("send 0 \n") # perform a single shot #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# ##################################################################### ##################################################################### # Acquisition ##################################################################### # Open a Grace session (leave open) p = GracePlot() # Labels, axes properties, line/symbol properties for Grace plot p.title("All your resonance are belong to us") p.xaxis( label=Label("Frequency (Hz)", font=5, charsize=1.5), tick=Tick( majorgrid=on, majorlinestyle=dashed, majorcolor=blue, minorgrid=off, minorlinestyle=dotted, minorcolor=blue ), ) p.yaxis( label=Label("Power", font=5, charsize=1.5), tick=Tick( majorgrid=on, majorlinestyle=dashed, majorcolor=blue, minorgrid=off, minorlinestyle=dotted, minorcolor=blue ), )