コード例 #1
0
ファイル: plot.py プロジェクト: MHarland/ClusterDMFT
def plot_ln_abs(gl, *args, **kwargs):
    g = gl.copy()
    for s, b in gl:
        for i in range(len(b.data[0, :, :])):
            for j in range(len(b.data[0, :, :])):
                for n in range(len(b.data[:, 0, 0])):
                    g[s].data[n, i, j] = log(abs(b.data[n, i, j]))
    for s, b in g:
        for i in b.indices:
            for j in b.indices:
                oplot(b[i, j], name = s+'_'+str(i)+str(j), *args, **kwargs)
    plt.gca().set_ylabel('$\\mathrm{ln}\\,\\mathrm{abs}\\,\\tilde{G}(l)$')
コード例 #2
0
ファイル: plot.py プロジェクト: MHarland/ClusterDMFT
def plot_from_archive(archive, function, loops = [-1], indices = [(0, 0)], blocks = ['up'], **kwargs):
    archive = HDFArchive(archive, 'r')
    for l in loops:
        if l < 0:
            ll = archive['results']['n_dmft_loops'] + l
        else:
            ll = l
        for ind in indices:
            for s in blocks:
                f_name = s + '_' + str(ind[0]) + str(ind[1]) + '_it' + str(ll)
                if 'raw' in function: f_name += '_raw'
                f = archive['results'][str(ll)][function]
                if 'iw' in function:
                    if 'RI' in kwargs.keys():
                        if kwargs['RI'] == 'R':
                            oplot(f[s][ind], name = 'Re_' + f_name, **kwargs)
                        if kwargs['RI'] == 'I':
                            oplot(f[s][ind], name = 'Im_' + f_name, **kwargs)
                    else:
                        oplot(f[s][ind], name = 'Re_' + f_name, RI = 'R', **kwargs)
                        oplot(f[s][ind], name = 'Im_' + f_name, RI = 'I', **kwargs)
                elif function == 'g_transf_l':
                    plt.plot(f[s].data[:, ind[0], ind[1]], label = f_name, **kwargs)
                    plt.xlabel('$l_n$')
                    plt.ylabel('$\\tilde{G}(l_n)$')
                else:
                    oplot(f[s][ind], name = f_name, **kwargs)
    y_ax_lab = '$'
    if 'transf' in function: y_ax_lab += '\\tilde{'
    if 'sigma' in function: y_ax_lab += '\\Sigma'
    elif 'g' in function: y_ax_lab += 'G'
    elif 'delta' in function: y_ax_lab += '\\Delta'
    else: y_ax_lab += function
    if 'transf' in function: y_ax_lab += '}'
    y_ax_lab += "("
    if 'iw' in function: y_ax_lab += 'i\\omega_n'
    elif 'tau' in function: y_ax_lab += '\\tau'
    y_ax_lab += ')$'
    plt.gca().set_ylabel(y_ax_lab)
    del archive
コード例 #3
0
import numpy as np
from pytriqs.gf import GfReFreq, SemiCircular

g = GfReFreq(indices = ['eg1', 'eg2'], window = (-5, 5), n_points = 1000, name = "egBlock")

g['eg1','eg1'] = SemiCircular(half_bandwidth = 1)
g['eg2','eg2'] = SemiCircular(half_bandwidth = 2)

from pytriqs.plot.mpl_interface import oplot
oplot(g['eg1','eg1'], '-o', RI = 'S')  # S : spectral function 
oplot(g['eg2','eg2'], '-x', RI = 'S')


コード例 #4
0
ファイル: green_imfreq.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.gf.local import GfImFreq, SemiCircular

g = GfImFreq(indices = ['eg1','eg2'], beta = 50, n_points = 1000, name = "egBlock")

g['eg1','eg1'] = SemiCircular(half_bandwidth = 1)
g['eg2','eg2'] = SemiCircular(half_bandwidth = 2)

from pytriqs.plot.mpl_interface import oplot, plt
oplot(g, '-o', x_window = (0,10))
plt.ylim(-2,1)

コード例 #5
0
ファイル: green_pade.py プロジェクト: JaksaVucicevic/triqs
    return 0.7/(z-2.6+0.3*1j) + 0.3/(z+3.4+0.1*1j)

# Semicircle
def GSC(z):
    return 2.0*(z + sqrt(1-z**2)*(log(1-z) - log(-1+z))/pi)

# A superposition of GLorentz(z) and GSC(z) with equal weights
def G(z):
    return 0.5*GLorentz(z) + 0.5*GSC(z)

# Matsubara GF
gm = GfImFreq(indices = [0], beta = beta, name = "gm")
gm << Function(G)
gm.tail.zero()
gm.tail[1] = numpy.array([[1.0]])

# Real frequency BlockGf(reference)
gr = GfReFreq(indices = [0], window = (-5.995, 5.995), n_points = 1200, name = "gr")
gr << Function(G)
gr.tail.zero()
gr.tail[1] = numpy.array([[1.0]])

# Analytic continuation of gm
g_pade = GfReFreq(indices = [0], window = (-5.995, 5.995), n_points = 1200, name = "g_pade")
g_pade.set_from_pade(gm, n_points = L, freq_offset = eta)

# Comparison plot
from pytriqs.plot.mpl_interface import oplot
oplot(gr[0,0], '-o', RI = 'S', name = "Original DOS")
oplot(g_pade[0,0], '-x', RI = 'S', name = "Pade-reconstructed DOS")
コード例 #6
0
ファイル: nonint.plot.py プロジェクト: MHarland/cthyb
from matplotlib.backends.backend_pdf import PdfPages

N_max = 10
arch = HDFArchive('nonint.h5','r')

