Not all data imported from .set files when using read_raw_eeglab()

  • MNE version: 1.6.0
  • operating system: Windows 11

Hello everyone,

I’m new to using python for EEGLAB data and have switched recently from matlab to python in order to analyze sleep spindles with the code provided by GitHub - raphaelvallat/yasa: YASA (Yet Another Spindle Algorithm): a Python package to analyze polysomnographic sleep recordings..

When using matlab, I usually load my data as follows and have access to stages and arousals for each data point according to the structure of my data as follows:

EEG = pop_loadset('myfile.set', 'myfilepath')
stages = EEG.swa_scoring.stages
arousals = EEG.swa_scoring.arousals

,where stages and arousals are arrays containing integers.

While I can load EEG data without problems in python via:
EEG = mne.io.read_raw_eeglab('myfile.set', preload=True, verbose=False) and also perform analysis with it, I cannot find my staging and arousals information anymore/it seems to not have been imported. I checked with EEG.info.keys() if I could maybe find “swa_scoring” but this wasn’t the case.

I would be grateful for some help!
Kind regards,
Armando

The fields you mention are non-standard, and therefore we do not consider them during import. I suggest that you manually load your .set files using scipy.io.loadmat() to access those fields.

1 Like

Thank you for the answer!
If anyone ever experiences the same problem, the somewhat awkward analogous code to access EEG.swa_scoring.stages via scipy was:

all_data = scipy.io.loadmat('myfile.set')
stages = all_data['EEG'][0]['swa_scoring'][0]['stages']
stages_simplified = stages [0][0][0] #to get just the array of integers
3 Likes