Api Reference

The Sample Object

class pybandstructure.sample.sample.Sample(basis_vectors, denominator, integer_coords, points_db=None, special_points=None)

Class to store samples of a vector space as rational coordinates with respect to a basis.

contour(point_list)

Create a contour in the sample space given a list of points.

point_listlist of points

Each element can be a tuple of ints of length lattice_dimension, or int, or sequence of ints of length 1, or str.

dictionary containing

indices : array of integers containing the indices of the points along the path x : array of float containing coordinates of points measured

along the path

vertices : array containing vertices positions

classmethod from_file(file_name, sample_name, file_format='hdf5')

Initialize a new Sample instance using data from file

file_namestr or path

name of the file from which data are read

sample_namestr

name of the sample to read

file_formatstr, optional

type of format used for saving, by default ‘hdf5’. Only ‘hdf5’ currently available.

Sample

reconstructed sample object

get_coords(point)

Get the real coordinates corresponding to a point.

pointint or tuple of ints

index or integer coordinates

1D array of float

the real coordinates of the selected point

get_fractional_part(point)

Return the fractional part of a point.

point : tuple of ints of length lattice_dimension, or int, or sequence of ints of length 1, or str

integer coords of the requested point or index of the point or string identifying a special point

tuple

fractional part of point

get_integer_coords(point)

Get the integer coordinates corresponding to a point.

pointint or tuple of ints

index or integer coordinates

1D array of int

the integer coordinates of the selected point

get_integer_part(point)

Return the integer part of a point.

point : tuple of ints of length lattice_dimension, or int, or sequence of ints of length 1, or str

integer coords of the requested point or index of the point or string identifying a special point

tuple

integer part of point

classmethod lattice_sample(basis_vectors, cut_off, special_points=None)

Build a sample of a Bravais lattice containing all the vectors with norm smaller than a specified cut off. Denominator used for expressing coordinates is 1.

basis_vectors2D array-like

primitive vectors of the lattice. The i-th vector is basis_vectors[:,i].

cut_offfloat

Maximum norm of vectors included in the sample

special_pointsdictionary, optional

dictionary associating strings to sample elements

Sample

Sample object containing the points of the Bravais lattice

classmethod line_sample(basis_vectors, cut_off, direction=0, special_points=None)

Build a sample of a 1D sublattice of a given Bravais lattice along a specified primitive vector and including vectors with a maximum norm given by a cut off.

basis_vectors2D array-like

primitive vectors of the lattice. The i-th vector is basis_vectors[:,i].

cut_offfloat

Maximum norm of vectors included in the sample

directionint, by default 0

primitive vector along which the 1D sample is build

special_pointsdictionary, optional

dictionary associating strings to sample elements

Sample

The 1D sublattice

plot(**kwargs)

Plot the sample using matplotlib.

tuple

plot of the sample and basis vectors

NotImplementedError

If lattice_dimension is not 1 or 2

classmethod sample(basis_vectors, denominator, integer_coords, special_points=None)

Calls the __init__ method.

save(file_name, sample_name, file_format='hdf5')

Save the sample to file.

file_namestring or path

name of the file

sample_namestring

name of the sample

file_formatstr, optional

file format, by default ‘hdf5’. Only hdf5 available.