3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 22:33:48 +01:00
dft_tools/pytriqs/gf/local/_gf_refreq.py
Olivier Parcollet 3a31077d51 gf : new wrapper
2014-05-11 21:47:52 +02:00

39 lines
1.3 KiB
Python

from tools import get_indices_in_dict
import _gf_plot
import numpy
def init( mesh= None, shape =None, name = 'g', **d):
"""
"""
if mesh is None :
from gf import MeshReFreq
window = d.pop('window')
omega_min = window[0]
omega_max = window[1]
n_max = d.pop('n_points',10000)
kind = d.pop('kind','full_bins')
mesh = MeshReFreq(omega_min, omega_max, n_max, kind)
indices_pack = get_indices_in_dict(d)
if not shape :
assert indices_pack, "No shape, no indices !"
indicesL, indicesR = indices_pack
shape = len(indicesL),len(indicesR)
#data = d.pop('data') if 'data' in d else numpy.zeros((len(mesh),N1,N2), self.dtype )
#tail = d.pop('tail') if 'tail' in d else TailGf(shape = (N1,N2))
#symmetry = d.pop('symmetry', Nothing())
return (mesh, shape, indices_pack, name), {}
#-------------- PLOT ---------------------------------------
def plot(self, opt_dict):
""" Plot protocol. opt_dict can contain :
* :param RI: 'R', 'I', 'RI' [ default]
* :param x_window: (xmin,xmax) or None [default]
* :param name: a string [default ='']. If not '', it remplaces the name of the function just for this plot.
"""
return _gf_plot.plot_base(self, opt_dict, r'$\omega$', lambda name : r'%s$(\omega)$'%name, True, list(self.mesh))