dgamore.plotting#

All matplotlib plotting helpers. These functions produce the diagnostic and result figures of a run — local self-energy / susceptibility checks, frequency-resolved four-point maps, momentum-space two-point maps (with optional Fermi-surface markers), the superconducting gap function, and the analytically continued spectral function along a high-symmetry path. Each routine saves and/or shows its figure. All plotting is gated behind config.output.do_plotting and comm.rank == 0 by the callers.

Functions

add_afzb([ax, kx, ky, lw, marker])

Draws the antiferromagnetic zone-boundary lines (and the BZ axes) onto an existing axis, and sets its limits and labels.

chi_checks(chi_dens_list, chi_magn_list, ...)

Produces the routine diagnostic plots for the density and magnetic susceptibilities (linear and log-log, with the \(1/\omega^2\) kinetic-energy asymptote overlaid).

find_zeros(mat)

Finds the zero crossings (zero contour) of a real 2D field via a matplotlib contour at level 0.

plot_gap_function(obj, kx, ky[, name, orbs, ...])

Plots the gap function in the \((k_x, k_y)\) plane for fixed orbitals.

plot_nu_nup(obj[, orbs, omega, do_save, ...])

Plots the real and imaginary parts of a local four-point object in the \((\nu, \nu')\) plane for fixed orbitals and bosonic frequency \(\omega\).

plot_spectrum(a_w, kx, ky, kz, ...[, ...])

Plots the total (band-summed) spectral function \(A(\mathbf{k}, \omega)\) along a high-symmetry k-path, interpolating the BZ-gridded data onto the path.

plot_two_point_kx_ky(obj, kx, ky[, ...])

Plots the real and imaginary parts of a two-point function in the \((k_x, k_y)\) plane (at \(k_z = 0\) and the first positive Matsubara frequency) for fixed orbitals, with the antiferromagnetic zone boundary and optional scatter points overlaid.

plot_two_point_kx_ky_real_and_imag(obj, kx, ky)

Plots a two-point function in the \((k_x, k_y)\) plane for fixed orbitals, writing the real and imaginary parts to two separate files.

plot_two_point_kx_ky_with_fs_points(obj, ...)

Plots a two-point function in the \((k_x, k_y)\) plane for fixed orbitals, with the Fermi-surface points (zero crossings of the quantity in the reduced BZ quadrant) scattered on top (see plot_two_point_kx_ky()).

sigma_loc_checks(siw_arr, labels, beta[, ...])

Produces the routine local self-energy diagnostic plots (real/imaginary part, linear and log-log) for a set of self-energies.

dgamore.plotting.add_afzb(ax=None, kx=None, ky=None, lw=1.0, marker='')[source]#

Draws the antiferromagnetic zone-boundary lines (and the BZ axes) onto an existing axis, and sets its limits and labels.

Parameters:
  • ax – The matplotlib axis to draw on.

  • kx – The kx grid values.

  • ky – The ky grid values.

  • lw – Line width of the drawn lines.

  • marker – Marker style for the drawn lines.

Returns:

None.

dgamore.plotting.chi_checks(chi_dens_list: list[ndarray], chi_magn_list: list[ndarray], beta: float, labels: list[str], e_kin: float, output_dir: str = './', orbs=[0, 0, 0, 0], show: bool = False, save: bool = True, name: str = '')[source]#

Produces the routine diagnostic plots for the density and magnetic susceptibilities (linear and log-log, with the \(1/\omega^2\) kinetic-energy asymptote overlaid).

Parameters:
  • chi_dens_list (list[ndarray]) – List of density susceptibility arrays.

  • chi_magn_list (list[ndarray]) – List of magnetic susceptibility arrays.

  • beta (float) – Inverse temperature \(\beta\).

  • labels (list[str]) – Plot labels, one per susceptibility.

  • e_kin (float) – Kinetic energy, used to draw the high-frequency asymptote.

  • output_dir (str) – Directory to save the figure to.

  • orbs – The four orbital indices to plot.

  • show (bool) – Whether to display the figure.

  • save (bool) – Whether to save the figure.

  • name (str) – Name tag used in the output filename.

Returns:

None.

dgamore.plotting.find_zeros(mat: ndarray) ndarray[source]#

Finds the zero crossings (zero contour) of a real 2D field via a matplotlib contour at level 0.

Parameters:

mat (ndarray) – The 2D array whose zero contour is sought (the real part is used).

Returns:

The integer index coordinates of the zero-contour vertices.

Return type:

ndarray

dgamore.plotting.plot_gap_function(obj: GapFunction, kx: ndarray, ky: ndarray, name: str = '', orbs: ndarray | list | tuple = (0, 0), output_dir='./', cmap='magma', scatter=None, do_save: bool = True, show: bool = False)[source]#

Plots the gap function in the \((k_x, k_y)\) plane for fixed orbitals. Rather than the real/imaginary parts, it shows the values at the smallest positive and smallest negative fermionic Matsubara frequency, which makes the frequency parity (and hence the gap symmetry) visible.

Parameters:
  • obj (GapFunction) – The GapFunction to plot.

  • kx (ndarray) – The kx grid values for the plot axes.

  • ky (ndarray) – The ky grid values for the plot axes.

  • name (str) – Output filename tag.

  • orbs (ndarray | list | tuple) – The two orbital indices to select.

  • output_dir – Directory to save the figure to.

  • cmap – The matplotlib colormap.

  • scatter – Optional [N, 2] array of points to scatter on the plot.

  • do_save (bool) – Whether to save the figure.

  • show (bool) – Whether to display the figure.

Returns:

None.

Raises:

ValueError – If orbs does not have two entries.

dgamore.plotting.plot_nu_nup(obj: LocalFourPoint, orbs: ndarray | list | tuple = (0, 0, 0, 0), omega: int = 0, do_save: bool = True, output_dir: str = './', name: str = 'Name', colormap: str = 'RdBu', show: bool = False) None[source]#

Plots the real and imaginary parts of a local four-point object in the \((\nu, \nu')\) plane for fixed orbitals and bosonic frequency \(\omega\).

Parameters:
  • obj (LocalFourPoint) – The LocalFourPoint to plot.

  • orbs (ndarray | list | tuple) – The four orbital indices to select.

  • omega (int) – The bosonic frequency index to plot.

  • do_save (bool) – Whether to save the figure.

  • output_dir (str) – Directory to save the figure to.

  • name (str) – Figure title and output filename tag.

  • colormap (str) – The matplotlib colormap.

  • show (bool) – Whether to display the figure.

Returns:

None.

Raises:

ValueError – If omega is out of range or orbs does not have four entries.

Return type:

None

dgamore.plotting.plot_spectrum(a_w: ndarray, kx: ndarray, ky: ndarray, kz: ndarray, high_sym_points: list[tuple[float, float, float, str]], energy_window: tuple[float, float], beta: float, title: str, fermi_energy: float = 0, output_dir='./', name: str = '', cmap='magma', do_save: bool = True, show: bool = False)[source]#

Plots the total (band-summed) spectral function \(A(\mathbf{k}, \omega)\) along a high-symmetry k-path, interpolating the BZ-gridded data onto the path. The spectral function is expected in the band-diagonal basis.

Parameters:
  • a_w (ndarray) – The spectral function of shape [kx, ky, kz, n_bands, w].

  • kx (ndarray) – The kx grid values.

  • ky (ndarray) – The ky grid values.

  • kz (ndarray) – The kz grid values.

  • high_sym_points (list[tuple[float, float, float, str]]) – The path corner points as (kx, ky, kz, label) tuples (fractional coordinates).

  • energy_window (tuple[float, float]) – The real-frequency window (w_min, w_max) for the y-axis.

  • beta (float) – Inverse temperature \(\beta\) (sets the real-frequency axis mapping).

  • title (str) – The plot title.

  • fermi_energy (float) – Energy offset subtracted so the Fermi level sits at zero.

  • output_dir – Directory to save the figure to.

  • name (str) – Output filename tag.

  • cmap – The matplotlib colormap.

  • do_save (bool) – Whether to save the figure.

  • show (bool) – Whether to display the figure.

Returns:

None.

dgamore.plotting.plot_two_point_kx_ky(obj: LocalNPoint | IAmNonLocal, kx: ndarray, ky: ndarray, pi_shift: bool = True, title: str = '', name: str = '', orbs: ndarray | list | tuple = (0, 0), output_dir='./', cmap='magma', scatter=None, save: bool = True, show: bool = False)[source]#

Plots the real and imaginary parts of a two-point function in the \((k_x, k_y)\) plane (at \(k_z = 0\) and the first positive Matsubara frequency) for fixed orbitals, with the antiferromagnetic zone boundary and optional scatter points overlaid.

Parameters:
  • obj (LocalNPoint | IAmNonLocal) – The two-point object to plot (a LocalNPoint / IAmNonLocal).

  • kx (ndarray) – The kx grid values for the plot axes.

  • ky (ndarray) – The ky grid values for the plot axes.

  • pi_shift (bool) – Whether to shift the momentum grid by \(\pi\) before plotting.

  • title (str) – Title suffix for the subplots.

  • name (str) – Output filename tag.

  • orbs (ndarray | list | tuple) – The two orbital indices to select.

  • output_dir – Directory to save the figure to.

  • cmap – The matplotlib colormap.

  • scatter – Optional [N, 2] array of points to scatter on the plot (e.g. Fermi-surface points).

  • save (bool) – Whether to save the figure.

  • show (bool) – Whether to display the figure.

Returns:

None.

Raises:

ValueError – If orbs does not have two entries.

dgamore.plotting.plot_two_point_kx_ky_real_and_imag(obj: LocalNPoint | IAmNonLocal, kx: ndarray, ky: ndarray, pi_shift: bool = True, title: str = '', name: str = '', orbs: ndarray | list | tuple = (0, 0), output_dir='./', cmap='magma', save: bool = True, show: bool = False)[source]#

Plots a two-point function in the \((k_x, k_y)\) plane for fixed orbitals, writing the real and imaginary parts to two separate files.

Parameters:
  • obj (LocalNPoint | IAmNonLocal) – The two-point object to plot (a LocalNPoint / IAmNonLocal).

  • kx (ndarray) – The kx grid values for the plot axes.

  • ky (ndarray) – The ky grid values for the plot axes.

  • pi_shift (bool) – Whether to shift the momentum grid by \(\pi\) before plotting.

  • title (str) – Title (rendered inside the math mode of the subplot titles).

  • name (str) – Output filename tag (_real/_imag is appended).

  • orbs (ndarray | list | tuple) – The two orbital indices to select.

  • output_dir – Directory to save the figures to.

  • cmap – The matplotlib colormap.

  • save (bool) – Whether to save the figures.

  • show (bool) – Whether to display the figures.

Returns:

None.

Raises:

ValueError – If orbs does not have two entries.

dgamore.plotting.plot_two_point_kx_ky_with_fs_points(obj: LocalNPoint | IAmNonLocal, k_grid: KGrid, kx: ndarray, ky: ndarray, pi_shift: bool = True, title: str = '', name: str = '', orbs: ndarray | list | tuple = (0, 0), output_dir='./', cmap='magma', do_save: bool = True, show: bool = False)[source]#

Plots a two-point function in the \((k_x, k_y)\) plane for fixed orbitals, with the Fermi-surface points (zero crossings of the quantity in the reduced BZ quadrant) scattered on top (see plot_two_point_kx_ky()).

Parameters:
  • obj (LocalNPoint | IAmNonLocal) – The two-point object to plot (a LocalNPoint / IAmNonLocal).

  • k_grid (KGrid) – The KGrid providing the k-axis values for the Fermi-surface points.

  • kx (ndarray) – The kx grid values for the plot axes.

  • ky (ndarray) – The ky grid values for the plot axes.

  • pi_shift (bool) – Whether to shift the momentum grid by \(\pi\) before plotting.

  • title (str) – Title suffix for the subplots.

  • name (str) – Output filename tag.

  • orbs (ndarray | list | tuple) – The two orbital indices to select.

  • output_dir – Directory to save the figure to.

  • cmap – The matplotlib colormap.

  • do_save (bool) – Whether to save the figure.

  • show (bool) – Whether to display the figure.

Returns:

None.

dgamore.plotting.sigma_loc_checks(siw_arr: list[ndarray], labels: list[str], beta: float, output_dir: str = './', show: bool = False, save: bool = True, name: str = '', xmax: float = 0) None[source]#

Produces the routine local self-energy diagnostic plots (real/imaginary part, linear and log-log) for a set of self-energies.

Parameters:
  • siw_arr (list[ndarray]) – List of local self-energy arrays (one fermionic frequency axis each).

  • labels (list[str]) – Plot labels, one per self-energy.

  • beta (float) – Inverse temperature \(\beta\) (sets the default x-axis range).

  • output_dir (str) – Directory to save the figure to.

  • show (bool) – Whether to display the figure.

  • save (bool) – Whether to save the figure.

  • name (str) – Name tag used in the output filename.

  • xmax (float) – Maximum frequency on the x-axis (defaults to 5 + 2*beta if 0).

Returns:

None.

Return type:

None