diffcalc.ub.fitting

Fit crystal lattice and U matrix to reflection data.

A module implementing fitting routines for refining crystal lattice parameters and U matrix using reflection data.

Functions

fit_crystal(crystal, refl_list)

Fit crystal lattice parameters to reference reflections.

fit_u_matrix(init_u, crystal, refl_list)

Fit crystal lattice parameters to reference reflections.

diffcalc.ub.fitting.fit_crystal(crystal: Crystal, refl_list: List[Reflection]) Crystal[source]

Fit crystal lattice parameters to reference reflections.

Parameters:
  • crystal (Crystal) – Object containing initial crystal lattice parameter estimates.

  • refl_list (List[Reflection]) – List or reference reflection objects.

Returns:

Object containing refined crystal lattice parameters.

Return type:

Crystal

Raises:

DiffcalcException – If crystal lattice object not initialised.

diffcalc.ub.fitting.fit_u_matrix(init_u: ndarray, crystal: Crystal, refl_list: List[Reflection]) ndarray[source]

Fit crystal lattice parameters to reference reflections.

Parameters:
  • init_u (np.ndarray) – Initial U matrix as (3, 3) NumPy array.

  • crystal (Crystal) – Object containing initial crystal lattice parameter estimates.

  • refl_list (List[Reflection]) – List or reference reflection objects.

Returns:

NumPy array with refined U matrix elements.

Return type:

np.ndarray

Raises:

DiffcalcException – If U matrix is not initialised.