xrdtools package

xrdtools module

xrdtools.read_xrdml(filename)[source]

Load a Panalytical XRDML file.

Parameters:filename (str) – The filename of the xrdml file to be loaded.
Returns:A dictionary with all relevant data of the measurement.
Return type:dict

xrdtools.io module

xrdtools.io.read_xrdml(filename)[source]

Load a Panalytical XRDML file.

Parameters:filename (str) – The filename of the xrdml file to be loaded.
Returns:A dictionary with all relevant data of the measurement.
Return type:dict
xrdtools.io.validate_xrdml_schema(filename)[source]

Validate the xml schema of a given file.

Parameters:filename (str) – The Filename of the .xrdml file to test.
Returns:Returns the version number as float or None if the file was not matching any provided xml schema.
Return type:float or None

xrdtools.utils module

xrdtools.utils.angle2qvector(tt, om, lam=1.54)[source]

Convert angles to q vector.

Calculate the q-vector from the 2theta tt and omega om angle and the x-ray wavelength lambda lam.

Parameters:
  • tt (array-like) – Array containing the 2Theta values.
  • om (array-like) – Array containing the Omega values.
  • lam (float) – The wavelength lambda in Angstrom [Default: 1.54].
Returns:

  • kpar (ndarray)
  • kperp (ndarray)

xrdtools.utils.angles(hkl, lam=1.54, lattice_param=(3.905, 3.905, 3.905))[source]

Compute the angle for a given hkl position.

Compute the 2Theta, Omega and Delta angle for a given hkl point, wavelength lambda and unit cell lattice parameters.

Parameters:
  • hkl (dict) – A dictionary containing the hkl values.
  • lam (float) – The wavelength lambda in Angstrom. Defaults to 1.54.
  • lattice_param (tuple) – A tuple of three floats for the lattice parameter.
Returns:

  • tt (ndarray)
  • omega (ndarray)
  • delta (ndarray)

xrdtools.utils.get_qmap(data, omega_offset=0)[source]

Function to calculate kpar, kperp.

Parameters:
  • data (dict) – A xrdml data dictionary.
  • omega_offset (float) – Offset for the omega angle.
Returns:

  • kpar (ndarray)
  • kperp (ndarray)

xrdtools.utils.q2hkl_map(x, y, lattice_params=(3.905, 3.905, 3.905), hkl=None)[source]

Compute the hk coordinates for a given q vector.

Parameters:
  • x (ndarray) –
  • y (ndarray) –
  • lattice_params (tuple) – A tuple of three floats for the lattice parameter.
  • hkl (dict) – A dictionary containing the hkl values. Defaults to 001 if not given [Default: None].
Returns:

  • x (ndarray)
  • y (ndarray)