Guidance on Using mne-connectivity Package for My Dataset

I’m currently working with a dataset that has the following structure:

             time           S1               S2              S3                  S4                 S5  \

0 0.000000 539.003281 0.993903 1033.296087 847.307383 1.219820
1 0.009975 539.003281 0.994111 1033.296468 847.306651 1.220583
2 0.020127 539.003281 0.994742 1033.298021 847.305112 1.221355
3 0.028523 539.003281 0.994617 1033.300754 847.303250 1.221988
4 0.035569 539.003281 0.994054 1033.304396 847.301288 1.222514
… … … … … … …
57996 499.963557 539.003053 0.993961 1031.312946 847.487703 1.217045
57997 499.974002 539.003054 0.994419 1031.119268 847.486371 1.217833
57998 499.981499 539.003054 0.994068 1030.985983 847.484937 1.218404
57999 499.988995 539.003054 0.993907 1030.857807 847.483105 1.218977
58000 499.995820 539.003055 0.993811 1030.745792 847.481095 1.219500

          S6                  S7                 S8  

0 434.040605 159.445996 1.196984e+09
1 434.040634 159.445989 1.197189e+09
2 434.040727 159.445973 1.197441e+09
3 434.040865 159.445953 1.197659e+09
4 434.041031 159.445933 1.197849e+09
… … … …
57996 434.000702 159.453090 1.195325e+09
57997 433.999854 159.452497 1.195681e+09
57998 433.999347 159.452058 1.195936e+09
57999 433.998927 159.451606 1.196194e+09
58000 433.998620 159.451184 1.196430e+09

            S1                      S2                       S3                    S4                   S5  \

count 58001.000000 58001.000000 58001.000000 58001.000000 58001.000000
mean 539.003016 0.994206 1033.293424 847.305469 1.219500
std 0.000427 0.000309 2.552520 0.128927 0.008623
min 539.000167 0.993811 1029.127139 847.030722 1.207305
25% 539.003061 0.993945 1030.761892 847.177030 1.210877
50% 539.003073 0.994067 1033.293851 847.304607 1.219500
75% 539.003126 0.994418 1035.861418 847.434463 1.228123
max 539.003325 0.994858 1038.649413 847.489982 1.231695

               S6                      S7                    S8 

count 58001.000000 58001.000000 5.800100e+04
mean 434.039444 159.446159 1.196938e+09
std 0.028477 0.008751 3.936919e+06
min 433.998128 159.432551 1.191369e+09
25% 434.011303 159.437825 1.193002e+09
50% 434.039509 159.446069 1.196934e+09
75% 434.067880 159.454050 1.200868e+09
max 434.112882 159.499354 1.202540e+09

The dataset includes time series like S1, S2, S3, and others. However, this data is not MEG, EEG, or iEEG, and I am unsure if the mne-connectivity package would apply to my dataset.

I have a few specific questions:

  1. Would scaling and normalizing my data be necessary, and if so, what method would you recommend (e.g., min-max, z-scaling)?

  2. Given that my data isn’t in the EEG/MEG domain, what would be the definition of “event” and “epoch” for my dataset?

  3. Are there any specific methods or preprocessing steps (such as using a linear model like the auto-regressive model) that you would suggest based on the characteristics of my dataset?

Hello,

However, this data is not MEG, EEG, or iEEG, and I am unsure if the mne-connectivity package would apply to my dataset.

So first off, MNE supports several other data types beyond MEG, EEG or iEEG (see here: Glossary — MNE 1.8.0 documentation), but also many of the tools in MNE-Connectivity are agnostic to the specific type, as long as it’s timeseries data.

As for your specific questions:

  1. Would scaling and normalizing my data be necessary, and if so, what method would you recommend (e.g., min-max, z-scaling)?

Normalisation isn’t necessarily required, e.g. coherence gives you a normalised connectivity score in the range [0, 1]. I would base this more on whether other steps in your pipeline require normalised data.


  1. Given that my data isn’t in the EEG/MEG domain, what would be the definition of “event” and “epoch” for my dataset?

If this is just continuous data (i.e., no events/trials), you can just divide the data into continuous epochs. MNE has the make_fixed_length_epochs() function to help with this (see also this tutorial: Divide continuous data into equally-spaced epochs — MNE 1.8.0 documentation). 2-second-long epochs is often a good choice for connectivity analyses.


  1. Are there any specific methods or preprocessing steps (such as using a linear model like the auto-regressive model) that you would suggest based on the characteristics of my dataset?

In terms of pre-processing, I would just recommend general things like artefact rejection (e.g., visual inspection and rejection of bad data spans, removing blink or cardiac artefacts with ICA, etc…), highpass filtering ~1-3 Hz, notch filtering line noise… MNE has lots of tutorials for particular methods here: Preprocessing — MNE 1.8.0 documentation.

For the actual connectivity method, are you interested in directed or non-directed connectivity? A non-directed connectivity metric like coherence will tell you about the similarity of signals, but is invariant to the direction of information flow (more information here: Comparison of coherency-based methods — MNE-Connectivity 0.7.0 documentation). On the other hand, a directed metric like Granger causality tells you about how information flows between signals (see here: Compute directionality of connectivity with multivariate Granger causality — MNE-Connectivity 0.7.0 documentation). Both of these methods can be found in MNE-Connectivity’s spectral_connectivity_epochs() function.

Finally, a lot of the tutorials listed use data stored in Raw or Epochs objects. This tutorial shows how you can take arrays like the one you showed and package them into MNE data objects: Creating MNE-Python data structures from scratch — MNE 1.8.0 documentation.

Hope this helps!
Thomas

Thanks a lot. I found it very helpful.

1 Like