Datasets:

Modalities:
Audio
Libraries:
Datasets
File size: 1,702 Bytes
e8eaad6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os

def count_fif_files(root_dir="split_fifs"):
    """
    Count total number of .fif files in directory and its subdirectories.
    Also provides counts per subdirectory.
    """
    # Total count of .fif files
    total_fif_count = 0
    # Dictionary to store counts per subdirectory
    subdir_counts = {}
    
    # Walk through all directories
    for dirpath, dirnames, filenames in os.walk(root_dir):
        # Count .fif files in current directory
        fif_files = [f for f in filenames if f.endswith('.raw.fif')]
        count = len(fif_files)
        
        if count > 0:
            # Get relative path for cleaner output
            rel_path = os.path.relpath(dirpath, root_dir)
            if rel_path == '.':
                rel_path = root_dir
            subdir_counts[rel_path] = count
            total_fif_count += count
    
    # Print results
    print(f"\nTotal number of .fif files: {total_fif_count}")
    print("\nBreakdown by directory:")
    print("-" * 50)
    
    # Sort by directory name and print counts
    for dir_name, count in sorted(subdir_counts.items()):
        print(f"{dir_name}: {count} files")
    
    # Additional statistics
    print("\nSummary:")
    print(f"Number of directories with .fif files: {len(subdir_counts)}")
    if subdir_counts:
        avg_files = total_fif_count / len(subdir_counts)
        print(f"Average files per directory: {avg_files:.2f}")
        max_dir = max(subdir_counts.items(), key=lambda x: x[1])
        print(f"Directory with most files: {max_dir[0]} ({max_dir[1]} files)")
    
    return total_fif_count, subdir_counts

if __name__ == "__main__":
    # Run the count
    total, counts = count_fif_files()