Segmentation.find_files#

Segmentation.find_files(folder, template, suffixes)[source]#

Find files split by segmentation in given folder.

Checks if files exist with the generated filename and if any are missing performs more in-depth search to find them. In-depth search finds all files in folder and checks if the filename contains all required segment parameters.

Parameters:
  • folder (Path) – Folder to search within, doesn’t look in sub-folders.

  • template (str) – Template for filenames, will be formatted with the slice name so should contain “{slice_name}”. File extension shouldn’t be included e.g “test” instead of “test.csv”.

  • suffixes (collections.abc.Sequence[str]) – File extensions (suffixes) to search for, will find the first matching file.

Returns:

Files found for each slice (value), with the slice parameters (key).

Return type:

dict[SegmentationSlice, Path]

Raises:
  • FileNotFoundError – If a file cannot be found for all possible segments.

  • FileExistsError – If multiple files are found for the same slice when performing more in-depth search.

Warns:

RuntimeWarning – If any additional unexpected files are found during the in-depth search.