Basis#

class cbclib.Basis(a_vec, b_vec, c_vec)[source]#

An indexing solution, defined by a set of three unit cell vectors.

Parameters
  • a_vec (ndarray) – First basis vector.

  • b_vec (ndarray) – Second basis vector.

  • c_vec (ndarray) – Third basis vector.

contents()#

Return a list of the attributes stored in the container that are initialised.

Return type

List[str]

Returns

List of the attributes stored in the container.

generate_hkl(q_abs)[source]#

Return a set of reflections lying inside of a sphere of radius q_abs in the reciprocal space.

Parameters

q_abs (float) – The radius of a sphere in the reciprocal space.

Return type

ndarray

Returns

An array of Miller indices, that lie inside of the sphere.

get(attr, value=None)#

Retrieve a dataset, return value if the attribute is not found.

Parameters
  • attr (str) – Data attribute.

  • value (Optional[Any]) – Data which is returned if the attribute is not found.

Return type

Any

Returns

Attribute’s data stored in the container, value if attr is not found.

classmethod import_ini(ini_file)#

Initialize the container object with an INI file ini_file.

Parameters

ini_file (str) – Path to the ini file.

Return type

~I

Returns

A new container with all the attributes imported from the ini file.

classmethod import_matrix(mat)[source]#

Return a new Basis object, initialised by a stacked matrix of three basis vectors.

Parameters

mat (ndarray) – A matrix of three stacked basis vectors.

Return type

Basis

Returns

A new Basis object.

classmethod import_spherical(mat)[source]#

Return a new Basis object, initialised by a stacked matrix of three basis vectors written in spherical coordinate system.

Parameters

mat (ndarray) – A matrix of three stacked basis vectors in spherical coordinate system.

Return type

Basis

Returns

A new Basis object.

items()#

Return (key, value) pairs of the datasets stored in the container.

Return type

ItemsView

Returns

(key, value) pairs of the datasets stored in the container.

keys()#

Return a list of the attributes available in the container.

Return type

List[str]

Returns

List of the attributes available in the container.

lattice_constants()[source]#

Return lattice constants \(a, b, c, \alpha, \beta, \gamma\). The unit cell length are unitless.

Return type

ndarray

Returns

An array of lattice constants.

reciprocate()[source]#

Calculate the basis of the reciprocal lattice.

Return type

Basis

Returns

The basis of the reciprocal lattice.

replace(**kwargs)#

Return a new container object with a set of attributes replaced.

Parameters

kwargs (Any) – A set of attributes and the values to to replace.

Return type

~D

Returns

A new container object with updated attributes.

static str_to_list(strings)#

Convert strings to a list of strings.

Parameters

strings (Union[str, List[str]]) – String or a list of strings

Return type

List[str]

Returns

List of strings.

to_ini(ini_file)#

Save all the attributes stored in the container to an INI file ini_file.

Parameters

ini_file (str) – Path to the ini file.

to_spherical()[source]#

Return a stack of unit cell vectors in spherical coordinate system.

Return type

ndarray

Returns

A matrix of three stacked unit cell vectors in spherical coordinate system.

values()#

Return the attributes’ data stored in the container.

Return type

ValuesView

Returns

List of data stored in the container.