for cat in expclassesobj.data: label = '%s-%s, %s'%(cat.cat,cat.cattype,cat.author) label = '%s'%(cat.category) #if cat.rxntype=='aqueous': # label = None if label in labels: label = None else: labels.append(label) #assign cat object a dEa cat.get_dEa(dEa_guess,cat.T,solv_corr=solv_corr) #plot experimental data with extrapolated selectivity modelsel = sel_fun(cat.conv,T_fix,dEa=cat.dEa,dGa=None,error=None) ax.plot(cat.log_conv, modelsel, color=get_color(cat.category), marker=get_shape(cat.rxntype), label=label, fillstyle='full', markersize=10, clip_on=False) ax.set_title('T=%i K; all data (extrapolated)'%(int(T_fix))) ax.legend(loc=3,fontsize=15) ax.set_xlabel(r'log(CH$_4$ conversion)') ax.set_ylabel(r'CH$_3$OH selectivity (%)') plt.savefig('fig-5-main-SvX-extrapolated.pdf')
#cattype = cat.cattype if 'HSE' in cat.tag: #marker = 's' labeler += '-HSE' if labeler in classes_idx: label = '_nolegend_' else: label = labeler classes_idx.add(labeler) if 'surface-stabilized' in cat.tag: if surf_stab == False: continue clr = 'c' else: clr = get_color(labeler) ch3oh_list.append(cat.ets_ch3oh) ch4_list.append(cat.ets_ch4) #for hist dEa = cat.ets_ch4 - cat.ets_ch3oh if labeler in dEa_dict.keys(): dEa_dict[labeler]['dEas'].append(dEa) else: dEa_dict[labeler] = {} dEa_dict[labeler]['dEas'] = [dEa] dEa_dict[labeler]['clr'] = get_color(labeler) dEa_all.append(dEa) alpha = 1 ##??? h, = ax.plot(cat.ets_ch3oh,
ax.plot(np.log10(conv_vec), sel_vec, color=clr) ######## Plot EXPERIMENTAL DATA ###### labels = [] for pt in catlistobj.data: #label = '%s-%s, %s'%(pt.cat,pt.cattype,pt.author) label = pt.cat if label in labels: label = None else: labels.append(label) ax.plot(pt.log_conv, pt.sel, 'o', color=get_color(pt.category), marker='o', label=label, markersize=ptsize, clip_on=False) ax.text(pt.log_conv, pt.sel, str(pt.T), fontsize=7, ha='center', va='center', color='k') ###### PLOT PARAMETERS ##### ax.set_xlim(-8, 0) #plt.legend(loc=3,fontsize=10)
#cattype = cat.cattype if 'HSE' in cat.tag: #marker = 's' labeler += '-HSE' if labeler in classes_idx: label = '_nolegend_' else: label = labeler classes_idx.add(labeler) if 'surface-stabilized' in cat.tag: if surf_stab == False: continue clr = 'c' else: clr = get_color(labeler) ch3oh_list.append(cat.ets_ch3oh) ch4_list.append(cat.ets_ch4) alpha = 1 ##??? h, = ax.plot(cat.ets_ch3oh, cat.ets_ch4, marker=marker, color=clr, alpha=alpha, label=label) clr_handles.append(copy.copy(h)) shape_handles.append(copy.copy(h)) #ax.text(cat.ets_ch3oh,cat.ets_ch4,cat.cat,fontsize=3,ha='center',va='center') ### BEEF ## if cat.beef_ch4 != None:
lims=[-0.5,1] if plttype=='$\Delta$S' : dGcorr = cat.get_dS(T) lims=[-0.0002,0.0011] if plttype=='$\Delta$C' : dGcorr = cat.get_dC(T) lims=[-0.05,0.05] dGcorr_list.append(dGcorr) print cat.cat, cat.cattype if cat.cattype in dGcorr_dict.keys(): dGcorr_dict[cat.cattype]['dGcorrs'].append(dGcorr) else: dGcorr_dict[cat.cattype] = {} dGcorr_dict[cat.cattype]['dGcorrs'] = [dGcorr] dGcorr_dict[cat.cattype]['clr'] = get_color(cat.cattype) #print cat.cat,'/',cat.cattype,'/',cat.vibs_ch4,'/',cat.vibs_ch3oh fig = plt.figure(figsize=(5,4)) ax = fig.add_subplot(111) #ax.set_xlim(-.75,0.25) ax.set_xlim(lims) dGcorr_multi = [] labels=[] colors=[] for cattype in dGcorr_dict.keys(): dGcorr_multi.append(np.array(dGcorr_dict[cattype]['dGcorrs'])) labels.append(cattype) colors.append(dGcorr_dict[cattype]['clr'])
dGa = dEa - 4.191e-4*T - 0.0152 k2_k1 = math.exp(dGa/kB/T) sel = (1-conv-(1-conv)**(k2_k1))/(conv*(k2_k1-1))*100 return sel #in percent labels=[] for obj in expclassesobj.data: if obj.rxntype=='aqueous': dEa = dEa_theory-solv_corr else: dEa = dEa_theory label=obj.category if label in labels: label=None else: labels.append(label) sel_pred = sel_fun(obj.conv,dEa,obj.T) print obj.sel,sel_pred #xerr=math.log((-sel_pred+sel_fun(obj.conv,dEa-sigma,obj.T))*0.01,10) xerr=0 ax.errorbar(math.log(sel_pred*.01,10),math.log(obj.sel*.01,10),xerr=xerr,marker='o',label=label,color=get_color(obj.category)) ax.plot(np.arange(-6,1,1),np.arange(-6,1,1)) ax.set_title(r'$\Delta E^a_{theory} = %4.2f$'%(dEa_theory)) ax.set_ylim([-3,0]) ax.set_xlim([-3,0]) ax.set_ylabel('Experimental log(Selectivity)') ax.set_xlabel('Model log(Selectivity)') ax.legend(loc='best',fontsize=9) plt.savefig('parity-dEa-%4.2f.pdf'%(dEa_theory))
for cond in condns: T_low = condns[cond]['T'][0] T_hi = condns[cond]['T'][1] T_av = np.array(condns[cond]['T']).mean() clr = condns[cond]['color'] solv_corr = condns[cond]['solv_corr'] plot_sel(ax,conv_vec,dEa-solv_corr,T_av,T_low=T_low,T_hi=T_hi,facecolor=clr,color=clr) ######## Plot EXPERIMENTAL DATA ###### catlistobj = catlistobj.classfilter(lambda x: x.cattype !='MMO') labels=[] for pt in catlistobj.data: #label = '%s-%s, %s'%(pt.cat,pt.cattype,pt.author) label = pt.category if label in labels: label = None else: labels.append(label) ax.plot(pt.log_conv,pt.sel,'o',color=get_color(pt.category),marker='o',label=label,fillstyle='full',markersize=ptsize,clip_on=False) #ax.text(pt.log_conv,pt.sel,str(pt.T),fontsize=7,ha='center',va='center',color='k') ###### PLOT PARAMETERS ##### ax.set_xlim(-8,0) plt.legend(loc=3,fontsize=10) ax.set_ylim(0,100) ax.set_xlabel(r'log(CH$_4$ conversion)') ax.set_ylabel(r'CH$_3$OH selectivity (%)') plt.tight_layout() plt.savefig('fig-7-aq.pdf')
# Can choose whether to get the distribution using the # true scaling (EaCH3OH = 0.94EaCH4+0.58) or approximate # slope = 1. In pub, we approximate slope=1. if scaled == False: dEa = mat.ets_ch4 - mat.ets_ch3oh elif scaled == True: dEa = (mat.ets_ch3oh * 0.94 + 0.58) - mat.ets_ch3oh mclass = mat.cattype if 'HSE' in mat.tag: mclass = mclass + '-HSE' if mclass in dEa_dict.keys(): dEa_dict[mclass]['dEas'].append(dEa) else: dEa_dict[mclass] = {} dEa_dict[mclass]['dEas'] = [dEa] dEa_dict[mclass]['clr'] = get_color(mclass) #dEa_dict[mclass]['clr'] = mat.color dEa_all.append(dEa) #print mat.cat,mat.cattype, mat.ets_ch4,mat.ets_ch3oh,dEa dEa_multi = [] labels = [] colors = [] hatches = [] for mclass in dEa_dict: dEa_multi.append(np.array(dEa_dict[mclass]['dEas'])) labels.append(mclass) colors.append(dEa_dict[mclass]['clr']) hatches.append('/') pickle.dump(dEa_all, open("dEa_all.pkl", "wb"))
print "Catalyst: %s ; exp dEa = %4.2f for S=%4.2f and X=%4.2f %4.2f"%(pt.cat+'-'+pt.cattype,pt.dEa,pt.sel,pt.log_conv,10**pt.log_conv) exp_dEa_list.append(pt.dEa) dEa_multi = [] labels = [] colors = [] dEa_dict = {} for pt in catlistobj.data: if pt.cat in dEa_dict.keys(): dEa_dict[pt.cat].append(pt.dEa) else: dEa_dict[pt.cat] = [pt.dEa] for cat in dEa_dict: dEa_multi.append(np.array(dEa_dict[cat])) labels.append(cat) colors.append(get_color(cat)) #if cat in expclass.clr_dict.keys(): # colors.append(expclass.clr_dict[cat]) #else: # colors.append('grey') n,bins,patches = plt.hist(exp_dEa_list,nbins,color=expcolor,normed=normed,alpha=0.5)#kwargs #n,bins,patches = plt.hist(dEa_multi,nbins,label=labels,color=colors,stacked=True,normed=normed)#kwargs plt.legend(fontsize=15,loc=2) lines = [] mu,std = norm.fit(exp_dEa_list) xmin, xmax = plt.xlim() x = np.linspace(-.2, 2, 1000) p = norm.pdf(x, mu, std) h, = plt.plot(x, p, expcolor, linewidth=2) lines.append(h)
nbins = 5 nbins = 20 Ea_ch3oh = [] Ea_ch4 = [] for mat in dftobj.data: dEa = mat.ets_ch4 - mat.ets_ch3oh mclass = mat.cattype if mclass in dEa_dict.keys(): dEa_dict[mclass]['dEas'].append(dEa) else: dEa_dict[mclass] = {} dEa_dict[mclass]['dEas'] = [dEa] dEa_dict[mclass]['clr'] = get_color(mat.cattype) for b_ch4, b_ch3oh in zip(mat.beef_ets_ch4, mat.beef_ets_ch3oh): dEa_dict[mclass]['dEas'].append(b_ch4 - b_ch3oh) dEa_all.append(b_ch4 - b_ch3oh) Ea_ch4.append(b_ch4) Ea_ch3oh.append(b_ch3oh) dEa_all.append(dEa) print mat.cat, mat.cattype, mat.ets_ch4, mat.ets_ch3oh, dEa labels = [] colors = [] for mclass in dEa_dict: labels.append(mclass) colors.append(dEa_dict[mclass]['clr']) n, bins, patches = plt.hist(dEa_all, nbins,
T_hi=T_hi, facecolor=clr, color=clr) ######## Plot EXPERIMENTAL DATA ###### labels = [] for pt in catlistobj.data: label = pt.cat if label in labels: label = None else: labels.append(label) ax.plot(pt.log_conv, pt.sel, 'o', color=get_color(pt.cat), marker='o', label=label, fillstyle='full', markersize=ptsize, clip_on=False) ax.text(pt.log_conv, pt.sel, str(pt.T), fontsize=11, ha='center', va='center', color='k') plt.text(-5.6, -10, '(a)', fontsize=30) ###### PLOT PARAMETERS #####