for i in arch:
    subarch = arch[i]
    pp = PdfPages("G_nonint_%s.pdf"%i)

    G_tau = subarch['G_tau']
    V = subarch['V']
    e = subarch['e']
    beta = G_tau.beta
    n_tau = len(G_tau.mesh)

    for m, b in enumerate(G_tau.indices):
        g_theor = GfImTime(indices = [0], beta=beta, n_points=n_tau)
        e1 = e[m] - V[m]
        e2 = e[m] + V[m]
        g_theor_w = GfImFreq(indices = [0], beta=beta)
        g_theor_w << 0.5*inverse(iOmega_n - e1) + 0.5*inverse(iOmega_n - e2)
        g_theor[0,0] << InverseFourier(g_theor_w)

        plt.clf()
        oplot(rebinning_tau(G_tau[b][0,0],200), name="cthyb")
        oplot(g_theor[0,0], name="Theory")

        pp.savefig(plt.gcf())

    pp.close()
コード例 #7
0
ファイル: legendre.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.gf.local import *
from pytriqs.plot.mpl_interface import oplot

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices=[1], beta=50)
gw << SemiCircular(half_bandwidth=1)

# Create a Legendre Green's function with 40 coefficients
# initialize it from gw and plot it
gl = GfLegendre(indices=[1], beta=50, n_points=40)
gl << MatsubaraToLegendre(gw)
oplot(gl, "-o")
コード例 #8
0
ファイル: demo1.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.plot.mpl_interface import oplot
from pytriqs.fit.fit import Fit, linear, quadratic
from pytriqs.gf.local import *
from pytriqs.gf.local.descriptors import iOmega_n
g = GfImFreq(indices = [1], beta = 300, n_points = 1000, name = "g")
g << inverse( iOmega_n + 0.5 )

print " van plot"
oplot (g,     '-o', x_window = (0,3) )     

print "plot done"
g << inverse( iOmega_n + 0.5 )
 
print "ok ----------------------"


from pytriqs.archive import HDFArchive
R = HDFArchive('myfile.h5', 'r')

for n, calculation in R.items() : 
    #g = calculation['g']
    g << inverse( iOmega_n + 0.5 )
    
    print "pokokook"

    X,Y = g.x_data_view (x_window = (0,0.2), flatten_y = True )

    #fitl = Fit ( X,Y.imag, linear )
    g << inverse( iOmega_n + 0.5 )

    print " van plot"
コード例 #9
0
ファイル: dmft_plot.py プロジェクト: TRIQS/cthyb
from pytriqs.gf.local import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot, plt

with HDFArchive("dmft_solution.h5", "r") as ar:
    for i in range(5):
        oplot(ar["G_iw-%i" % i]["up"], "-o", mode="I", label="Iteration = %s" % i, x_window=(0, 2))

plt.legend(loc=4)
コード例 #10
0
ファイル: dmft_plot.py プロジェクト: TRIQS/TRIQS.github.io
from pytriqs.gf.local import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot, plt

with HDFArchive("dmft_solution.h5", 'r') as ar:
    for i in range(5):
        oplot(ar['G_iw-%i' % i]['up'],
              '-o',
              mode='I',
              label='Iteration = %s' % i,
              x_window=(0, 2))

plt.legend(loc=4)
コード例 #11
0
ファイル: asymm_bath.plot.py プロジェクト: tayral/cthyb
# Plot G(\tau)
pp = PdfPages('G_asymm_bath.pdf')

for e_group_name in arch:
    e_group = arch[e_group_name]
    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 = []
コード例 #12
0
ファイル: test_G_tau_and_G_iw.py プロジェクト: yuechm/pyed
def test_cf_G_tau_and_G_iw_nonint(verbose=False):

    beta = 3.22
    eps = 1.234

    niw = 64
    ntau = 2 * niw + 1
    
    H = eps * c_dag(0,0) * c(0,0)

    fundamental_operators = [c(0,0)]

    ed = TriqsExactDiagonalization(H, fundamental_operators, beta)

    # ------------------------------------------------------------------
    # -- Single-particle Green's functions

    G_tau = GfImTime(beta=beta, statistic='Fermion', n_points=ntau, target_shape=(1,1))
    G_iw = GfImFreq(beta=beta, statistic='Fermion', n_points=niw, target_shape=(1,1))

    G_iw << inverse( iOmega_n - eps )
    G_tau << InverseFourier(G_iw)

    G_tau_ed = GfImTime(beta=beta, statistic='Fermion', n_points=ntau, target_shape=(1,1))
    G_iw_ed = GfImFreq(beta=beta, statistic='Fermion', n_points=niw, target_shape=(1,1))

    ed.set_g2_tau(G_tau_ed[0, 0], c(0,0), c_dag(0,0))
    ed.set_g2_iwn(G_iw_ed[0, 0], c(0,0), c_dag(0,0))

    # ------------------------------------------------------------------
    # -- Compare gfs

    from pytriqs.utility.comparison_tests import assert_gfs_are_close
    
    assert_gfs_are_close(G_tau, G_tau_ed)
    assert_gfs_are_close(G_iw, G_iw_ed)
    
    # ------------------------------------------------------------------
    # -- Plotting
    
    if verbose:
        from pytriqs.plot.mpl_interface import oplot, plt
        subp = [3, 1, 1]
        plt.subplot(*subp); subp[-1] += 1
        oplot(G_tau.real)
        oplot(G_tau_ed.real)

        plt.subplot(*subp); subp[-1] += 1
        diff = G_tau - G_tau_ed
        oplot(diff.real)
        oplot(diff.imag)
        
        plt.subplot(*subp); subp[-1] += 1
        oplot(G_iw)
        oplot(G_iw_ed)
        
        plt.show()
コード例 #13
0
ファイル: plot.py プロジェクト: xfzhang-phys/som
from params import *

arch = HDFArchive(chi_filename, 'r')
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()
コード例 #14
0
N_max = 10
arch = HDFArchive('nonint.h5', 'r')

