Spectral connectivity outputs NaN

  • MNE version: 0.24.1
  • MNE Connectivity version: 0.2
  • operating system: Ubuntu 20.04

Hi,

I am using the spectral connectivity function mne_connectivity.spectral_connectivity. I run it like this:

con = mne_connectivity.spectral_connectivity(label_ts, 
                                             method=['ciplv', 'pli'], 
                                             mode='multitaper', 
                                             sfreq=raw.info["sfreq"], 
                                             fmin=[8.], 
                                             fmax=[13.], 
                                             faverage=True)

The code runs fine and produces connectivity matrices. However, the ciPLV connectivity matrix contains a significant proportion of NaN values, which disconcerts further analysis. Meanwhile, the PLI connectivity matrix does not contain any NaN values.

After looking at the source code of spectral_connectivity, I came to the conclusion that most likely the cross spectral density somehow gets a zero value for some label pairs (in some epochs).

I’m looking for advice on how to check my data for any artefacts that could cause this issue. For reference, I’m using a large dataset and only a handful of subjects have this issue (10 out of ~600 participants).

Best,
Santeri

Hello,

I’m having the same problem exactly with ‘pli’ as method. From a dataset of ~600 recordings, only in some we get a triangular matrix of NaNs.

Has anybody understood this issue?

Best,
João

Hi João,

This occurs, if some of the data in your dataset is flat. You can use Epochs.drop_bad to remove epochs with flat data. Before you do that, it is probably good to inspect the raw data from the problematic subjects.

Assuming you’re using the Cam-CAN data, there will be a lot of flat data segments for some participants after tSSS with movement compensation is applied.

Best,
Santeri

1 Like