Question about tutorial: The Raw data structure: continuous data

  • MNE version: 1.5.0
  • operating system: Ubuntu 20.04

I am studing the tutorial: The Raw data structure: continuous data. I ran a part of this tutorial:

eeg_channel_indices = mne.pick_types(raw.info, meg=False, eeg=True)
eeg_data, times = raw[eeg_channel_indices]
print(eeg_data.shape)

then I got:

(58, 36038)

That’s means there are 58 eeg. But I ran another part of this tutorial:

sampling_freq = raw.info["sfreq"]
start_end_secs = np.array([10, 13])
start_sample, stop_sample = (start_end_secs * sampling_freq).astype(int)
df = raw.to_data_frame(picks=["eeg"], start=start_sample, stop=stop_sample)
# then save using df.to_csv(...), df.to_hdf(...), etc
print(df.head())

then I got:

        time  ...       EEG_060
0   9.999750  ...  6.952283e+08
1  10.001415  ...  7.069226e+08
2  10.003080  ...  7.080921e+08
3  10.004745  ...  7.010755e+08
4  10.006410  ...  7.069226e+08

[5 rows x 60 columns]

That’s means there are 59 eeg. Why they are different?

Hello,

raw.to_data_frame() includes bad channels by default, while mne.pick_types() excludes them. Since one channel is marked as bad in raw.info["bads"], this explains your difference in channel counts.

Best wishes,
Richard

3 Likes

I see. Think you very much.