Given a directory containing the following files:
pcasvm_dataset_window_blackman_nperseg_4096_distance_1_speed_25k
pcasvm_dataset_window_blackman_nperseg_4096_distance_2_speed_25k
pcasvm_dataset_window_blackman_nperseg_8192_distance_1_speed_100k
pcasvm_dataset_window_blackman_nperseg_16384_distance_1_speed_200k
pcasvm_dataset_window_hamming_nperseg_4096_distance_1_speed_25k
pcasvm_dataset_window_hamming_nperseg_8192_distance_5_speed_25k
pcasvm_dataset_window_hann_nperseg_4096_distance_1_speed_25k
...
I can read these in with the following comprehension: datasets = [d for d in os.listdir('path/to/dir')]
However, what I want to do is analyse these datasets in group, with the groups being:
window (i.e. blackman, hann) and nperseg (i.e. 8192, 4096, etc.)
The problem here is how to best achieve this fairly quickly given a large number of actual datasets.
Would a dictionary be ideal?
For example:
dict(
blackman: dict(
4096: [file1, file2, file3],
8192: [..., ],
...
),
...
)