ewoksid16b.for_scripts.filtering.filter_files#

ewoksid16b.for_scripts.filtering.filter_files(dir_path, sample, dataset, detector, scan_numbers)[source]#

Filters HDF5 files and their groups based on directory, sample, dataset, detector, and scan numbers criteria.

Args:

dir_path (str): The root directory path to search. sample (str, list, or None): Sample name(s) or pattern(s) to match in folder names (supports wildcards like *). If None, search all subfolders under dir_path. dataset (str, list, or None): Dataset name(s) to match in subfolder names. If None, all .h5/.hdf5 files are selected. detector (str): Detector name to match as a subgroup in ‘/measurement/’ within the groups. scan_numbers (list, list of lists, or None): Scan numbers to filter HDF5 groups by.

  • If None: No scan filtering.

  • If list of ints: When dataset is not None, each int corresponds to a scan number per dataset.

  • If list of lists: When dataset is not None, each sublist specifies scan numbers for the corresponding dataset.

  • If dataset is None: Only list of ints or None allowed.

Returns:

list: List of tuples, each containing (file_path: str, matching_groups: list[str], selected_scans: list[int]).