euphonic.plot.dispersion module

euphonic.plot.dispersion.calc_abscissa(qpts, recip_latt)

Calculates the distance between q-points (for the plot x-coordinate)

euphonic.plot.dispersion.generic_qpt_labels()

Returns a dictionary relating fractional q-point label strings to their coordinates e.g. ‘1/4 1/2 1/4’ = [0.25, 0.5, 0.25]. Used for labelling q-points when the space group can’t be calculated

euphonic.plot.dispersion.get_qpt_label(qpt, point_labels)

Gets a label for a particular q-point, based on the high symmetry points of a particular space group. Used for labelling the dispersion plot x-axis

Parameters:
  • qpt ((3,) float ndarray) – 3 dimensional coordinates of a q-point
  • point_labels (dictionary) – A dictionary with N entries, relating high symmetry point lables (e.g. ‘GAMMA’, ‘X’), to their 3-dimensional coordinates (e.g. [0.0, 0.0, 0.0]) where N = number of high symmetry points for a particular space group
Returns:

label – The label for this q-point. If the q-point isn’t a high symmetry point label is just an empty string

Return type:

string

euphonic.plot.dispersion.output_grace(data, seedname='out', up=True, down=True)

Creates a .agr Grace file of the band structure

Parameters:
  • data (PhononData or BandsData object) – Data object containing the frequencies and other data required for plotting (qpts, n_ions, cell_vecs)
  • seedname (string, optional) – Determines the figure title and output file name, seedname.agr. Default: ‘out’
  • up (boolean, optional) – Whether to plot spin up frequencies (if applicable). Default: True
  • down (boolean, optional) – Whether to plot spin down frequencies (if applicable). Default: True
euphonic.plot.dispersion.plot_dispersion(data, title='', btol=10.0, up=True, down=True, **line_kwargs)

Creates a Matplotlib figure of the band structure

Parameters:
  • data (PhononData or BandsData object) – Data object containing the frequencies and other data required for plotting (qpts, n_ions, cell_vecs)
  • title (string, optional) – The figure title. Default: ‘’
  • btol (float, optional) – Determines the limit for plotting sections of reciprocal space on different subplots, as a fraction of the median distance between q-points. Default: 10.0
  • up (boolean, optional) – Whether to plot spin up frequencies (if applicable). Default: True
  • down (boolean, optional) – Whether to plot spin down frequencies (if applicable). Default: True
  • **line_kwargs (Line2D properties, optional) – Used in the axes.plot command to specify properties like linewidth, linestyle
Returns:

fig – If matplotlib.pyplot can be imported, returns a Figure containing subplot(s) for the plotted band structure, otherwise returns None. If there is a large gap between some q-points there can be multiple subplots.

Return type:

Matplotlib Figure or None

euphonic.plot.dispersion.plot_sqw_map(data, vmin=None, vmax=None, ratio=None, ewidth=0, qwidth=0, cmap='viridis', title='')

Plots an q-E scattering plot using imshow

Parameters:
  • data (PhononData or InterpolationData object) – Data object for which sqw_map has been called, containing sqw_map and sqw_ebins attributes for plotting
  • vmin (float, optional) – Minimum of data range for colormap. See Matplotlib imshow docs Default: None
  • vmax (float, optional) – Maximum of data range for colormap. See Matplotlib imshow docs Default: None
  • ratio (float, optional) – Ratio of the size of the y and x axes. e.g. if ratio is 2, the y-axis will be twice as long as the x-axis Default: None
  • ewidth (float, optional, default 0) – The FWHM of the Gaussian energy resolution function in the same units as freqs
  • qwidth (float, optional, default 0) – The FWHM of the Gaussian q-vector resolution function
  • cmap (string, optional, default 'viridis') – Which colormap to use, see Matplotlib docs
  • title (string, optional) – The figure title. Default: ‘’
Returns:

  • fig (Matplotlib Figure or None) – If matplotlib.pyplot can be imported, is a Figure with a single subplot, otherwise is None
  • ims ((n_qpts,) ‘matplotlib.image.AxesImage’ ndarray or None) – If matplotlib.pyplot can be imported, is an array of AxesImage objects, one for each q-point, for easier access to some attributes/functions. Otherwise is None

euphonic.plot.dispersion.recip_space_labels(data)

Gets high symmetry point labels (e.g. GAMMA, X, L) for the q-points at which the path through reciprocal space changes direction

Parameters:data (PhononData or BandsData object) – Data object containing the cell vectors, q-points and optionally ion types and coordinates (used for determining space group)
Returns:
  • labels ((n_qpts_direction_changed,) string ndarray) – List of the labels for each q-point at which the path through reciprocal space changes direction
  • qpts_with_labels ((n_qpts_direction_changed,) int ndarray) – List of the indices of the q-points at which the path through reciprocal space changes direction