def plot_p(p): xlim = [-50, 50] subp = [3, 1, 1] plt.subplot(*subp) subp[-1] += 1 oploti(p.g0_w[0, 0], label=r'$G_0(i\omega_n)$') oploti(p.g_w[0, 0], label=r'$G(i\omega_n)$') oploti(p.sigma_w[0, 0], label=r'$\Sigma(i\omega_n)$') plt.legend(loc='best') plt.xlim(xlim) plt.subplot(*subp) subp[-1] += 1 oplotr(p.G_tau_raw['up'], alpha=0.75) oplotr(p.G_tau['up']) plt.gca().legend().set_visible(False) plt.subplot(*subp) subp[-1] += 1 G_l = p.G_l.copy() for b, g in G_l: G_l[b].data[:] = np.abs(g.data) oplotr(G_l['up'], 'o-') plt.semilogy([], []) plt.gca().legend().set_visible(False) plt.tight_layout() plt.savefig('figure_field_sc_gf.svg')
def plot_chi_k(p, color=None): chi_k = p.chi_kw[:, Idx(0)] k_vecs, k_plot, K_plot, K_labels = get_path() kx, ky, kz = k_vecs.T interp = np.vectorize(lambda kx, ky, kz : np.squeeze(chi_k([kx, ky, kz]).real)) interp = interp(kx, ky, kz) p.chi_G = np.squeeze(chi_k[Idx(0, 0, 0)].real) line = plt.plot(k_plot, interp, '-', label=r'$N_{\nu} = $'+'${:d}$'.format(p.nwf)) plt.gca().set_xticks(K_plot); plt.gca().set_xticklabels(K_labels) plt.grid(True); plt.ylabel(r'$\chi(\mathbf{Q})$') plt.legend(loc='best', fontsize=8) return line[0].get_color()
def plot_histos(title,histos): a = plt.gca() a.set_xlim((0,beta)) a.set_xlabel('$\\Delta\\tau$') a.set_ylabel(title) for name, histo in histos.items(): w = histo.data dtau = [histo.mesh_point(n) for n in range(len(histo))] plt.plot(dtau,w,label=name,linewidth=0.7) a.legend(loc='upper center',prop={'size':10})
def setup_fig(): axes = plt.gca() axes.set_ylabel('$G(\\tau)$') axes.legend(loc='lower center', prop={'size': 10})
def setup_fig(): axes = plt.gca() axes.set_ylabel('$G(\\tau)$') axes.legend(loc='lower center',prop={'size':10})
a['Delta_iw_fit'] = Delta_iw_fit # -- Plot from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt plt.figure(figsize=(10, 10)) ylim = [-4, 4] plt.plot([w_min.imag]*2, ylim, 'sr-', lw=0.5) plt.plot([w_max.imag]*2, ylim, 'sr-', lw=0.5) for i1, i2 in itertools.product(range(2), repeat=2): oplotr(Delta_iw[i1, i2], alpha=0.1) oploti(Delta_iw[i1, i2], alpha=0.1) oplotr(Delta_iw_ref[i1, i2], lw=4, alpha=0.25) oploti(Delta_iw_ref[i1, i2], lw=4, alpha=0.25) oplotr(Delta_iw_fit[i1, i2]) oploti(Delta_iw_fit[i1, i2]) ax = plt.gca() ax.legend_ = None plt.ylim([-1, 1]) plt.tight_layout() plt.savefig(figure_filename) plt.show(); exit()
ed_arch = HDFArchive(chi_ed_filename,'r') pp = PdfPages('chi.pdf') spin_names = ('up','dn') spin_labels = {'up':'\uparrow\uparrow', 'dn':'\downarrow\downarrow'} # G_tau delta_max_text = "" for sn in spin_names: g = arch['G_tau'][sn] g_ed = ed_arch['G_tau'][sn] oplot(g, mode='R', lw=0.5, label="QMC, $%s$" % spin_labels[sn]) oplot(g_ed, mode='R', lw=0.5, label="ED, $%s$" % spin_labels[sn]) delta_max = np.max(np.abs(g.data[:,0,0] - g_ed.data[:,0,0])) delta_max_text += "$\\delta^{max}_{%s} = %f$\n" % (spin_labels[sn],delta_max) ax = plt.gca() ax.set_title('$G(\\tau)$') ax.set_ylabel('$G(\\tau)$') ax.set_xlim((0,beta)) ax.set_ylim((-1,0.05)) ax.legend(loc='lower center',prop={'size':10}) ax.text(beta/2,-0.5,delta_max_text,horizontalalignment='center') pp.savefig(plt.gcf()) # G_iw plt.cla() delta_max_text = "" for sn in spin_names: g = arch['G_iw'][sn] g_ed = ed_arch['G_iw'][sn] oplot(g, mode='I', lw=0.5, label="QMC, $%s$" % spin_labels[sn])
plt.subplot(*subp) subp[-1] += 1 for spin in ("up", "dn"): plt.plot(arch['G_l'][spin].data.flatten(), label="cthyb," + { 'up': "$\uparrow\uparrow$", 'dn': "$\downarrow\downarrow$" }[spin]) plt.plot(ed_arch[spin].data.flatten(), label="ED," + { 'up': "$\uparrow\uparrow$", 'dn': "$\downarrow\downarrow$" }[spin]) axes = plt.gca() axes.set_xlabel('$l$') axes.set_ylabel('$G_l$') axes.set_ylim((-2.0, 1.0)) axes.legend(loc='lower center', prop={'size': 10}) plt.subplot(*subp) subp[-1] += 1 for spin in ("up", "dn"): plt.plot(np.abs(arch['G_l'][spin].data.flatten()), label="cthyb," + { 'up': "$\uparrow\uparrow$", 'dn': "$\downarrow\downarrow$" }[spin]) plt.plot(np.abs(ed_arch[spin].data.flatten()),
def setup_fig(): axes = plt.gca() axes.set_ylabel('$G(\\tau)$') axes.legend(loc='best', prop={'size': 8}, ncol=2)
e_group_ed = arch_ed[e_group_name] beta = e_group['beta'] U = e_group['U'] ed = e_group['ed'] V = e_group['V'] e = e_group['e'] plt.clf() oplot(rebinning_tau(e_group['G_tau']['up'],300),name="CTHYB,$\uparrow\uparrow$") oplot(rebinning_tau(e_group['G_tau']['dn'],300),name="CTHYB,$\downarrow\downarrow$") oplot(rebinning_tau(e_group_ed['G_tau']['up'],300),name="ED,$\uparrow\uparrow$") oplot(rebinning_tau(e_group_ed['G_tau']['dn'],300),name="ED,$\downarrow\downarrow$") a = plt.gca() a.set_ylabel('$G(\\tau)$') a.set_xlim((0,beta)) a.set_ylim((-1,0)) a.legend(loc='lower right',prop={'size':10}) a.set_title("$U=%.1f$, $\epsilon_d=%.1f$, $V=%.1f$, $\epsilon_k=%.1f$" % (U,ed,V,e)) histo_a = plt.axes([.35, .15, .3, .4], axisbg='y') opcount_data = [] for w in reversed(e_group['perturbation_order_total'].data): if w==0: continue opcount_data.insert(0,w) histo_a.bar(range(len(opcount_data)), opcount_data) histo_a.set_title('perturbation_order')
if mpi.rank==0: arch = HDFArchive('asymm_bath.matrix.h5','w') pp = PdfPages('G_asymm_bath.matrix.pdf') # Set hybridization function for e in epsilon: delta_w = GfImFreq(indices = [0], beta=beta) delta_w <<= (V**2) * inverse(iOmega_n - e) S.G0["up"] <<= inverse(iOmega_n - ed - delta_w) S.G0["dn"] <<= inverse(iOmega_n - ed - delta_w) S.solve(**p) if mpi.rank==0: arch['epsilon_' + str(e)] = {"up":S.G_tau["up"], "dn":S.G_tau["dn"]} plt.clf() oplot(S.G_tau["up"], name="$\uparrow\uparrow$") oplot(S.G_tau["dn"],name="$\downarrow\downarrow$") axes = plt.gca() axes.set_ylabel('$G(\\tau)$') axes.legend(loc='lower center',prop={'size':10}) axes.set_title("$U=%.1f$, $\epsilon_d=%.1f$, $V=%.1f$, $\epsilon_k=%.1f$" % (U,ed,V,e)) pp.savefig(plt.gcf()) if mpi.rank==0: pp.close()