r"""Build the curve dictionaries consumed by :func:`~triqs.plot.mpl_interface.oplot`. The following plotting options are consumed by this function: - ``name`` — label prefix for the legend (defaults to ``self.name``). - ``mode`` — one of ``'R'`` (real), ``'I'`` (imaginary),
(self, opt_dict, xlabel, ylabel, X, allow_spectral_mode=False)
| 25 | from triqs.plot.protocol import clip_array |
| 26 | |
| 27 | def plot_base(self, opt_dict, xlabel, ylabel, X, allow_spectral_mode=False): |
| 28 | r"""Build the curve dictionaries consumed by |
| 29 | :func:`~triqs.plot.mpl_interface.oplot`. |
| 30 | |
| 31 | The following plotting options are consumed by this function: |
| 32 | |
| 33 | - ``name`` — label prefix for the legend (defaults to |
| 34 | ``self.name``). |
| 35 | - ``mode`` — one of ``'R'`` (real), ``'I'`` (imaginary), |
| 36 | ``'S'`` (spectral function) or empty (both real and |
| 37 | imaginary). Default ``''``. |
| 38 | - ``x_window`` — ``(xmin, xmax)`` clipping window on the |
| 39 | mesh axis. |
| 40 | |
| 41 | Any other entries are forwarded to every curve dictionary. |
| 42 | |
| 43 | Parameters |
| 44 | ---------- |
| 45 | self : Gf |
| 46 | Green's function being plotted. |
| 47 | opt_dict : dict |
| 48 | Plot options. |
| 49 | xlabel : str |
| 50 | ``xlabel`` for the plot. |
| 51 | ylabel : callable |
| 52 | ``ylabel(name) -> str`` producing the y-axis label from the |
| 53 | Green's function name. |
| 54 | X : array-like |
| 55 | Mesh values for the x axis. |
| 56 | allow_spectral_mode : bool, optional |
| 57 | If ``True``, ``mode='S'`` is accepted and returns |
| 58 | :math:`-\frac{1}{\pi}\,\mathrm{Im}\, G`. Default ``False``. |
| 59 | |
| 60 | Returns |
| 61 | ------- |
| 62 | list of dict |
| 63 | One dictionary per target-space element to be plotted, with |
| 64 | keys ``xlabel``, ``ylabel``, ``xdata``, ``ydata``, ``label`` |
| 65 | and any pass-through options from ``opt_dict``. |
| 66 | |
| 67 | Raises |
| 68 | ------ |
| 69 | ValueError |
| 70 | For an unknown ``mode`` value, or for ``mode='S'`` when |
| 71 | ``allow_spectral_mode`` is ``False``. |
| 72 | """ |
| 73 | |
| 74 | assert 'name_prefix' not in opt_dict, "name_prefix is deprecated" |
| 75 | #if 'name' not in opt_dict: |
| 76 | # warnings.warn("oplot REQUIRES a name = for making the legend and labels. Using self.name, but it is deprecated and WILL BE REMOVED") |
| 77 | name = opt_dict.pop('name', self.name) |
| 78 | rx = opt_dict.pop('x_window', None) |
| 79 | X = numpy.array(X).real |
| 80 | sl = clip_array(X, *rx) if rx else slice(len(X)) # the slice due to clip option x_window |
| 81 | |
| 82 | def mdic(prefix, f): |
| 83 | from itertools import product |
| 84 | ind_range = product(*list(map(range,reversed(self.target_shape)))) |
nothing calls this directly
no test coverage detected