r"""Plot-protocol implementation for Green's functions on a 2D BZ / cyclic-lattice mesh. Parameters ---------- opt_dict : dict Plot options, e.g. * ``type`` — ``'XY'`` (default; band-structure style along ``path``) or ``'contourf'`` (2D heat map).
(self, opt_dict)
| 208 | |
| 209 | |
| 210 | def plot(self, opt_dict): |
| 211 | r"""Plot-protocol implementation for Green's functions on a 2D BZ / |
| 212 | cyclic-lattice mesh. |
| 213 | |
| 214 | Parameters |
| 215 | ---------- |
| 216 | opt_dict : dict |
| 217 | Plot options, e.g. |
| 218 | |
| 219 | * ``type`` — ``'XY'`` (default; band-structure style along |
| 220 | ``path``) or ``'contourf'`` (2D heat map). |
| 221 | * ``method`` — interpolation method for |
| 222 | :func:`~triqs.gfs.plot.bz.make_plottable`. Default ``'nearest'``. |
| 223 | * ``mode`` — ``'R'`` for the real part (default) or ``'I'`` |
| 224 | for the imaginary part. |
| 225 | * ``path`` — required for ``type='XY'``, a list of BZ |
| 226 | coordinates defining the cut. |
| 227 | |
| 228 | Returns |
| 229 | ------- |
| 230 | list of dict |
| 231 | Curve / contour descriptors consumed by |
| 232 | :func:`~triqs.plot.mpl_interface.oplot`. |
| 233 | """ |
| 234 | |
| 235 | plot_type = opt_dict.pop('type','XY') |
| 236 | method = opt_dict.pop('method', 'nearest') |
| 237 | comp = opt_dict.pop('mode', 'R') |
| 238 | component= lambda x : x.real if comp=="R" else x.imag |
| 239 | |
| 240 | if 'BrillouinZone' in str(type(self.mesh)): |
| 241 | X_label = r"k" |
| 242 | elif 'CyclicLattice' in str(type(self.mesh)): |
| 243 | X_label = r"R" |
| 244 | else: |
| 245 | X_label = "X" |
| 246 | |
| 247 | if plot_type=="contourf": |
| 248 | x,y,z,zmin, zmax = make_plottable(self, method=method) |
| 249 | |
| 250 | default_dict = {'xdata': x, |
| 251 | 'ydata': y, |
| 252 | 'label': r'$G_\mathbf{%s}$'%X_label, |
| 253 | 'xlabel': r'$%s_x$'%X_label, |
| 254 | 'ylabel': r'$%s_y$'%X_label, |
| 255 | 'zdata' : component(z[0,0, :, :]), |
| 256 | 'levels':np.linspace(component(zmin[0,0]),component(zmax[0,0]),50), |
| 257 | 'plot_function': plot_type, |
| 258 | 'title': r'$\mathrm{%s}G(\mathbf{%s})$'%('Re' if comp=='R' else 'Im', X_label), |
| 259 | } |
| 260 | elif plot_type=="XY": |
| 261 | path=opt_dict.pop("path") |
| 262 | L,Lpt, high_sym = slice_on_path(self, path=path, method=method) |
| 263 | xticks_args=(high_sym, ["%1.3f,%1.3f"%(x,y) for x,y in path],) |
| 264 | |
| 265 | default_dict = {'xdata': list(range(0,len(L))), |
| 266 | 'ydata': component(Lpt), |
| 267 | 'label': r'$G_\mathbf{%s}$'%X_label, |
nothing calls this directly
no test coverage detected