Hi,
I computed NxN PTE from 100 surface scouts. When I export the connectivity matrix to matlab, I don’t get a connectivity matrix, but instead a 10000x1 vector (TF). This vector can be reshaped easily to regain the connectivity matrix. However, since PTE is a directed measure of connectivity, the matrix is not mirrorsymmetric. Therefore, I would like to know the organisation of the TF vector.

Is it:
SeedA - TargetA
SeedA - TargetB
…
SeedA - TargetZ
SeedB - TargetA
…

or rather
SeedA - TargetA
SeedB - TargetA
SeedC - TargetA
…

Thanks a lot!
Sebastian

1 Like

Hi Sebastian,

To get the connectivity matrix correctly formatted, you can do the following:

Read the file timefreq_connect…mat into the variable TfMat, or right-click > File > Export to Matlab > “TfMat”
R = bst_memory(‘GetConnectMatrix’, TfMat);
The matrix R is the connectivity matrix [signalsA x signalsB x Frequencies]
The frequency bins are described in the TfMat.Freqs: R(:,:,1) is frequency TfMat.Freqs(1)
For details on the algorithm, see directly the process function process_compress_sym.m

Cheers,
Francois

sklaral
October 14, 2020, 3:24am
#3
Another question about PTE data. Is the phase-lag variable stored somewhere in the .mat file or just the PTE values?

Thanks

Only the PTE data.
You can check how this is done directly in the code:

% Get frequency bands
nFreqBands = size(OPTIONS.Freqs, 1);
BandBounds = process_tf_bands('GetBounds', OPTIONS.Freqs);
% Intitialize returned matrix
R = zeros(size(sInputA.Data,1), size(sInputB.Data,1), nFreqBands);
% Loop on each frequency band
for iBand = 1:nFreqBands
% Band-pass filter in one frequency band + Apply Hilbert transform
DataAband = process_bandpass('Compute', sInputA.Data, sfreq, BandBounds(iBand,1), BandBounds(iBand,2), 'bst-hfilter-2019', OPTIONS.isMirror);
% Compute PTE
[dPTE, PTE] = PhaseTE_MF(permute(DataAband, [2 1]));
if OPTIONS.isNormalized
R(:,:,iBand) = dPTE;
R(:,:,iBand) = R(:,:,iBand) - 0.5; % Center result around 0
else
R(:,:,iBand) = PTE;
end
end
% We don't want to compute again the frequency bands
FreqBands = [];