Issues with indices argument in spectral_connectivity_time()

MNE version: 1.0.3
Operating system: CentOS Linux 7 (Core)

Hi, I’m trying to use mne_connectivity.spectral_connectivity_time, below is my code:

FREQS = [50, 100, 150, 200, 250]
INDICES = ([0, 0, 0, 0, 0], [1, 2, 3, 4, 5])
con = spectral_connectivity_time( 
        cond_epochs_slice,
        freqs = FREQS,
        indices = INDICES,
        method = 'coh', 
        sfreq = FS, 
        n_jobs = 1)

I keep getting the following error:

elif indices == 'symmetric':
    expected_len = ((n_nodes + 1) * n_nodes) // 2
    if data_len != expected_len:
        raise ValueError(f'If "indices" is "symmetric", then '
                         f'connectivity data should be the '
                         f'upper-triangular part of the matrix. There '
                         f'are {data_len} estimated connections. '
                         f'But there should be {expected_len} '
                         f'estimated connections.')

For some reason it looks like the argument indices is turned into 'symmetric', even if I specify it as a length 2 tuple of arrays, as described in the documentation. I’ve tried simply commenting out the code above that throws the error, but the resulting Connectivity object that is returned in con says its indices are still 'symmetric'. I.e. if I run con.indices the output says 'symmetric'.

Below is the description of the Connectivity object that is returned. The documentation says that it should have shape (n_epochs, n_nodes, n_nodes, n_freqs).

<EpochSpectroTemporalConnectivity | n_epochs : 10, freq : [50.000000, 250.000000], time : [0.000000, 0.250000], , nave : None, nodes, n_estimated : 67, 2, ~983 kB>

On a related note, I’m passing in 5 frequencies into the argument freqs = FREQS, but the description lists only 2 frequencies freq : [50.000000, 250.000000]. If anyone has pointers on that that would also be much appreciated.

this looks like a bug to me. Please try locally changing these lines: mne-connectivity/mne_connectivity/spectral/time.py at e953bfc9039f07fda2e0c0ba9f3fb3b7c649826c · mne-tools/mne-connectivity · GitHub the two instances of indices=indices to indices=indices_use and see if the problem goes away (and of course let us know if that fixes it).

EDIT: I looked a bit more closely at the source, and my earlier suggestion can’t have been correct. I’m actually quite surprised that you’re seeing the error that you mention, could you please post

  1. the output of mne.sys_info()
  2. the actual full terminal traceback showing the error (not a copy-paste of the source code where the error is defined)?