for i in arch:
    subarch = arch[i]
    pp = PdfPages("G_nonint_%s.pdf" % i)

    G_tau = subarch['G_tau']
    V = subarch['V']
    e = subarch['e']
    beta = G_tau.beta
    n_tau = len(G_tau.mesh)

    for m, b in enumerate(G_tau.indices):
        g_theor = GfImTime(indices=[0], beta=beta, n_points=n_tau)
        e1 = e[m] - V[m]
        e2 = e[m] + V[m]
        g_theor_w = GfImFreq(indices=[0], beta=beta)
        g_theor_w << 0.5 * inverse(iOmega_n - e1) + 0.5 * inverse(iOmega_n -
                                                                  e2)
        g_theor[0, 0] << InverseFourier(g_theor_w)

        plt.clf()
        oplot(rebinning_tau(G_tau[b][0, 0], 200), name="cthyb")
        oplot(g_theor[0, 0], name="Theory")

        pp.savefig(plt.gcf())

    pp.close()
コード例 #15
0
ファイル: spinless.plot.py プロジェクト: yogeshwar2609/cthyb
    axes.set_ylabel('$G(\\tau)$')
    axes.legend(loc='best', prop={'size': 8}, ncol=2)


pp = PdfPages('G.pdf')
ed_arch = HDFArchive('spinless.ed.h5', 'r')

for use_qn in (False, True):
    file_name = "spinless"
    if use_qn: file_name += ".qn"
    file_name += ".h5"

    try:
        arch = HDFArchive(file_name, 'r')
        plt.clf()

        name = 'cthyb' + (' (QN)' if use_qn else '')
        for i1, i2 in product(("A", "B"), ("A", "B")):
            #GF = rebinning_tau(arch['tot'][i1,i2],500)
            #oplot(GF, name=name + ",%s%s" % (i1,i2))
            oplot(arch["tot"][i1, i2], name=name + ",%s%s" % (i1, i2))
            oplot(ed_arch["tot"][i1, i2], name="ED, %s%s" % (i1, i2))

        setup_fig()
        pp.savefig(plt.gcf())

    except IOError:
        pass

pp.close()
コード例 #16
0
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot input and reconstructed G(\tau)
oplot(ar['g_tau'][0, 0], mode='R', linewidth=0.8, label="$G_{00}(\\tau)$")
oplot(ar['g_tau'][1, 1], mode='R', linewidth=0.8, label="$G_{11}(\\tau)$")
oplot(ar['g_rec_tau'][0, 0],
      mode='R',
      linewidth=0.8,
      label="$G_{00}^\mathrm{rec}(\\tau)$")
oplot(ar['g_rec_tau'][1, 1],
      mode='R',
      linewidth=0.8,
      label="$G_{11}^\mathrm{rec}(\\tau)$")

plt.xlim((0, 20))
plt.ylabel("$G(\\tau)$")
plt.legend(loc="lower center")
コード例 #17
0
# get S_w from the auxilliary spectral function Aaux_w
Aaux_w = {}
w = res['up_0'].omega
for key in res:
    Aaux_w[key] = res[key].analyzer_results['LineFitAnalyzer']['A_out']

isc.set_Gaux_w_from_Aaux_w(Aaux_w,
                           w,
                           np_interp_A=10000,
                           np_omega=4000,
                           w_min=-1.0,
                           w_max=1.0)

# save SigmaContinuator again (now it contains S_w)
with HDFArchive('Sr2RuO4_b37.h5', 'a') as ar:
    isc = ar['isc']

# check linfit and plot S_w
plt.figure()
plt.subplot(1, 2, 1)
for key in res:
    res[key].analyzer_results['LineFitAnalyzer'].plot_linefit()
plt.ylim(1e1, 1e4)
plt.subplot(1, 2, 2)
oplot(isc.S_w['up_0'], mode='I', label='maxent xy', lw=3)
oplot(isc.S_w['up_1'], mode='I', label='maxent xz', lw=3)
plt.ylabel(r'$\Sigma(\omega)$')
plt.xlim(-0.75, 0.75)
plt.ylim(-0.4, 0.0)
コード例 #18
0
ファイル: g_iw_from_tau.py プロジェクト: tschaefer87/tprf
                 statistic='Fermion',
                 n_points=nt,
                 indices=[1])

g_tau << InverseFourier(g_iw)

# -- Test fourier

from pytriqs.applications.tprf.fourier import g_iw_from_tau
g_iw_ref = g_iw_from_tau(g_tau, nw)

np.testing.assert_array_almost_equal(g_iw_ref.data, g_iw.data)

if False:
    from pytriqs.plot.mpl_interface import oplot, plt

    subp = [1, 3, 1]
    plt.subplot(*subp)
    subp[-1] += 1
    oplot(g_iw)

    plt.subplot(*subp)
    subp[-1] += 1
    oplot(g_tau)

    plt.subplot(*subp)
    subp[-1] += 1
    oplot(g_iw_ref)

    plt.show()
コード例 #19
0
import numpy


class myObject(object):
    def _plot_(self, options):
        PI = numpy.pi
        xdata = numpy.arange(-PI, PI, 0.1)
        ydata1 = numpy.cos(xdata)
        ydata2 = numpy.sin(xdata)
        return ([{
            'type': "XY",
            'xdata': xdata,
            'ydata': ydata1,
            'label': 'Cos'
        }, {
            'type': "XY",
            'xdata': xdata,
            'ydata': ydata2,
            'label': 'Sin'
        }])


X = myObject()

from pytriqs.plot.mpl_interface import oplot
oplot(X, '-o')
コード例 #20
0
ファイル: legendre.py プロジェクト: EBRUDU1/triqs
from pytriqs.gf.local import *
from pytriqs.plot.mpl_interface import oplot,plt

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices = [1], beta = 50)
gw <<= SemiCircular(half_bandwidth = 1)

# Create a Legendre Green's function with 40 coefficients
# initialize it from gw and plot it
gl = GfLegendre(indices = [1], beta = 50, n_points = 40)
gl <<= MatsubaraToLegendre(gw)
oplot(gl, '-o')
コード例 #21
0
ファイル: plot_chi_iw.py プロジェクト: krivenko/som
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot input and reconstructed \chi(i\omega_n)
oplot(ar['chi_iw'][0,0],     mode='R', linewidth=0.8, label="$\chi_0(i\\omega_n)$")
oplot(ar['chi_rec_iw'][0,0], mode='R', linewidth=0.8, label="$\chi_\mathrm{0,rec}(i\\omega_n)$")
oplot(ar['chi_iw'][1,1],     mode='R', linewidth=0.8, label="$\chi_1(i\\omega_n)$")
oplot(ar['chi_rec_iw'][1,1], mode='R', linewidth=0.8, label="$\chi_\mathrm{1,rec}(i\\omega_n)$")

