torch_ecg.utils.get_record_list_recursive3

torch_ecg.utils.get_record_list_recursive3(db_dir: str | bytes | PathLike, rec_patterns: str | Dict[str, str], relative: bool = True) List[str] | Dict[str, List[str]][source]

Get the list of records in a recursive manner.

For example, there are two folders “patient1”, “patient2” in db_dir, and there are records “A0001”, “A0002”, … in “patient1”; “B0001”, “B0002”, … in “patient2”, then the output would be “patient1{sep}A0001”, …, “patient2{sep}B0001”, …, sep is determined by the system.

Parameters:
  • db_dir (path-like) – The parent (root) path of to search for records.

  • rec_patterns (str or dict) – Pattern of the record filenames, e.g. "A(?:\d+).mat", or patterns of several subsets, e.g. {"A": "A(?:\d+).mat"}

  • relative (bool, default True) – Whether to return the relative path of the records.

Returns:

The list of records, in lexicographical order.

Return type:

List[str] or dict