[FieldTrip] Fwd: Adjacency matrix for debiased weighted phase lag index
Tyler Durdern
ty_du at gmx.de
Tue Mar 7 15:25:22 CET 2023
Dear all,
I asked this question but I did not receive a response yet:
> I computed the debiased weighted phase lag index for all channel combinations of a 30-channel EEG resting state recording. The output file (wpli_debiasedspctrm) has the following dimensions (435x30). I subsequently averaged the file across the second dimension to get an average debiased wpli estimate across the frequency band of interest. Now, I want to put this estimate into an adjacency matrix format (30x30) so I can illustrate the connectivity matrix using e.g. imagesc in Matlab. Is there a way I can achieve this in fieldtrip?
I tried a few approaches in the mean time but I cannot seem to get the results I want. Using a 30-channel EEG recording, I expect a 900x30 output variable corresponding to wpli values for all possible channel combinations (even identical ones) per frequency in both directions (e.g. Cz-Fz and Fz-Cz). I tried to achieve this using ft_channelcombination and although this yields the correct channel combinations, it doesn’t change the wpli output. Looking into the code
I found that this is probably due to the fact that my data is bivariate and the code states that „ This only has an effect when the input data
is univariate“.
Here is the code I’ve used so far:
> % Define the resampling parameters
> cfg = [];
> cfg.resamplefs = 125;
>
> % Resample the data
> ft_data_rs = ft_resampledata(cfg, ft_data);
>
> % Cut data into multiple trials
> cfg = [];
> cfg.length = 1; % 1 sec. segments
> cfg.overlap = 0;
> ft_data_rs_seg = ft_redefinetrial(cfg, ft_data_rs);
>
> % Freq analysis I
> cfg = [];
> cfg.method = 'mtmfft'; % use multitaper frequency transformation
> cfg.output = 'powandcsd'; % compute power spectrum and cross-spectral density
> cfg.taper = 'dpss'; % use DPSS taper window
> cfg.foi = 1:30; % frequency range of interest
> cfg.keeptrials = 'yes'; % average over trials
> cfg.channel = 'all'; % use all channels
> cfg.trials = 'all'; % use all trials
> cfg.tapsmofrq = 8; % specify the smoothing parameter for DPSS
> cfg.pad = 'nextpow2'; % should increase computation speed
> freq=ft_freqanalysis(cfg,ft_data_rs_seg);
>
> % Define the connectivity parameters
> cfg = [];
> cfg.method = 'wpli_debiased';
> cfg.channelcmb = {'all' 'all'};
> cfg.complex = 'abs';
>
> wpli_data = ft_connectivityanalysis(cfg, freq);
To summarize: I would like to compute debiased wpli for all channels (even identical ones) in both directions. Further, I would like to store
the debiased wpli output in a 30x30 adjacency/connectivity matrix.
As I am still quite new to FieldTrip I am stuck here and I would really appreciate your help on this issue.
Thanks in advance and all the best,
Tyler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230307/842fdff5/attachment.htm>
More information about the fieldtrip
mailing list