plt.xlim((0, 3))
plt.ylabel("$\chi'(i\\omega_n)$")
plt.legend(loc="upper right")
コード例 #22
0
ファイル: spinless.plot.py プロジェクト: fkrien/cthyb
def setup_fig():
    axes = plt.gca()
    axes.set_ylabel('$G(\\tau)$')
    axes.legend(loc='lower center',prop={'size':10})

pp = PdfPages('G.pdf')
for plot_objs in objects_to_plot:
    try:
        plt.clf()
        for obj in plot_objs:

            if type(obj) is tuple:
                filename = params.results_file_name(*obj)
                name = 'cthyb'
                if obj[0]: name += '(QN)'
            else:
                filename = 'spinless.' + obj + '.h5'
                name = {'ed':'ED', 'matrix':'Matrix'}[obj]
            
            arch = HDFArchive(filename,'r')
            
            for i1,i2 in product((0,1),(0,1)):
                oplot(arch["tot"][i1,i2], name=name + ",%i%i" % (i1,i2))
                            
        setup_fig()
        pp.savefig(plt.gcf())

    except IOError: pass

pp.close()
コード例 #23
0
from pytriqs.gf import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot

with HDFArchive('aim_solution.h5','r') as ar:
    oplot(ar['G_iw']['up'], '-o', x_window = (0,10))
コード例 #24
0
ファイル: dosNonInt.py プロジェクト: MHarland/ClusterDMFT
#!/usr/bin/env pytriqs
from ClusterDMFT.cdmft import CDmft
from ClusterDMFT.evaluation.analytical_continuation import pade_tr as pade
from pytriqs.gf.local import BlockGf, GfImFreq, GfReFreq
from pytriqs.plot.mpl_interface import oplot
from numpy import pi
from matplotlib import pyplot as plt, cm
import sys

n_start = int(sys.argv[1])
n_stop = int(sys.argv[2])
n_step = int(sys.argv[3])
max_w = int(sys.argv[4])
max_y = int(sys.argv[5])

for arch in sys.argv[6:len(sys.argv)]:
    x = CDmft(archive = arch)
    g = x.load('g_0_c_iw', 0)
    for n in range(n_start, n_stop, n_step):
        g_w = pade(g, pade_n_omega_n = n, pade_eta = 0.001, dos_n_points = 1200, dos_window = (-max_w, max_w), clip_threshold = 0)
        oplot(g_w, RI = 'S', name = str(n), color = cm.jet((n - n_start) /float(n_stop - n_start)))
    filename = 'dosNonInt_' + arch[0:-3] + '_' + str(n_start) + str(n_stop) + str(n_step) + '.png'
    plt.gca().set_ylim(0, max_y)
    plt.savefig(filename)
    plt.close()
    print filename + ' ready'
    del x

コード例 #25
0
ファイル: anderson.plot.py プロジェクト: MHarland/cthyb
    if use_qn: file_name += ".qn"
    file_name += ".h5"

    mkind = lambda spin: (spin,0) if use_blocks else ("tot",spin)

    try:
        arch = HDFArchive(file_name,'r')
        plt.clf()

        name_parts = []
        if use_blocks: name_parts.append('Block')
        if use_qn: name_parts.append('QN')
        name = 'cthyb' + (' (' + ', '.join(name_parts) + ')' if len(name_parts) else '')

        for spin in spin_names:
            bn, i = mkind(spin)
            GF = rebinning_tau(arch['G_tau'][bn],500)
            if use_blocks:
                oplot(GF, name=name + "," + {'up':"$\uparrow\uparrow$",'dn':"$\downarrow\downarrow$"}[spin])
            else:
                i = spin_names.index(i)
                oplot(GF[i,i], name=name + "," + {'up':"$\uparrow\uparrow$",'dn':"$\downarrow\downarrow$"}[spin])
            oplot(ed_arch[spin], name="ED," + {'up':"$\uparrow\uparrow$",'dn':"$\downarrow\downarrow$"}[spin])

        setup_fig()
        pp.savefig(plt.gcf())

    except IOError: pass

pp.close()
コード例 #26
0
ファイル: green_imtime.py プロジェクト: MHarland/triqs
from pytriqs.gf.local import *
from pytriqs.plot.mpl_interface import oplot

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices = [1], beta = 50)
gw << SemiCircular(half_bandwidth = 1)

# Create an imaginary-time Green's function
gt = GfImTime(indices = [1], beta = 50)
gt << InverseFourier(gw)

# Plot the Legendre Green's function
oplot(gt, '-')
コード例 #27
0
ファイル: fourier.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.gf.local import *
from pytriqs.plot.mpl_interface import oplot

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices=[1], beta=50)
gw << SemiCircular(half_bandwidth=1)

# Create an imaginary-time Green's function and plot it
gt = GfImTime(indices=[1], beta=50)
gt << InverseFourier(gw)
oplot(gt, "-")
コード例 #28
0
from numpy import pi
from matplotlib import pyplot as plt, cm
import sys

n_start = int(sys.argv[1])
n_stop = int(sys.argv[2])
n_step = int(sys.argv[3])
max_w = int(sys.argv[4])
max_a = int(sys.argv[5])

cmaps_pool = [cm.Reds, cm.Blues, cm.Greens, cm.Greys]
for arch in sys.argv[6:len(sys.argv)]:
    print 'loading '+arch+' ...'
    x = CDmft(archive = arch)
    g = x.load('G_sym_iw')
    cmaps = list()
    n_orbs = int(g.n_blocks * .5)
    for i in range(n_orbs):
        cmaps.append(cmaps_pool[i%(len(cmaps_pool))])
    for n in range(n_start, n_stop, n_step):
        for s, b in g:
            g_w = pade(g, s, pade_n_omega_n = n, pade_eta = 10**-2, dos_n_points = 1200, dos_window = (-max_w, max_w), clip_threshold = 0)
            oplot(g_w, RI = 'S', name = s[0]+s[2]+' '+str(n), color = cmaps[int(s[0])](((n - n_start) /float(n_stop - n_start))*.5 + .5))
    filename = 'dos_orb_' + arch[0:-3] + '_' + str(n_start) + str(n_stop) + str(n_step) + '.png'
    plt.gca().set_ylim(0, max_a)
    plt.savefig(filename)
    plt.close()
    print filename + ' ready'
    del x

