tbplas.ParamFit

class tbplas.ParamFit(k_points: ndarray, weights: ndarray = None)

Class for fitting on-site energies and hopping parameters to reference band data.

_k_points

FRACTIONAL coordinates of the k-points corresponding to the band data

Type:

(num_kpt, 3) float64 array

_bands_ref

copy of reference band data

Type:

(num_kpt, num_orb) float64 array

_weights

weights of each band during fitting process

Type:

(num_orb,) float64 array

__init__(k_points: ndarray, weights: ndarray = None) None
Parameters:
  • k_points – (num_kpt, 3) float64 array FRACTIONAL coordinates of the k-points

  • weights – (num_orb,) float64 array weights of each band for fitting

Raises:

ValueError – if length of weights does not match band data

Methods

__init__(k_points[, weights])

param k_points:

(num_kpt, 3) float64 array

calc_bands_fit(params)

Method for calculating fitted band data from given parameters.

calc_bands_ref()

Method for calculating reference band data.

estimate_error(params)

Object function for minimizing the error between reference and fitted band data.

fit(params0, **kwargs)

Fit the parameters to reference band data.

__init__(k_points: ndarray, weights: ndarray = None) None
Parameters:
  • k_points – (num_kpt, 3) float64 array FRACTIONAL coordinates of the k-points

  • weights – (num_orb,) float64 array weights of each band for fitting

Raises:

ValueError – if length of weights does not match band data

abstract calc_bands_fit(params: ndarray) ndarray

Method for calculating fitted band data from given parameters.

Parameters:

params – parameters to fit

Returns:

(num_kpt, num_orb) float64 array band data of the model built from parameters

abstract calc_bands_ref() ndarray

Method for calculating reference band data.

Returns:

(num_kpt, num_orb) float64 array reference band data

estimate_error(params: ndarray) ndarray

Object function for minimizing the error between reference and fitted band data.

Parameters:

params – parameters to fit

Returns:

flattened difference between band data

fit(params0: ndarray, **kwargs) ndarray

Fit the parameters to reference band data.

Parameters:
  • params0 – initial value of parameters to fit

  • kwargs – keyword parameters for the ‘leastsq’ function of scipy

Returns:

the optimal parameters after fitting

Raises:

RuntimeError – if the fitting fails

__weakref__

list of weak references to the object (if defined)