DataUtils.XrLoader#

DataUtils.XrLoader.py

load_xr(folder_path)#

Load X-ray scattering data from a folder containing .dat files.

Parameters:

folder_path (str) – Path to the folder containing .dat files.

Returns:

  • xr_array (np.ndarray) – 3D array containing the X-ray scattering data.

  • datafiles (list of str) – List of data file paths corresponding to the loaded data.

Notes

The function assumes that each .dat file contains data in a format compatible with np.loadtxt. The first dimension corresponds to the number of files, the second to the number of points, and the third to the data columns.

xr_remove_bubbles(xr_array, logger=None, debug=False)#

Remove bubbles from the XR data array.

Parameters:
  • xr_array (np.ndarray) – 3D array containing the X-ray scattering data.

  • logger (logging.Logger, optional) – Logger for logging messages. If None, print to console.

  • debug (bool, optional) – If True, enable debug mode with additional output.

load_xr_with_options(folder_path, remove_bubbles=False, logger=None, debug=False)#

Load X-ray scattering data from a folder with options to preprocess.

Parameters:
  • folder_path (str) – Path to the folder containing .dat files.

  • remove_bubbles (bool, optional) – If True, remove bubbles from the data, by default False.

  • logger (logging.Logger, optional) – Logger for logging messages. If None, print to console.

  • debug (bool, optional) – If True, enable debug mode with additional output, by default False.

Returns:

  • xr_array (np.ndarray) – 3D array containing the X-ray scattering data.

  • datafiles (list of str) – List of data file paths corresponding to the loaded data.