コード例 #29
0
ファイル: ex1.py プロジェクト: TRIQS/TRIQS.github.io
BL = BravaisLattice(units=[(1, 0, 0), (0, 1, 0)])

# Prepare a nearest neighbour hopping on BL
t = -1.00  # First neighbour Hopping
tp = 0.0 * t  # Second neighbour Hopping

# Hopping[ Displacement on the lattice] = [[t11,t12,t13....],[t21,t22,t23....],...,[....,tnn]]
# where n=Number_Orbitals
hop = {
    (1, 0): [[t]],
    (-1, 0): [[t]],
    (0, 1): [[t]],
    (0, -1): [[t]],
    (1, 1): [[tp]],
    (-1, -1): [[tp]],
    (1, -1): [[tp]],
    (-1, 1): [[tp]]
}

TB = TightBinding(BL, hop)

# Compute the density of states
d = dos(TB, n_kpts=500, n_eps=101, name='dos')[0]

# Plot the dos it with matplotlib
from pytriqs.plot.mpl_interface import oplot
from matplotlib import pylab as plt
oplot(d, '-o')
plt.xlim(-5, 5)
plt.ylim(0, 0.4)
コード例 #30
0
from pytriqs.gf import GfReFreq, Omega, Wilson, inverse
import numpy

eps_d, t = 0.3, 0.2

# Create the real-frequency Green's function and initialize it
g = GfReFreq(indices=['s', 'd'],
             window=(-2, 2),
             n_points=1000,
             name="$G_\mathrm{s+d}$")
g['d', 'd'] = Omega - eps_d
g['d', 's'] = t
g['s', 'd'] = t
g['s', 's'] = inverse(Wilson(1.0))
g.invert()

# Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) )
from pytriqs.plot.mpl_interface import oplot, plt
oplot(g['d', 'd'], '-o', RI='S', x_window=(-1.8, 1.8), name="Impurity")
oplot(g['s', 's'], '-x', RI='S', x_window=(-1.8, 1.8), name="Bath")
plt.show()
コード例 #31
0
    with HDFArchive('preblur.h5', 'w') as ar:
        ar['result_normal'] = result_normal.data
        ar['results_preblur'] = [r.data for r in results_preblur]

# extract the chi2 value from the optimal alpha for each blur parameter
chi2s = []
# we have to reverse-sort it because fit_piecewise expects it in that order
b_vals = sorted(results_preblur.keys(), reverse=True)
for b in b_vals:
    r = results_preblur[b]
    alpha_index = r.analyzer_results['LineFitAnalyzer']['alpha_index']
    chi2s.append(r.chi2[alpha_index])

# perform a linefit to get the optimal b value
b_index, _ = fit_piecewise(np.log10(b_vals), np.log10(chi2s))
b_ideal = b_vals[b_index]
print('Ideal b value = ', b_ideal)

if plot:
    import matplotlib.pyplot as plt
    from pytriqs.plot.mpl_interface import oplot
    oplot(G_w, mode='S')
    result_normal.analyzer_results['LineFitAnalyzer'].plot_A_out()
    results_preblur[b_ideal].analyzer_results['LineFitAnalyzer'].plot_A_out()
    plt.xlabel(r'$\omega$')
    plt.ylabel(r'$A(\omega)$')
    plt.legend(['original', 'normal', 'preblur'])
    plt.xlim(-2.5, 2.5)
    plt.savefig('preblur_A.png')
    plt.show()
コード例 #32
0
ファイル: plot_chi_iw.py プロジェクト: xfzhang-phys/som
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot input and reconstructed \chi(i\omega_n)
oplot(ar['chi_iw'][0, 0],
      mode='R',
      linewidth=0.8,
      label="$\chi_0(i\\omega_n)$")
oplot(ar['chi_rec_iw'][0, 0],
      mode='R',
      linewidth=0.8,
      label="$\chi_\mathrm{0,rec}(i\\omega_n)$")
oplot(ar['chi_iw'][1, 1],
      mode='R',
      linewidth=0.8,
      label="$\chi_1(i\\omega_n)$")
oplot(ar['chi_rec_iw'][1, 1],
      mode='R',
      linewidth=0.8,
      label="$\chi_\mathrm{1,rec}(i\\omega_n)$")

plt.xlim((0, 3))
plt.ylabel("$\chi'(i\\omega_n)$")
plt.legend(loc="upper right")
コード例 #33
0
ファイル: legendre_plot.py プロジェクト: TRIQS/cthyb_matrix
from pytriqs.gf.local import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot

A = HDFArchive("solution.h5")
oplot(A['Gl']['up'], '-o', x_window=(15,45) )
コード例 #34
0
ファイル: plot.py プロジェクト: krivenko/som
from params import *

arch = HDFArchive(chi_filename,'r')
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 = ""
コード例 #35
0
ファイル: fit_test.py プロジェクト: TRIQS/TRIQS.github.io
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices=[0], beta=300, n_points=1000, name="g")
g <<= inverse(Omega + 0.5)

# the data we want to fit...
# The green function for omega \in [0,0.2]
X, Y = g.x_data_view(x_window=(0, 0.2), flatten_y=True)

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit(X, Y.imag, linear)
fitq = Fit(X, Y.imag, quadratic)

oplot(g, '-o', x_window=(0, 5))
oplot(fitl, '-x', x_window=(0, 0.5))
oplot(fitq, '-x', x_window=(0, 1))

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level = lambda X, a, b: 1 / (a * X * 1j + b
                                         ), r"${1}/(%f x + %f)$", (1, 1)

