Skip to content

test_dl

Main file for testing cognitive state decoding models

get_fold_paths(base_path)

Return sorted fold directories under the provided evaluation path.

Source code in src/run/single_run/test_dl.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def get_fold_paths(base_path: Path) -> list[Path]:
    """Return sorted fold directories under the provided evaluation path."""
    fold_paths: list[Path] = []
    for path in base_path.glob('fold_index=*'):
        if not path.is_dir():
            continue
        try:
            int(path.name.split('=')[1])
        except (IndexError, ValueError):
            logger.warning(f'Skipping unexpected directory {path.name}')
            continue
        fold_paths.append(path)
    fold_paths.sort(key=lambda p: int(p.name.split('=')[1]))
    return fold_paths