Python API#

class fermi_contours.marching_squares.MarchingSquares(grid_values=None, func=None, bounds=None, res=None, open_contours=True, periodic=False)#

Bases: object

Marching square class.

Parameters:
  • grid_values (ndarray of floats with shape (n, m), optional) – Values of the function on a 2-dimensional coordinates grid.

  • func (callable) – Function that returns floats for each point in a 2-dimensional coordinates space. If grid_values is provided, func is used to resolve saddle points. If grid_values is not provided, then func, bounds and res must be provided. The grid_values is obtained using a 2-dimensional coordinates grid.

  • bounds (ndarray-like of shape (2, 2)) – Bounds in the x- and y-axis ((x_min, x_max), (y_min, y_max)), optional. If not provided, the bounds are assumed to be ((0, n), (0, m)).

  • res (int, optional) – Number of linear points to subdivide each of the axis intervals. If bounds is not provided, res is not used, and the shape of the grid_values is used instead.

  • open_contours (bool) – Wheather to allow open contours or raise an error when contours do not close on themselves.

  • periodic (bool, default to 'False') – If ‘True’, the 2-dimensional coordinates grid has periodic boundaries. Thus, the point (n, j) is equivalent to (0, j), and (i, m) equivalent to (i, 0). If bounds are provided, then x_max should be mapped to x_min, and y_max to y_min.

__call__(level=0)#

Calcualte the Fermi contours for a Fermi level.

Sets values for the attributes defined below.

Parameters:

level (float, default to '0') – Isolevel.

Returns:

contour_paths – Each list has numerical interpolated points along the path.

Return type:

list of lists of pairs of floats.