fit1 = Fit(X, Y, one_fermion_level)
oplot(fit1, '-x', x_window=(0, 3))
コード例 #36
0
ファイル: green_retime.py プロジェクト: TRIQS/triqs
from math import pi
from pytriqs.gf import *

gw = GfReFreq(indices = [1], window = (-5, 5), n_points = 1001, name = "egBlock")
gw << SemiCircular(2.0)

gt = GfReTime(indices = [1], window = (-5*2*pi*(100.0/101.0),5*2*pi*(100.0/101.0)), n_points = 1001, name = "egBlock")
gt << InverseFourier(gw)

from pytriqs.plot.mpl_interface import oplot
oplot(gt.imag, '-o')


コード例 #37
0
ファイル: plot_chi_w.py プロジェクト: xfzhang-phys/som
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot imaginary part of the susceptibility on the real axis
oplot(ar['chi_w'][0,0], mode='I', linewidth=0.8, label="$\chi''_0(\\omega)$")
oplot(ar['chi_w'][1,1], mode='I', linewidth=0.8, label="$\chi''_1(\\omega)$")

plt.xlim((-5.0,5.0))
plt.ylim((-1.5,1.5))
plt.ylabel("$\chi(\\omega)$")
plt.legend(loc = "lower right")
コード例 #38
0
#!/usr/bin/env pytriqs
from ClusterDMFT.cdmft import CDmft
from pytriqs.plot.mpl_interface import oplot
import sys
from matplotlib import pyplot as plt

for n, arch in enumerate(sys.argv[1:]):
    c = CDmft(archive = arch)
    g = c.load('Delta_sym_tau')
    for s, b in g:
        for i in range(len(b.data[0,:,:])):
            for j in range(len(b.data[0,:,:])):
                oplot(b[i, j])
                plt.gca().set_ylabel('$\Delta_{'+s+'\\,'+str(i)+str(j)+'}^{(s)}(\\tau)$')
                plt.savefig(arch[0:-3]+'_Delta_'+s+'_'+str(i)+str(j)+'.png', dpi = 300)
                plt.close()
コード例 #39
0
#!/usr/bin/env pytriqs
from ClusterDMFT.periodization import Periodization
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot
import sys

arch = sys.argv[1]

lat = Periodization(archive = arch)
oplot(_tr_g_lat_pade([lat.get_g_lat_loc()])[0], RI = 'S', name = 'local_DOS')
plt.savefig('plot.png')
コード例 #40
0
ファイル: green_imfreq.py プロジェクト: TRIQS/TRIQS.github.io
from pytriqs.gf.local import GfImFreq, SemiCircular

g = GfImFreq(indices=['eg1', 'eg2'], beta=50, n_points=1000, name="egBlock")

g['eg1', 'eg1'] = SemiCircular(half_bandwidth=1)
g['eg2', 'eg2'] = SemiCircular(half_bandwidth=2)

from pytriqs.plot.mpl_interface import oplot, plt
oplot(g, '-o', x_window=(0, 10))
plt.ylim(-2, 1)
コード例 #41
0
        H_loc_block.append(H_loc)

    tau_mesh = MeshImTime(beta, 'Fermion', n_tau)
    Delta_tau = BlockGf(mesh=tau_mesh, gf_struct=gf_struct)
    Delta_tau << Fourier(Delta_iw)

    # ------------------------------------------------------------------

    # ------------------------------------------------------------------
    exit()

    from pytriqs.plot.mpl_interface import oplot, oploti, oplotr, plt
    subp = [3, 1, 1]
    plt.subplot(*subp)
    subp[-1] += 1
    oplot(G0_iw)
    plt.subplot(*subp)
    subp[-1] += 1
    oplot(Delta_iw)
    plt.subplot(*subp)
    subp[-1] += 1
    oplot(Delta_tau)
    plt.show()

    exit()

    # -- Convert the impurity model to ndarrays with W2Dynamics format
    # -- O : composite spin and orbital index
    # -- s, o : pure spin and orbital indices

    from pyed.OperatorUtils import fundamental_operators_from_gf_struct
コード例 #42
0
ファイル: aim_plot.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.gf.local import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot

A = HDFArchive("solution.h5")
G_iw = GfImFreq(indices = [0], beta = 50.0)
G_iw << Fourier(A['G_tau']['up'])
oplot(G_iw, '-o', x_window = (0,10))
コード例 #43
0
from pytriqs.gf.local import *
from pytriqs.archive import *
from pytriqs.plot.mpl_interface import oplot

with HDFArchive('slater_five_band.h5','r') as ar:
    # Calculate orbital- and spin-averaged Green's function
    G_tau = ar['G_tau-1']
    g_tau_ave = G_tau['up_0'].copy()
    g_tau_ave.zero()
    for name, g in G_tau: g_tau_ave += g
    g_tau_ave = g_tau_ave/10.
    g_tau_rebin = rebinning_tau(g_tau_ave,1000)
    g_tau_rebin.name = r'$G_{\rm ave}$'
    oplot(g_tau_rebin,linewidth=2,label='')
コード例 #44
0
ファイル: green_refreq.py プロジェクト: JaksaVucicevic/triqs
import numpy as np
from pytriqs.gf.local import GfReFreq, SemiCircular

g = GfReFreq(indices = ['eg1', 'eg2'], window = (-5, 5), n_points = 1000, name = "egBlock")

g['eg1','eg1'] = SemiCircular(half_bandwidth = 1)
g['eg2','eg2'] = SemiCircular(half_bandwidth = 2)

from pytriqs.plot.mpl_interface import oplot
oplot(g['eg1','eg1'], '-o', RI = 'S')  # S : spectral function 
oplot(g['eg2','eg2'], '-x', RI = 'S')


コード例 #45
0
ファイル: plot_g_tau.py プロジェクト: xfzhang-phys/som
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot input and reconstructed correlator
oplot(ar['g_tau'], mode='R', linewidth=0.8, label="$g(\\tau)$")
oplot(ar['g_rec_tau'],
      mode='R',
      linewidth=0.8,
      label="$g_\mathrm{rec}(\\tau)$")

