Example of preparing EEG data for usage in mne using glob that I was responsible for coding in my Neural Data Science course group assignment.

Here I use a double nested list comprehension to make a list of subjects with their directories they are located in, using f strings I was able to concatinate to 3 decimal places the data for all 32 potential participants, and then filter that subjects list down by those that were present using k != [] to select for only subarrays that contained contents.

Here is a slightly modified version from my original group assignment: here I specify the path of the subjects fif file that is to be read in, using list slicing I cut from the last 7 characters until the end and concatinate together all other parts of the file location. Using mne.read_evokeds() and passing in the path I obtain the data that is stored for that participant and then pair that data with the subject to store as a dictionary.

The data is now ready for processing and plotting!