Skip to content

Commit

Permalink
Update bst_connectivity.m
Browse files Browse the repository at this point in the history
Specified that wPLI is not the debiased one (see brainstorm-tools#571), and added the debiased version commented below. This until we figure out how to implement the debiased wPLI in time domain
  • Loading branch information
danielemarinazzo authored Sep 20, 2022
1 parent 36c16f4 commit ae88e72
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion toolbox/connectivity/bst_connectivity.m
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@
% An improved index of phase-synchronization for electrophysiological data in the presence of volume-conduction, noise and sample-size bias
% Neuroimage, Apr 2011
% https://pubmed.ncbi.nlm.nih.gov/21276857
% The one below is the "debiased" version
%
% Proposed by Daniele Marinazzo
% R(:,:,iBand) = reshape(mean(sin(angle(HA(iA,:)')-angle(HB(iB,:)')))' ./ mean(abs(sin(angle(HA(iA,:)')-angle(HB(iB,:)'))))',[],nB); % Equivalent to lines below
num = abs(imag(phaseA*phaseB'));
Expand All @@ -606,6 +606,18 @@
end
R(:,:,iBand) = num./den;
Comment = 'wPLI: ';

% This below would be the debiased version, but better leave it commented until we figure how to implement the time-varying one in Brainstorm-friendly way
% Interested users can uncomment this one

%num = imag(phaseA*phaseB');
%den = zeros(nA,nB);sqd = zeros(nA,nB);
%for t = 1:nT
% den = den + abs(imag(phaseA(:,t) * phaseB(:,t)'));
% sqd = sqd + imag(phaseA(:,t)*phaseB(:,t)').^2;
%end
%R(:,:,iBand) = (num.^2-sqd)./(den.^2-sqd);
%Comment = 'wPLI debiased: ';
end
end
% We don't want to compute again the frequency bands
Expand Down

0 comments on commit ae88e72

Please sign in to comment.