Hi Brainstorm,

We are scripting corticocortical connectivity (CCC, computed as lagged Coh) and corticomuscular coherence (CMC, also lagged Coh). How do we determine what the frequency resolution for each computation is?

Thank you,

Adam

Hi Brainstorm,

We are scripting corticocortical connectivity (CCC, computed as lagged Coh) and corticomuscular coherence (CMC, also lagged Coh). How do we determine what the frequency resolution for each computation is?

Thank you,

Adam

The frequency resolution depends on the **sampling frequency** (`fs`

) and the **number of samples used in the FFT** (`nFFT`

) , as

`freq_resolution = fs / nFFT`

`fs`

comes from the recordings, and`nFFT`

is the smallest power of two that is greater than or equal to the number of samples in the analysis window.

Using the data from the **corticomuscular coherence tutorial** (link below) as example:

Coherence is computed using **1-s trials** with a sampling frequency of **1200 Hz**. As such, there are 1200 samples per trial, and the next power of 2 for this is 2024, thus, the frequency resolution is `1200 Hz / 2048 samples =`

`0.5859 Hz`

https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence

Thanks Raymundo.

Could there possibly be a difference in frequency resolution between CCC coh and CMC coh using the same computation?

All our data (EEG, EMG) eventually has the same sampling frequency (1000Hz). Since this is held constant, it seems like the `nFFT`

is the only option for being different between the two metrics.

One of our scripts calls the `process_cohere1n`

function (CCC) and the other calls the `process_cohere2`

function (CMC) from Brainstorm; could this be where a difference if frequency resolution is found? For both scripts, the Morlet settings seem to be identical, so i'm confused as to where the difference could be. Any help would be appreciated.

Thank you!

Adam

Which are the **time-frequency decomposition** method and its **Options** that are being used for both processes?

Can it be that the time window is different?

@Raymundo.Cassani, here's our script *(I deleted part of the scripts for brevity in this post)* denoting the time freq decomposition method and respective options for **CCC**:

```
sFiles = bst_process('CallProcess', 'process_cohere1n', sFiles, [], ...
...
'cohmeasure', 'lcohere2019', ...
'tfmeasure', 'morlet', ... % Morlet wavelets
'tfedit', struct(...
'Comment', 'Complex,1-60Hz', ...
'TimeBands', [], ...
'Freqs', [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], ...
'MorletFc', 1, ...
'MorletFwhmTc', 3, ...
'ClusterFuncTime', 'none', ...
'Measure', 'none', ...
'Output', 'all', ...
'RemoveEvoked', 0, ...
'SaveKernel', 0), ...
'timeres', 'none', ... % Full (requires epochs)
'avgwinlength', 1, ...
'avgwinoverlap', 50, ...
'outputmode', 'input'); % separately for each file
```

and for **CMC**:

```
sFiles = bst_process('CallProcess', 'process_cohere2', sFiles, sFiles2, ...
...
'dest_sensors', char(emg_channels(iEMG)), ...
'includebad', 1, ...
'removeevoked', 0, ...
'cohmeasure', 'lcohere2019', ...
'tfmeasure', 'morlet', ...
'tfedit', struct(...
'Comment', 'Complex,1-60Hz', ...
'TimeBands', [], ...
'Freqs', [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], ...
'MorletFc', 1, ...
'MorletFwhmTc', 3, ...
'ClusterFuncTime', 'none', ...
'Measure', 'none', ...
'Output', 'all', ...
'RemoveEvoked', 0, ...
'SaveKernel', 0), ...
'timeres', 'none', ... % None
'avgwinlength', 1, ...
'avgwinoverlap', 50, ...
'outputmode', 'input'); % separately for each file
```

Adam

It does look good.

- Is the input
`sFiles`

the same for both processes? - Does
`sFiles2`

and`sFiles`

have the same sampling frequency, and same time window? - What is the difference that you are finding?
- Do you have the same behaviour in the GUI?

Hey Raymundo,

Sorry for the delay. With our data, we have `fs`

= 1000Hz and 2s analysis windows, thus `nFFT`

= 2048, meaning that `freq_resolution`

for us using the above formula is 1000Hz / 2048 = about 0.4883Hz. Just curious: is this the frequency resolution, or the max possible frequency resolution?

I'm asking because in the code I showed above, I told Brainstorm to analyze frequencies of 8, 9, 10, 11, 12Hz...and so on..., making me think that our frequency resolution would be 1Hz instead of the 0.4883Hz above.

Could you please clarify what the difference is between the formula you provided compared to the frequencies I provide Brainstorm for analysis?

Regarding your questions:

- As far as I am aware,
`sFiles`

is identical between the processes. `sFiles`

&`sFiles2`

all have the same sampling rate and time window: 1000Hz & 2s windows, respectively.- I'm not yet sure if there is a difference. I'm trying to figure that out, or if there was outdated/incorrect documentation we found on our side. Just trying to confirm that they are the same between CCC and CMC.
- GUI testing: Could you please clarify on how I could check if I were having this behavior in the GUI? I know how to implement all the settings into the GUI, but I'm wondering how to check the results.

Thank you!

Adam