Plot

BZ plots, fatbands, etc.

elphmod.plot.adjust_pixels(image, points, distances, width, height=None)[source]

Even out image with block-wise equidistant columns.

Parameters:
imagendarray

Image with inconsistent horizontal (2nd axis) sampling.

pointslist of int

Indices of columns where equidistant sampling changes.

distanceslist of float

Desired cumulative distance of points.

widthint

Desired width of adjusted image.

heightint, optional

Desired height of adjusted image. Unchanged by default.

Returns:
ndarray

Adjusted image with overall equidistant columns.

elphmod.plot.choose_backend()[source]

Switch to non-GUI Matplotlib backend if necessary.

elphmod.plot.color(data, cmap=None, minimum=None, maximum=None, comm=<elphmod.MPI.Communicator object>)[source]

Colorize data using colormap from StoryLines (parallelized version).

Parameters:
datalist of list

Data on two-dimensional mesh.

cmapfunction

Colormap from StoryLines.

minimum, maxmimumfloat

Data values corresponding to minimum and maximum of color scale.

Returns:
list of list of list

RGB image.

elphmod.plot.colorbar(image, left=0.02, bottom=0.02, width=0.03, height=0.3, minimum=None, maximum=None)[source]

Add colorbar to image.

elphmod.plot.compline(x, y, composition, center=True)[source]

Plot composition along line.

elphmod.plot.double_plot(mesh, q, nq, qxmin=-0.8, qxmax=0.8, qymin=-0.8, qymax=0.8, resolution=500, interpolation=<function linear_interpolation>, angle=60, outside=0.0, outlines=False, broadcast=True)[source]

Show f(q1, q2, k1, k2) on “Brillouin zone made of Brillouin zones”.

elphmod.plot.plot(mesh, kxmin=-1.0, kxmax=1.0, kymin=-1.0, kymax=1.0, resolution=100, interpolation=<function linear_interpolation>, angle=60, return_k=False, broadcast=True)[source]

Plot in Cartesian reciprocal coordinates.

elphmod.plot.rectify(image, width, height, lt, rt, lb, rb, *args, **kwargs)[source]

Map skew image selection onto rectangular area.

This function could turn a photograph of a document and its surroundings, taken at any unfortunate angle, into a rectangular image of the document content alone (similar to common scan applications).

Parameters:
imagendarray

2D array with image data.

widthfloat

Output width in units of original image width.

heightfloat

Output height in units of original image height.

lttuple of float

Upper-left corner of rectangle as original image coordinates.

rttuple of float

Upper-right corner of rectangle as original image coordinates.

lbtuple of float

Lower-left corner of rectangle as original image coordinates.

rbtuple of float

Lower-right corner of rectangle as original image coordinates.

*args, **kwargs

Arguments passed to linear-interpolation routine.

Returns:
ndarray

Rectangular view of image selection.

elphmod.plot.toBZ(data=None, points=1000, interpolation=<function linear_interpolation>, angle=120, angle0=0, outside=0.0, return_k=False, return_only_k=False, even=False, broadcast=True)[source]

Map data on uniform grid onto (wedge of) Brillouin zone.

Parameters:
angleint

Angle between first and second Bravais-lattice vector in degrees.

angle0float

Angle between x axis and first Bravais-lattice vector in degrees.