bcdi.xcca: X-ray cross-correlation analysis

xcca_utils

This module provides methods to calculate the angular cross-correlation function for a 3D reciprocal space dataset measured in forward CDI geometry.

API Reference

Functions related to reciprocal space averaging and XCCA.

XCCA stands for X-ray cross-correlation analysis.

bcdi.xcca.xcca_utils.angular_avg(data, q_values, mask=None, origin=None, nb_bins=numpy.nan, debugging=False)

Calculate an angular average of a 3D reciprocal space dataset.

It needs q values and the position of the origin of the reciprocal space.

Parameters:
  • data – 3D reciprocal space data gridded in the orthonormal frame (qx downstream, qz vertical up, qy outboard)

  • q_values – tuple of 3 1-D arrays: (qx downstream, qz vertical up, qy outboard)

  • mask – 3D array of the same shape as data. 1 for a masked voxel, 0 otherwise

  • origin – position in pixels of the origin of the reciprocal space

  • nb_bins – number of points where to calculate the average

  • debugging – True to see plots

Returns:

q_axis, angular mean average, angular median average

bcdi.xcca.xcca_utils.calc_ccf_polar(point, q1_name, q2_name, bin_values, polar_azi_int)

Cross-correlate intensities at two q values, in polar coordinates.

It calculates the cross-correlation of point with all other points at the second q value and sort the result.

Parameters:
  • point – the reference point

  • q1_name – key for the first q value in the dictionnary polar_azi_int

  • q2_name – key for the second q value in the dictionnary polar_azi_int

  • bin_values – in radians, angular bin values where to calculate the cross-correlation

  • polar_azi_int – a dictionnary with fields ‘q1’, ‘q2’, … Each field contains three 1D arrays: polar angle, azimuthal angle and intensity values for each point

Returns:

the sorted cross-correlation values, angular bins indices and number of points contributing to the angular bins

bcdi.xcca.xcca_utils.calc_ccf_rect(point, q1_name, q2_name, bin_values, q_int)

Cross-correlate intensities at two q values, in cartesian coordinates.

It calculates the cross-correlation of point with all other points at the second q value and sort the result.

Parameters:
  • point – the reference point

  • q1_name – key for the first q value in the dictionnary polar_azi_int

  • q2_name – key for the second q value in the dictionnary polar_azi_int

  • bin_values – in radians, angular bin values where to calculate the cross-correlation

  • q_int – a dictionnary with fields ‘q1’, ‘q2’, … Each field contains four 1D arrays: qx, qy, qz and intensity values for each point

Returns:

the sorted cross-correlation values, angular bins indices and number of points contributing to the angular bins