defdap.crystal_utils module

defdap.crystal_utils.create_l_matrix(a, b, c, alpha, beta, gamma, convention=None)[source]

Construct L matrix based on Page 22 of Randle and Engle - Introduction to texture analysis

defdap.crystal_utils.create_q_matrix(l_matrix)[source]

Construct matrix of reciprocal lattice vectors to transform plane normals See C. T. Young and J. L. Lytton, J. Appl. Phys., vol. 43, no. 4, pp. 1408–1417, 1972.

defdap.crystal_utils.convert_idc(in_type, *, dir=None, plane=None)[source]

Convert between Miller and Miller-Bravais indices.

Parameters:
  • in_type (str {'m', 'mb'}) – Type of indices provided. If ‘m’ converts from Miller to Miller-Bravais, opposite for ‘mb’.

  • dir (tuple of int or equivalent, optional) – Direction to convert. This OR plane must me provided.

  • plane (tuple of int or equivalent, optional) – Plane to convert. This OR direction must me provided.

Returns:

The converted plane or direction.

Return type:

tuple of int

defdap.crystal_utils.equavlent_indicies(crystal_symm, symmetries, *, dir=None, plane=None, c_over_a=None, in_type=None)[source]
defdap.crystal_utils.project_to_orth(c_over_a, *, dir=None, plane=None, in_type='mb')[source]

Project from crystal aligned coordinates to an orthogonal set.

Parameters:
  • in_type (str {'m', 'mb'}) – Type of indices provided

  • dir (tuple of int or equivalent, optional) – Direction to convert. This OR plane must me provided.

  • plane (tuple of int or equivalent, optional) – Plane to convert. This OR direction must me provided.

defdap.crystal_utils.pos_idc(vec)[source]

Return a consistent positive version of a set of indices.

Parameters:

vec (tuple of int or equivalent) – Indices to convert.

Returns:

Positive version of indices.

Return type:

tuple of int

defdap.crystal_utils.reduce_idc(vec)[source]

Reduce indices to lowest integers

Parameters:

vec (tuple of int or equivalent) – Indices to reduce.

Returns:

The reduced indices.

Return type:

tuple of int

defdap.crystal_utils.safe_int_cast(vec, tol=0.001)[source]

Cast a tuple of floats to integers, raising an error if rounding is over a tolerance.

Parameters:
  • vec (tuple of float or equivalent) – Vector to cast.

  • tol (float) – Tolerance above which an error is raised.

Return type:

tuple of int

Raises:

ValueError – If the rounding is over the tolerance for any value.

defdap.crystal_utils.idc_to_string(idc, brackets=None, str_type='unicode')[source]

String representation of a set of indicies.

Parameters:
  • idc (collection of int) –

  • brackets (str) – String of opening and closing brackets eg ‘()’

  • str_type (str {'unicode', 'tex'}) –

Return type:

str

defdap.crystal_utils.str_idx(idx, str_type='unicode')[source]

String representation of an index with overbars.

Parameters:
  • idx (int) –

  • str_type (str {'unicode', 'tex'}) –

Return type:

str