plt.xlim((0, 10))
plt.ylabel("$g(\\tau)$")
plt.legend(loc="upper right")
コード例 #46
0
ファイル: green_retime.py プロジェクト: TRIQS/TRIQS.github.io
from pytriqs.gf.local import *

gw = GfReFreq(indices=[1], window=(-5, 5), n_points=300, name="egBlock")
gw <<= SemiCircular(2.0)

# This is a GfReTime
gt = gw.inverse_fourier()

from pytriqs.plot.mpl_interface import oplot

oplot(gt.imag, '-o')
コード例 #47
0
ファイル: demo1.py プロジェクト: richtma93/triqs
from pytriqs.plot.mpl_interface import oplot
from pytriqs.fit.fit import Fit, linear, quadratic
from pytriqs.gf import *
from pytriqs.gf.descriptors import iOmega_n
g = GfImFreq(indices=[1], beta=300, n_points=1000, name="g")
g << inverse(iOmega_n + 0.5)

print " van plot"
oplot(g, '-o', x_window=(0, 3))

print "plot done"
g << inverse(iOmega_n + 0.5)

print "ok ----------------------"

from pytriqs.archive import HDFArchive
R = HDFArchive('myfile.h5', 'r')

for n, calculation in R.items():
    #g = calculation['g']
    g << inverse(iOmega_n + 0.5)

    print "pokokook"

    X, Y = g.x_data_view(x_window=(0, 0.2), flatten_y=True)

    #fitl = Fit ( X,Y.imag, linear )
    g << inverse(iOmega_n + 0.5)

    print " van plot"
    oplot(g, '-o', x_window=(0, 3))
コード例 #48
0
ファイル: plot.py プロジェクト: HugoStrand/tprf
    a = analytic_hubbard_atom(**parm.dict())
    a.G_iw.name = r'$G_{analytic}$'

    plt.figure(figsize=(3.25 * 2, 3 * 2))

    subp = [2, 2, 1]

    plt.subplot(*subp)
    subp[-1] += 1

    oploti(p.G_iw)
    oploti(a.G_iw)

    plt.subplot(*subp)
    subp[-1] += 1
    diff = a.G_iw.copy()
    diff << p.G_iw['up'] - a.G_iw
    diff.name = r'$G_{ctint} - G_{analytic}$'
    oplot(diff)

    plt.subplot(*subp)
    subp[-1] += 1
    vmax = np.max(np.abs(p.chi_m.data.real))
    opt = dict(vmax=vmax, vmin=-vmax, cmap='PuOr')
    data = np.squeeze(p.chi_m.data.real)
    plt.pcolormesh(data, **opt)

    plt.tight_layout()
    plt.show()
コード例 #49
0
ファイル: fit_test.py プロジェクト: JaksaVucicevic/triqs
from pytriqs.plot.mpl_interface import oplot
from pytriqs.gf.local import GfImFreq, Omega, inverse

g = GfImFreq(indices = [0], beta = 300, n_points = 1000, name = "g")
g << inverse( Omega + 0.5 )

# the data we want to fit...
# The green function for omega \in [0,0.2]
X,Y = g.x_data_view (x_window = (0,0.2), flatten_y = True )

from pytriqs.fit import Fit, linear, quadratic

fitl = Fit ( X,Y.imag, linear )
fitq = Fit ( X,Y.imag, quadratic )

oplot (g,     '-o', x_window = (0,5) )     
oplot (fitl , '-x', x_window = (0,0.5) )
oplot (fitq , '-x', x_window = (0,1) )

# a bit more complex, we want to fit with a one fermion level ....
# Cf the definition of linear and quadratic in the lib
one_fermion_level  =  lambda X, a,b   : 1/(a * X *1j  + b),    r"${1}/(%f x + %f)$"    , (1,1)

fit1 = Fit ( X,Y, one_fermion_level )
oplot (fit1 , '-x', x_window = (0,3) )
    
コード例 #50
0
ファイル: tut_ex3b.py プロジェクト: EBRUDU1/triqs
from pytriqs.gf.local import GfReFreq
from pytriqs.archive import HDFArchive
from math import pi

R = HDFArchive('myfile.h5', 'r') 
 
from pytriqs.plot.mpl_interface import oplot, plt

for name, g in R.items() :  # iterate on the elements of R, like a dict ...
    oplot( (- 1/pi * g).imag, "-o", name = name)

plt.xlim(-1,1) 
plt.ylim(0,7) 

p.savefig("./tut_ex3b.png") 

コード例 #51
0
from pytriqs.gf.local import GfReFreq
from pytriqs.archive import HDFArchive
from math import pi

R = HDFArchive('myfile.h5', 'r')

from pytriqs.plot.mpl_interface import oplot, plt

for name, g in R.items():  # iterate on the elements of R, like a dict ...
    oplot((-1 / pi * g).imag, "-o", name=name)

plt.xlim(-1, 1)
plt.ylim(0, 7)

p.savefig("./tut_ex3b.png")
コード例 #52
0
from pytriqs.gf import *
from pytriqs.plot.mpl_interface import oplot, plt

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices=[1], beta=50)
gw << SemiCircular(half_bandwidth=1)

# Create a Legendre Green's function with 40 coefficients
# and initialize it from gw
gl = GfLegendre(indices=[1], beta=50, n_points=40)
gl << MatsubaraToLegendre(gw)

# Plot the Legendre Green's function
oplot(gl, '-o')
コード例 #53
0
ファイル: green_pade.py プロジェクト: TRIQS/TRIQS.github.io
# Semicircle
def GSC(z):
    return 2.0 * (z + sqrt(1 - z**2) * (log(1 - z) - log(-1 + z)) / pi)


# A superposition of GLorentz(z) and GSC(z) with equal weights
def G(z):
    return 0.5 * GLorentz(z) + 0.5 * GSC(z)


# Matsubara GF
gm = GfImFreq(indices=[0], beta=beta, name="gm", n_points=2000)
gm << Function(G)

# Real frequency BlockGf(reference)
gr = GfReFreq(indices=[0], window=(-5.995, 5.995), n_points=1200, name="gr")
gr << Function(G)

# Analytic continuation of gm
g_pade = GfReFreq(indices=[0],
                  window=(-5.995, 5.995),
                  n_points=1200,
                  name="g_pade")
g_pade.set_from_pade(gm, n_points=L, freq_offset=eta)

# Comparison plot
from pytriqs.plot.mpl_interface import oplot
oplot(gr[0, 0], '-o', RI='S', name="Original DOS")
oplot(g_pade[0, 0], '-x', RI='S', name="Pade-reconstructed DOS")
コード例 #54
0
ファイル: fourier.py プロジェクト: TRIQS/TRIQS.github.io
from pytriqs.gf import *
from pytriqs.plot.mpl_interface import oplot

# A Green's function on the Matsubara axis set to a semicircular
gw = GfImFreq(indices=[1], beta=50)
gw << SemiCircular(half_bandwidth=1)

# Create an imaginary-time Green's function and plot it
gt = GfImTime(indices=[1], beta=50)
gt << InverseFourier(gw)
oplot(gt, '-')
コード例 #55
0
#!/usr/bin/env pytriqs
from ClusterDMFT.cdmft import CDmft
from pytriqs.plot.mpl_interface import oplot
import sys
from matplotlib import pyplot as plt

max_freq = int(sys.argv[1])

for n, arch in enumerate(sys.argv[2:]):
    c = CDmft(archive = arch)
    g = c.load('g_c_iw')
    for s, b in g:
        for i in range(len(b.data[0,:,:])):
            for j in range(len(b.data[0,:,:])):
                oplot(b[i, j], x_window = (0, max_freq), RI = 'R', name = 'Re')
                oplot(b[i, j], x_window = (0, max_freq), RI = 'I', name = 'Im')
                if s == 'up': 
                    sout = '\\uparrow'
                elif s == 'down' or s == 'dn': 
                    sout = '\\downarrow'
                else:
                    sout = s
                plt.gca().set_ylabel('$G_{'+sout+'\\,'+str(i)+str(j)+'}^{(c)}(i\\omega_n)$')
                plt.savefig(arch[0:-3]+'_G_'+s+'_'+str(i)+str(j)+'.pdf', dpi = 300)
                plt.close()
コード例 #56
0
ファイル: plot_g_tau.py プロジェクト: krivenko/som
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from matplotlib import pyplot as plt
from pytriqs.plot.mpl_interface import oplot

# Read data from archive
ar = HDFArchive('results.h5', 'r')

# Plot input and reconstructed G(\tau)
oplot(ar['g_tau'][0,0],     mode='R', linewidth=0.8, label="$G_{00}(\\tau)$")
oplot(ar['g_tau'][1,1],     mode='R', linewidth=0.8, label="$G_{11}(\\tau)$")
oplot(ar['g_rec_tau'][0,0], mode='R', linewidth=0.8, label="$G_{00}^\mathrm{rec}(\\tau)$")
oplot(ar['g_rec_tau'][1,1], mode='R', linewidth=0.8, label="$G_{11}^\mathrm{rec}(\\tau)$")

plt.xlim((0, 20))
plt.ylabel("$G(\\tau)$")
plt.legend(loc="lower center")
コード例 #57
0
                          0)  # Crucial : removes the entry from the dict
        ydata1 = numpy.cos(xdata + phi)
        ydata2 = numpy.sin(xdata + phi)
        return ([{
            'type':
            "XY",
            'xdata':
            xdata,
            'ydata':
            ydata1,
            'label':
            r'$x \rightarrow \cos (x + \phi), \quad \phi = %s$' % phi
        }, {
            'type':
            "XY",
            'xdata':
            xdata,
            'ydata':
            ydata2,
            'label':
            r'$x \rightarrow \sin (x + \phi), \quad \phi = %s$' % phi
        }])


X = myObject()

from pytriqs.plot.mpl_interface import oplot

oplot(X, '-o')
oplot(X, '-x', phi=0.3)
コード例 #58
0
ファイル: ex1.py プロジェクト: davoudn/triqs-1
# where n=Number_Orbitals
hop= {  (1,0)  :  [[ t]],       
        (-1,0) :  [[ t]],     
        (0,1)  :  [[ t]],
        (0,-1) :  [[ t]],
        (1,1)  :  [[ tp]],
        (-1,-1):  [[ tp]],
        (1,-1) :  [[ tp]],
        (-1,1) :  [[ tp]]}

TB = TightBinding ( BL, hop)

# Compute the density of states
d = dos (TB, n_kpts= 500, n_eps = 101, name = 'dos')[0]

# Plot the dos it with matplotlib
from pytriqs.plot.mpl_interface import oplot
from matplotlib import pylab as plt
oplot(d,'-o')
plt.xlim ( -5,5 )
plt.ylim ( 0, 0.4)





plt.savefig("./ex1.png") 



コード例 #59
0
plt.ylim(1e1, 1e3)
# curvature(alpha)
plt.subplot(2, 2, 3)
res.analyzer_results['Chi2CurvatureAnalyzer'].plot_curvature()
# probablity(alpha)
plt.subplot(2, 2, 2)
res.plot_probability()
# backtransformed G_rec(tau) and original G(tau)
# by default (plot_G=True) also original G(tau) is plotted
plt.subplot(2, 2, 4)
res.plot_G_rec(alpha_index=5)
plt.tight_layout()

# spectral function A
fig2 = plt.figure()
oplot(G_w, mode='S', color='k', lw=3, label='Original Model')
plt.plot(res.omega,
         res.analyzer_results['LineFitAnalyzer']['A_out'],
         '-',
         lw=3,
         label='LineFit')
plt.plot(res.omega,
         res.analyzer_results['Chi2CurvatureAnalyzer']['A_out'],
         '--',
         lw=3,
         label='Chi2Curvature')
plt.plot(res.omega,
         res.analyzer_results['BryanAnalyzer']['A_out'],
         '-',
         lw=3,
         label='Bryan')