40 Hz audiovisual stimulation improves sustained attention and related brain oscillations.
The 13 matches · 4 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Results › 40 Hz flicker is correlated with decreases in delta activity during a vigilance task ↔ EEG Analysis/S4_ALLSubjects_NoCut_NoNotch_2_100hz.m, lines 4300–4333 · score 0.87 · 13–30 Hz, 30–37 Hz, 8–13 Hz, 39–41 Hz, power spectral densities, 1–4 Hz
- [2] § Results › 40 Hz flicker increases low-alpha functional connectivity which is correlated with better behavior performance ↔ EEG Analysis/S4_ALLSubjects_NoCut_NoNotch_2_100hz.m, lines 2058–2100 · score 0.78 · 10–13 Hz, top quartile, upper alpha, lower alpha, 8–10 Hz, channel pairs
- [3] § Results › 40 Hz flicker increases low-alpha functional connectivity which is correlated with better behavior performance ↔ EEG Analysis/S4_ALLSubjects_NoCut_NoNotch_2_100hz.m, lines 2058–2100 · score 0.75 · 10–13 Hz, top quartile, upper alpha, lower alpha, 8–10 Hz, channel pair
- [4] § Results › 40 Hz flicker is correlated with decreases in delta activity during a vigilance task ↔ EEG Analysis/S4_ALLSubjects_NoCut_NoNotch_2_100hz.m, lines 3178–3220 · score 0.74 · 30–37 Hz, 8–13 Hz, 39–41 Hz, power spectral density, 4–8 Hz, PSD
- [5] § Methods › EEG data analyses ↔ EEG Analysis/S3_CompletePreprocessing.m, lines 14–46 · score 0.70 · high pass filter, EEGLAB, 4 seconds, preprocessed, ICA, epochs
- [6] § Methods › EEG data analyses ↔ EEG Analysis/Functions/GenMatCode-main/Numeric/SignalProcessing/power/welchSpecLuTrial.m, the whole file · a weak match · score 0.67 · Signal Processing, power spectral density, Welch, overlapping, windows
- [7] § Methods › EEG data analyses ↔ EEG Analysis/Functions/GenMatCode-main/Numeric/SignalProcessing/GT_welchPsdTrial.m, the whole file · a weak match · score 0.67 · Signal Processing, power spectral density, Welch, overlapping, windows
- [8] § Methods › Statistical approach ↔ EEG Analysis/Functions/GenMatCode-main/Statistics/ANOVAandMixEffect/myfriedman.m, lines 1–83 · score 0.65 · Kruskal Wallis, Post hoc, ANOVA, mixed, alpha
- [9] § Methods › EEG data analyses ↔ EEG Analysis/S0_ConvertBDFtoSet_and_Preprocess_for_Syncing.m, lines 14–44 · score 0.61 · high pass filter, 4 seconds, preprocessed, ICA, epochs, noise
- [10] § Methods › EEG data analyses ↔ EEG Analysis/Functions/GenMatCode-main/Numeric/SignalProcessing/wpli_TrialIndex.m, the whole file · a weak match · score 0.60 · weighted phase lag, volume conduction, WPLI, connectivity, signal
- [11] § Results › 40 Hz flicker increases low-alpha functional connectivity which is correlated with better behavior performance ↔ EEG Analysis/S4_ALLSubjects_NoCut_NoNotch_2_100hz.m, lines 1745–1808 · score 0.56 · High functional connectivity, alpha band, channel pairs, permutation, frequency band, WPLI
- [12] § Results › 40 Hz flicker improved accuracy and reaction time in a vigilance task ↔ EEG Analysis/Functions/GenMatCode-main/Statistics/ANOVAandMixEffect/myfriedman.m, lines 1–83 · score 0.56 · Kruskal Wallis, post hoc, rank, sum
- [13] § Results › 40 Hz flicker increases low-alpha functional connectivity which is correlated with better behavior performance ↔ EEG Analysis/Functions/GenMatCode-main/Numeric/SignalProcessing/wpli_TrialIndex.m, the whole file · a weak match · score 0.55 · Weighted Phase Lag, volume conduction, WPLI, connectivity
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 4,365 lines · 195 KB · no license · 5 matches
- %% Step 4 - Does PSD. (derived from Step2_WPLI by Lu Z)TrialType
- % Must add GenMatCode-main and all subfolders to path before running
- S4Start = tic;
- currDate = strrep(datestr(datetime), ':', '_');
- currDate = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- scriptName = mfilename;
- %% Load All EEGs
- % LoadPath='Y:\singer\LuZhang\Project6-EEG\Results\Step0-PreparingData\';
- cd("2_CheckSync_Outputs\")
- %% Get newest file
- newestFolder = getNewestFolder();
- %cd(newestFolder);
- %newestEEGData = getNewestFile(); % Automatically gets the newest .mat file in folder
- %newestEEGData=
- %% Select file to load
- inputDatafile = '01-Apr-2024 13_38_57EEGDataStep2CheckSyncOutput.mat' %#ok<NOPTS> % can replace variable with hardcoded EEG file
- tic
- load(inputDatafile)
- %load('01-Apr-2024 13_38_57EEGDataStep2CheckSyncOutput.mat')
- %% Create folder
- disp(['EEG data loaded:', inputDatafile])
- toc
- % load('02-Feb-2024 17_46_26EEGData4EyeBlinkRemoval.mat')
- cd ..
- %cd ..
- SaveFolder=['4_COH\' currDate '_' scriptName];
- mkdir(SaveFolder);
- save([SaveFolder '\Step4DataInputSummary.mat'],'inputDatafile','currDate','scriptName')
- %% Create output text
- %Generate output message
- SummaryTextOutput='';
- % if isempty(SummaryTextOutput)
- % SummaryTextOutput = 'None';
- % end
- SummaryTextOutput = sprintf('Step4 started on %s\nScript used: %s \n', currDate, scriptName);
- SummaryTextOutput = sprintf('%s \nInput dataset: %s \n', SummaryTextOutput, inputDatafile);
- % SummaryTextOutput = sprintf('%s \n%d out of %d files synced:\n%s', SummaryTextOutput, iCsv, nCsv, subjectsList);
- % endDateAndTime = char(datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss'));
- % endDuration = toc(tStart);
- % SummaryTextOutput = sprintf('%s\nStep1Syncing completed at: %s\nSyncing duration: %g seconds.', SummaryTextOutput, endDateAndTime, endDuration);
- % Add toc
- %Display the output message in the command window
- disp(SummaryTextOutput);
- %Create a .txt file with the output message
- filePath = fullfile(SaveFolder, [scriptName, currDate '_Summary.txt']);
- fileID = fopen(filePath, 'w');
- if fileID == -1
- error('Failed to open or create the file: %s', filePath);
- else
- fprintf(fileID, '%s', SummaryTextOutput);
- fclose(fileID);
- fprintf('File created and written: %s\n', filePath);
- end
- %% Set Channels, Locations for Heatmap
- % (Necessary if already done in Step 0?)
- channels = {'Fp1', 'AF3', 'F7', 'F3', 'FC1', 'FC5', 'T7', 'C3', 'CP1', 'CP5', 'P7', 'P3', 'Pz', 'PO3', 'O1', 'Oz', 'O2', 'PO4', 'P4', 'P8', 'CP6', 'CP2', 'C4', 'T8', 'FC6', 'FC2', 'F4', 'F8', 'AF4', 'Fp2', 'Fz', 'Cz', 'EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8'};
- EEGchInd=1:32;
- EEGch=channels(EEGchInd);
- ChNTotal=length(channels);
- NeedFields={'labels','theta','radius'};
- tempN=fieldnames(EEGList{1}.chanlocs);
- tempN1=tempN;
- tempN2=tempN;
- tempN1([1 2 11 12])=[];
- NeedI=setdiff(1:length(tempN),[1 2 12]);
- tempN2([2 12])=[];
- ChanPos=FieldName2Struct(tempN1);
- TempTable=cell2table(squeeze(struct2cell(EEGList{1}.chanlocs)));
- ChInd=table2array(cell2table(table2array(TempTable(11,:))));
- IndEx=find(ChInd>=33);
- ChIndWritten=[];
- DataTemp=zeros(length(tempN1),length(EEGchInd))+nan;
- for iFile=1:length(EEGList)
- TempTable=cell2table(squeeze(struct2cell(EEGList{iFile}.chanlocs)));
- ChI=table2array(cell2table(table2array(TempTable(11,:))));
- IndEx=find(ChI>=33);
- Invalid=find(ChI>=33);
- ChIndV=ChI;
- ChIndV(Invalid)=[];
- TempTable(:,Invalid)=[];
- InforAdd=TempTable;
- InforAdd([1 2 11 12],:)=[];
- [ChAdd,I1]=setdiff(ChIndV,ChIndWritten);
- temp=table2array(cell2table(table2array(InforAdd)));
- DataTemp(:,ChAdd)=temp(:,I1);
- ChIndWritten=find(isnan(DataTemp(1,:))==0);
- if length(ChIndWritten)==length(EEGchInd)
- break
- end
- end
- for ifield=1:length(tempN1)
- ChanPos=setfield(ChanPos,{1,1},tempN1{ifield},DataTemp(ifield,:));
- end
- ChanPos.labels=EEGch;
- ChanEEGLab=rmfield(ChanPos,'labels');
- tempName=fieldnames(ChanEEGLab);
- for iCh=1:length(EEGchInd)
- for iN=1:length(tempName)
- dataTemp=getfield(ChanPos,{1},tempName{iN});
- ChanEEGLab=setfield(ChanEEGLab,{1,iCh},tempName{iN},dataTemp(iCh));
- end
- ChanEEGLab(iCh).labels=EEGch{iCh};
- ChanEEGLab(iCh).urchan=iCh;
- end
- %% Assign Condition Groups *** Run to set GroupName
- FlickerSubj{4}=[20:27 30:33 44:51 53 55:58 62:64 66:69 71:73 75 77:81 83:87]; % All control subjects (Random and Light) no cuts
- GroupName{4}='BothControls'; % 'BothControls' = Random and Light together. previously 'Random' or 'Light'
- FlickerSubj{5}=[20:27 30:33 44:51 53 55:58 62:63 66 68 69 71:73 75 77:81 83:87]; % All control subjects minus 64 and 67 (for RT)
- GroupName{5}='BothControlsRT'; % 'BothControls' = Random and Light together. previously 'Random' or 'Light'
- FlickerSubj{1}=[10:19 34:42 52 54 59:61 65 70 74 76 82]; % SubjID of 40Hz group.
- GroupName{1}='40Hz';
- FlickerSubj{2} = [62:64 66:69 71:73 75 77:81 83:87]; % All SubjID for Light Group (no cuts)
- GroupName{2}='Light';
- FlickerSubj{3}=[20:27 30:33 44:51 53 55:58]; % SubjID of Random flicker group
- GroupName{3} = 'Random';
- FlickerSubj{6} = [62:63 66 68 69 71:73 75 77:81 83:87]; % All SubjID for Light Group for RT (removed s064 and s067 due to incorrect average RTs
- GroupName{6}='LightRT'; % No 64 67 for WPLI vs RT
- % Updated Groups (includes 2023 EEGs)
- % FlickerSubj{1}=[20:28 30:33 45 48:50 56:58]; % (20 total) SubjID of Random flicker group (Accuracy cuts)
- % FlickerSubj{2}=[10:19 39 40 52 54 59 60 74 76 82]; % (20 total) % SubjID of 40Hz group. Newest 40 Hz EEGs added (2023) (Accuracy Cut
- % FlickerSubj{3}=[]; % check if ID is still matching
- %% Get Accuracies for all subjects
- Acc=zeros(length(FileStruct),1)+nan;
- SubjsAvgRT = zeros(length(FileStruct),1)+nan;
- for iFile=1:length(FileStruct)
- if ~isempty(FileStruct(iFile).Subj)
- %% May need to uncomment out the below
- SubjID(iFile) = str2num(FileStruct(iFile).Subj(end-1:end));
- Acc(iFile)=length(FileStruct(iFile).hits)/(length(FileStruct(iFile).hits)+length(FileStruct(iFile).misses));
- %% Calculate Avg RT per subject using data found in FileStruct->dotsynch
- isHit = (FileStruct(iFile).dotsynch(:,3)==1); % get logical index for all trials that are Hits (misses and premature hits will = 0)
- colorchangeTimes = FileStruct(iFile).dotsynch(isHit,1); % get time of color change for Hit trials only
- subjRTtimes = FileStruct(iFile).dotsynch(isHit,2); % get RT time for Hit trials (this should ignore premature hits)
- subjRTduration = subjRTtimes - colorchangeTimes; % subtract RT time from color change time to get duration of RT (AKA the reaction time)
- subjRTdurInSecs = subjRTduration/512; % sample rate is generally 512 samples per second
- SubjsAvgRT(iFile) = mean(subjRTdurInSecs);
- end
- end
- %% SubjG assignment for WPLI calculation
- SubjG{1}=[];
- SubjG{2}=[];
- SubjG{3}=[];
- SubjG{4}=[];
- SubjG{5}=[];
- SubjG{6}=[];
- [~,SubjG{1},~]=intersect(SubjID,FlickerSubj{1}); % 40Hz
- [~,SubjG{2},~]=intersect(SubjID,FlickerSubj{2}); % Light
- [~,SubjG{3},~]=intersect(SubjID,FlickerSubj{3}); % Random
- [~,SubjG{4},~]=intersect(SubjID,FlickerSubj{4}); % Both Controls
- [~,SubjG{5},~]=intersect(SubjID,FlickerSubj{5}); % BothControlsRT
- [~,SubjG{6},~]=intersect(SubjID,FlickerSubj{6}); % LightRT
- %% Set Trial Groups (Hit, Miss, Etc.)
- ChCount=[];
- ChIndList={};
- TrialType{1}=1; %%%%%Hit trial
- TrialType{2}=0; %%%%%Miss trial
- TrialType{3}=[0 1]; %%%%%All trial
- % TrialType{4}=-1; %%%%%Premature trial
- TrialTypeName{1}='Hit'; %%%%%Hit trial
- TrialTypeName{2}='Miss'; %%%%%Miss trial
- TrialTypeName{3}='HitAndMiss'; %%%%%All trial
- % TrialTypeName{4}='Premature'; %%%%%Premature trial
- %% PSD parameters
- psdParameter.Fs=512;
- psdParameter.window=1024; % can increase window to 1024 from 512 8/18/24 - less smoth, but higher res
- psdParameter.noverlap = psdParameter.window/2; % can change overlap to 256 or half window size
- psdParameter.nfft=1024; % decrease nfft from 1024 to 512 - less smooth but decrease resolution
- nFre=psdParameter.nfft/2+1; % modified pwelch see Lu genmat code on git
- %% Epoch, Samp Rate, Make Save Trial Folder
- % (When is data epoched? What if data is already epoched from preprocessing)
- DataTimeRange=[-4 1]; %%%4 seconds before color-change and 1s after.
- AnaRange=[-4 0]; %%4s before color-change
- % AnaRange=[0 1]; %%1s after color change
- SampRate=512;
- SampI=(AnaRange-DataTimeRange(1))*SampRate;
- SampI=SampI(1)+1:SampI(2);
- % clear CohGroup
- parfor iFile=1:length(EEGList)
- ChTempN(iFile)=size(EEGList{iFile}.AllChData,1);
- end
- SavePath = ['4_COH\' currDate '_' scriptName '\'];
- if ~exist(SavePath, 'dir')
- mkdir(SavePath)
- end
- %% Get coherence for all pairs of channels PER SUBJECT!
- % This takes a looong time! (Data from here goes in TrialCrossSpec)
- % SaveTrialSubj='Y:\singer\LuZhang\Project6-EEG\Results\Step2-COH\TrialCrossSpec\';
- SaveTrialSubj=['4_COH\' currDate '_' scriptName '\TrialCrossSpec\'];
- mkdir(SaveTrialSubj);
- parpool(12)
- tic
- for iFile=1:length(EEGList)
- SaveTemp=[SaveTrialSubj EEGList{iFile}.filename(1:4) '\'];
- mkdir(SaveTemp);
- if ~isempty(EEGList{iFile})
- ChTempN=size(EEGList{iFile}.AllChData,1);
- TrialTypeTemp=EEGList{iFile}.TrialType;
- TrialI=[];
- %% Calculate for pair of channels
- tic
- for iCh=1:ChTempN
- for jCh=iCh:ChTempN
- clear TempTrial1 tempSig1 TempTrial2 tempSig2 TrialSpec
- tempSig1=squeeze(EEGList{iFile}.AllChData(iCh,SampI,:));
- tempSig2=squeeze(EEGList{iFile}.AllChData(jCh,SampI,:));
- if sum(sum(isnan(tempSig1)))>1||sum(sum(isnan(tempSig2)))>1
- continue
- end
- % tic
- for iTrial=1:length(TrialTypeTemp) % loop by trial
- if length(TrialTypeTemp)>1
- TempTrial1(iTrial).Data=tempSig1(:,iTrial);
- TempTrial2(iTrial).Data=tempSig2(:,iTrial);
- else
- TempTrial1(iTrial).Data=tempSig1;
- TempTrial2(iTrial).Data=tempSig2;
- end
- TempTrial1(iTrial).Time=([1:length(TempTrial1(iTrial).Data)]-1)/512;
- TempTrial2(iTrial).Time=([1:length(TempTrial2(iTrial).Data)]-1)/512;
- end
- % clear TrialSpec
- %%%Old version to calculate CrossSpec,tested equal to
- %%%new version
- % [TrialSpec1.Sxy,TrialSpec1.Sxx,TrialSpec1.Syy,TrialSpec1.w,TrialSpec1.options,ValidIndex]=coh_TrialData(TempTrial1,TempTrial2,psdParameter);
- %%%Old version to calculate CrossSpec,tested equal to
- % %%%new version
- % psdParameter.noverlap=500;
- % psdParameter.nfft=512;
- % psdParameter.window=512;
- % nFre=psdParameter.nfft/2+1;
- [TrialSpec.Sxy,TrialSpec.Sxx,TrialSpec.Syy,TrialSpec.w,TrialSpec.options,ValidIndex]=crossspec_EqualTriL(TempTrial1,TempTrial2,psdParameter); %% find in genmat code
- save([SaveTemp 'Ch' num2str(iCh) 'Ch' num2str(jCh) '.mat'],'TrialSpec','ValidIndex','psdParameter');
- % a=crossspec_Trial(TrialSpec);
- % figure;
- % plot(a.Fre,abs(((a.wpli))))
- % figure;
- % plot(a.Fre,abs(mean((a.wpli(1:30,:)))))
- % figure;
- % plot(a.Fre,abs(mean((a.wpli(1:30,:)))))
- % figure;
- % plot(TempTrial1(4).Data);hold on;plot(TempTrial2(4).Data,'r.')
- for iTrialType=1:length(TrialType) % group: hit, miss, etc.
- TrialI=[];
- parfor j=1:length(TrialType{iTrialType})
- TrialI=union(TrialI,find(TrialTypeTemp==TrialType{iTrialType}(j)));
- end
- TrialI=intersect(TrialI,ValidIndex);
- if ~isempty(TrialI)
- % CohGroup{iGroup,iFile}{iCh,jCh}=Coh_TrialIndex(TrialSpec1,TrialI);
- CohGroup{iTrialType,iFile}{iCh,jCh}=crossspec_TrialIndex(TrialSpec,TrialI);
- %% %confirmed Old and New version of Cross-Spectrum results in same coherence results.
- % D1=Coh_TrialIndex(TrialSpec1,TrialI);
- % D2=crossspec_TrialIndex(TrialSpec,TrialI);
- % figure;
- % plot(D1.Fre,(D1.Cxy));hold on;
- % plot(D2.Fre,(D2.Cxy),'r.');hold on;c
- %%%confirmed Old and New version of Cross-Spectrum results in same coherence results.
- end
- end
- % toc
- %% figure;
- % Temp=CohGroup{1,iFile}{iCh,jCh};
- % subplot(2,1,1)
- % plot(Temp.Fre,(Temp.Cxy));
- % subplot(2,1,2)
- %
- % plot(Temp.Fre,log(abs(Temp.Pxx)));
- % hold on;
- % plot(Temp.Fre,log(abs(Temp.Pyy)));
- end
- end
- toc
- end
- end
- toc
- % Check if everything above works ***
- %% Save workspace to be used for Step 5: WPLITrial Group. This step takes a long time, creates 20gb file!
- COHSaveFileName =['COHdata_forWPLITrialType_' currDate '_' scriptName '.mat'];
- COH_Save_Path = [SavePath COHSaveFileName];
- save(COH_Save_Path,'-v7.3') % Check this
- % load(COH_Save_Path) % loading should not be necessary as all variables in workspace should be in that save file
- %% For visualization - Set-up - Must run before plotting anything below
- % (of what? COH,WPLI and PSD?)
- load('chanPosColin27');
- %
- Fre=CohGroup{1,1}{1,2}.Fre; % may need to import CohGroup from a COHdata file
- FBand=[2 100]; % consider changing [1 100] to [2 100] due to normalization
- FreInd=find(Fre>=FBand(1)&Fre<=FBand(2));
- Fplot=Fre(FreInd);
- PSDall=zeros(length(FileStruct),length(FreInd),ChNTotal,length(TrialType))+nan;
- COHall=zeros(length(FileStruct),length(FreInd),ChNTotal,ChNTotal-1,length(TrialType))+nan;
- WPLIall=zeros(length(FileStruct),length(FreInd),ChNTotal,ChNTotal-1,length(TrialType))+nan;
- %
- for iTrialType=1:length(TrialType)
- for iFile=1:length(FileStruct)
- for iCh=1:size(CohGroup{iTrialType,iFile},1)
- for jCh=iCh+1:size(CohGroup{iTrialType,iFile},2)
- if isempty(CohGroup{iTrialType,iFile}{iCh,jCh})
- continue;
- end
- if iCh==1
- PSDall(iFile,:,iCh,iTrialType)=CohGroup{iTrialType,iFile}{iCh,jCh}.Pxx(FreInd);
- PSDall(iFile,:,jCh,iTrialType)=CohGroup{iTrialType,iFile}{iCh,jCh}.Pyy(FreInd);
- end
- COHall(iFile,:,iCh,jCh,iTrialType)=CohGroup{iTrialType,iFile}{iCh,jCh}.Cxy(FreInd);
- WPLIall(iFile,:,iCh,jCh,iTrialType)=CohGroup{iTrialType,iFile}{iCh,jCh}.wpli(FreInd);
- end
- end
- end
- end
- %% Peak Alpha WPLI Distribution Histogram
- % Get all alpha values
- alphaLowerLimitFreqHz = 8;
- alphaUpperLimitFreqHz = 13;
- % Find indices of values in Fre between 8 and 13 (inclusive)
- allAlphaFreIndices = find(Fre >= alphaLowerLimitFreqHz & Fre <= alphaUpperLimitFreqHz);
- HitMissTrialType = 3;
- WPLIallAlpha = squeeze(WPLIall(:,allAlphaFreIndices,1:32,1:32,HitMissTrialType)); % size(WPLIall) ans = 67 197 40 39 3- 67subs x allFreqs x iCh x jCh x TrialType
- % Find the peak value within alpha (dimension 2)
- [peakAlphaValues, peakAlphaIndices] = max(WPLIallAlpha, [], 2);
- % Reshape the result to 3D
- PeakWPLIallAlpha = squeeze(peakAlphaValues);
- %% Plot distribution of PeakWPLIallAlpha
- % Flatten PeakWPLIallAlpha to 1D for distribution analysis
- PeakWPLIallAlphaFlat = PeakWPLIallAlpha(:);
- % Remove NaN values
- PeakWPLIallAlphaFlat = PeakWPLIallAlphaFlat(~isnan(PeakWPLIallAlphaFlat));
- % Calculate the total number of data points (channel pairs)
- nDataPoints = numel(PeakWPLIallAlphaFlat);
- % Compute top percentiles
- top25Percent = prctile(PeakWPLIallAlphaFlat, 75);
- top10Percent = prctile(PeakWPLIallAlphaFlat, 90);
- top5Percent = prctile(PeakWPLIallAlphaFlat, 95);
- top1Percent = prctile(PeakWPLIallAlphaFlat, 99);
- top0_1Percent = prctile(PeakWPLIallAlphaFlat, 99.9);
- top0_01Percent = prctile(PeakWPLIallAlphaFlat, 99.99);
- % Count data points greater than each percentile
- countAbove25Percent = sum(PeakWPLIallAlphaFlat > top25Percent);
- countAbove10Percent = sum(PeakWPLIallAlphaFlat > top10Percent);
- countAbove5Percent = sum(PeakWPLIallAlphaFlat > top5Percent);
- countAbove1Percent = sum(PeakWPLIallAlphaFlat > top1Percent);
- countAbove0_1Percent = sum(PeakWPLIallAlphaFlat > top0_1Percent);
- countAbove0_01Percent = sum(PeakWPLIallAlphaFlat > top0_01Percent);
- % Display the results
- fprintf('Top 25%% WPLI value: %.4f, Data points above: %d\n', top25Percent, countAbove25Percent);
- fprintf('Top 10%% WPLI value: %.4f, Data points above: %d\n', top10Percent, countAbove10Percent);
- fprintf('Top 5%% WPLI value: %.4f, Data points above: %d\n', top5Percent, countAbove5Percent);
- fprintf('Top 1%% WPLI value: %.4f, Data points above: %d\n', top1Percent, countAbove1Percent);
- fprintf('Top 0.1%% WPLI value: %.4f, Data points above: %d\n', top0_1Percent, countAbove0_1Percent);
- fprintf('Top 0.01%% WPLI value: %.4f, Data points above: %d\n', top0_01Percent, countAbove0_01Percent);
- % Plot the histogram of PeakWPLIallAlpha
- figure;
- histogram(PeakWPLIallAlphaFlat, 'Normalization', 'probability', 'BinWidth', 0.02);
- hold on;
- % Add vertical lines for top percentiles
- xline(top25Percent, '--k', 'Top 25%', 'LineWidth', 1.5);
- xline(top10Percent, '--c', 'Top 10%', 'LineWidth', 1.5);
- xline(top5Percent, '--r', 'Top 5%', 'LineWidth', 1.5);
- xline(top1Percent, '--g', 'Top 1%', 'LineWidth', 1.5);
- xline(top0_1Percent, '--b', 'Top 0.1%', 'LineWidth', 1.5);
- xline(top0_01Percent, '--m', 'Top 0.01%', 'LineWidth', 1.5);
- % Label the axes
- xlabel('WPLI');
- ylabel('Fraction');
- % Add a title including the total number of data points
- title(['Distribution of Peak Alpha WPLI (Total data points: ', num2str(nDataPoints), ')']);
- % Improve plot appearance
- grid on;
- % % Display the size of the resulting array
- % disp('Size of the resulting 3D array:');
- % disp(size(PeakWPLIallAlpha));
- %% Plot the histogram of PeakWPLIallAlpha (SuppFig4A MS version)
- % May need to run the previous section first! MKA 2025-03-18
- figure;
- histogram(PeakWPLIallAlphaFlat, 'Normalization', 'probability', 'BinWidth', 0.02);
- hold on;
- % Add vertical lines for top percentiles
- xline(top25Percent, '--k', 'Top 25%', 'LineWidth', 1.5);
- % Label the axes
- xlabel('WPLI');
- ylabel('Fraction');
- % Add a title including the total number of data points
- title(['Distribution of Peak Alpha WPLI (Total data points: ', num2str(nDataPoints), ')']);
- % Improve plot appearance
- grid on;
- saveas(gcf, fullfile('Fig4Panels', 'SuppFig4A_PeakWPLI_Alpha.svg'));
- %% Peak Alpha WPLI 40Hz vs Light ALL CHANNELS (not used) - search "stats preceding fig4D" for signif channels only
- % Find the peak WPLI value within alpha (dimension 2)
- [peakAlphaValues, peakAlphaIndices] = max(WPLIallAlpha, [], 2, "includemissing");
- alphaFreqHz = 8:.5:13;
- % Initialize a copy of peakAlphaIndices
- peakAlphaIndicesNaN = peakAlphaIndices;
- % If all alpha WPLI values are NaN, then set the max index to NaN
- peakAlphaIndicesNaN(all(isnan(WPLIallAlpha),2)) = NaN;
- % Reshape the result to 3D
- PeakAlphaIndicesNaN3D = squeeze(peakAlphaIndicesNaN);
- % % Check with single participant
- % singleparticiantAllChPairPeakAlpha = squeeze(PeakAlphaIndicesNaN3D(1,:,:))
- %
- % % Convert Indices to Correct Corresponding Frequnecy (Hz)
- % % Find valid indices (values between 1 and 11)
- % validIdx = singleparticiantAllChPairPeakAlpha >= 1 & singleparticiantAllChPairPeakAlpha <= 11;
- %
- % % Initialize the output array with NaN, preserving original shape
- % singleallchpfreqs = NaN(size(singleparticiantAllChPairPeakAlpha));
- %
- % % Perform mapping only for valid indices
- % singleallchpfreqs(validIdx) = alphaFreqHz(singleparticiantAllChPairPeakAlpha(validIdx));
- % Convert Indices (3D) to Correct Corresponding Frequncy (Hz)
- validIdx = PeakAlphaIndicesNaN3D >= 1 & PeakAlphaIndicesNaN3D <= 11;
- % Initialize the output array with NaN, preserving original shape
- PeakAlphaFreqs = NaN(size(PeakAlphaIndicesNaN3D));
- % Perform mapping only for valid indices
- PeakAlphaFreqs(validIdx) = alphaFreqHz(PeakAlphaIndicesNaN3D(validIdx));
- % singleallchpfreqs = alphaFreqHz(singleparticiantAllChPairPeakAlpha)
- GroupSubjs_40Hz = 1; % 40Hz group
- GroupSubjs_Light = 6; % LightRT group
- % % Extract Peak Alpha WPLI into groups: 40 Hz & Light
- % % PeakWPLIallAlpha: 67 subs x 32ch x 32ch
- % PeakAlphaWPLI_40HzGroup = PeakWPLIallAlpha(SubjG{GroupSubjs_40Hz},:,:);
- % PeakAlphaWPLI_LightGroup = PeakWPLIallAlpha(SubjG{GroupSubjs_Light},:,:);
- % % single particiapn
- % singledudeWPLIallpair = squeeze(PeakWPLIallAlpha(1,:,:))
- % Extract Peak Alpha WPLI freq into groups: 40 Hz & Light
- % PeakWPLIallAlpha: 67 subs x 32ch x 32ch
- PeakAlphaFreqs_40HzGroup = PeakAlphaFreqs(SubjG{GroupSubjs_40Hz},:,:);
- PeakAlphaFreqs_LightGroup = PeakAlphaFreqs(SubjG{GroupSubjs_Light},:,:);
- % Get average peak alpha WPLI frequncy for each group for all channel pairs
- MeanPeakAlphaFreq_40Hz = squeeze(mean(PeakAlphaFreqs_40HzGroup, 1));
- MeanPeakAlphaFreq_Light = squeeze(mean(PeakAlphaFreqs_LightGroup, 1));
- % Display average peak alpha frequency tables (32x32)
- ChannelLabels = {'Fp1', 'AF3', 'F7', 'F3', 'FC1', 'FC5', 'T7', 'C3', 'CP1', 'CP5', ...
- 'P7', 'P3', 'Pz', 'PO3', 'O1', 'Oz', 'O2', 'PO4', 'P4', 'P8', ...
- 'CP6', 'CP2', 'C4', 'T8', 'FC6', 'FC2', 'F4', 'F8', 'AF4', 'Fp2', 'Fz', 'Cz'};
- fprintf('\nMean Peak Alpha Frequency (40Hz Group):\n');
- disp(array2table(MeanPeakAlphaFreq_40Hz, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- fprintf('\nMean Peak Alpha Frequency (Light Group):\n');
- disp(array2table(MeanPeakAlphaFreq_Light, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- % Flatten both 32 x 32 arrays into two 1D-arrays (492 channel pairs each)
- UpperTriIdx = find(triu(ones(32, 32), 1)); % Indices of upper triangular elements
- FlattenedAlphaFreq_40Hz = MeanPeakAlphaFreq_40Hz(UpperTriIdx);
- FlattenedAlphaFreq_Light = MeanPeakAlphaFreq_Light(UpperTriIdx);
- % Compute average peak alpha frequency across all channel pairs for each group
- AvgPeakAlphaFreq_40Hz = mean(FlattenedAlphaFreq_40Hz);
- AvgPeakAlphaFreq_Light = mean(FlattenedAlphaFreq_Light);
- fprintf('\nAverage Peak Alpha Frequency Across All Channel Pairs:\n');
- fprintf('40Hz Group: %.4f Hz\n', AvgPeakAlphaFreq_40Hz);
- fprintf('Light Group: %.4f Hz\n', AvgPeakAlphaFreq_Light);
- % Test for normality (to decide if t-test or ranksum)
- [H_40Hz, p_40Hz] = kstest(FlattenedAlphaFreq_40Hz);
- [H_Light, p_Light] = kstest(FlattenedAlphaFreq_Light);
- fprintf('\nNormality Test Results:\n');
- fprintf('40Hz Group: H = %d, p = %.16f\n', H_40Hz, p_40Hz);
- fprintf('Light Group: H = %d, p = %.16f\n', H_Light, p_Light);
- % Decide on statistical test
- if H_40Hz == 0 && H_Light == 0
- % Normally distributed: Use independent t-test
- [h_ttest, p_ttest] = ttest2(FlattenedAlphaFreq_40Hz, FlattenedAlphaFreq_Light);
- test_used = 't-test';
- p_value = p_ttest;
- else
- % Non-normally distributed: Use Wilcoxon rank-sum test
- [p_ranksum, h_ranksum] = ranksum(FlattenedAlphaFreq_40Hz, FlattenedAlphaFreq_Light);
- test_used = 'Wilcoxon rank-sum test';
- p_value = p_ranksum;
- end
- % Display results
- fprintf('Statistical Test Used: %s\n', test_used);
- fprintf('p-value: %.16f\n', p_value);
- % Perform one-sided Wilcoxon rank-sum test
- [p_ranksum_right, h_ranksum_right] = ranksum(FlattenedAlphaFreq_40Hz, FlattenedAlphaFreq_Light, 'tail', 'right');
- [p_ranksum_left, h_ranksum_left] = ranksum(FlattenedAlphaFreq_40Hz, FlattenedAlphaFreq_Light, 'tail', 'left');
- % Display results
- fprintf('\nOne-Sided Wilcoxon Rank-Sum Test Results:\n');
- fprintf('H0: 40Hz <= Light | p-value (right-tailed, 40Hz > Light): %.16f\n', p_ranksum_right);
- fprintf('H0: 40Hz >= Light | p-value (left-tailed, 40Hz < Light): %.16f\n', p_ranksum_left);
- % Create Violin plots showing distribution
- % Create figure
- figure;
- hold on;
- % Combine data for violin plot
- groupLabels = [repmat({'40Hz'}, length(FlattenedAlphaFreq_40Hz), 1); ...
- repmat({'Light'}, length(FlattenedAlphaFreq_Light), 1)];
- data = [FlattenedAlphaFreq_40Hz; FlattenedAlphaFreq_Light];
- % Create violin plot
- violinplot(data, groupLabels);
- % Format plot
- title('Violin Plot of Peak Alpha Frequency');
- ylabel('Peak Alpha Frequency (Hz)');
- xlabel('Group');
- ylim([8 13]); % Set y-axis range from 8 Hz to 13 Hz
- grid on;
- hold off;
- %% PSD related parameters
- LogPSDraw=log(abs(PSDall));
- NoiseInd=find(Fplot>=58&Fplot<=62);
- NormBandI=setdiff(1:length(Fplot),NoiseInd);
- PSDall=PSDall./repmat(nansum(PSDall(:,NormBandI,:,:),2),1,length(Fplot),1,1);
- LogPSD=log(abs(PSDall));
- PlotColor2=[1 0 0;0 0 1];
- % ParamPSD.ANOVAstats='Anova';
- ParamPSD.PlotType=3;
- ParamPSD.SigPlot='Anova';
- ParamPSD.SigPlot='Ttest';
- ParamPSD.CorrName='fdr'; %%%methold for multi-compairson
- ParamPSD.Q=0.1;
- ParamPSD.Ytick=[0 0.002 0.004];
- ParamPSD.LegendShow=0;
- ParamPSD.Legend=[];
- ParamPSD.TimeRepeatAnova=1;
- ParamPSD.GroupRepeatAnova=0;
- ParamPSD.RepeatAnova=0;
- ParamPSD.TimeCol=Fplot;
- ParamPSD.Paired=1;
- ParamPSD.BinName='Fre';
- ParamPSD.Bin=Fplot;
- ParamPSD.TimeComparison=0;
- ParamPSD.statisP=1; % 1 to do stats and plot. 0 will do stats, but not plot, will be faster. Uses R. If error, set as 0
- ParamPSD.Ytick=[-8:4:0];
- ParamPSD.Crit_p=0.05;
- % One color for ea of the 3 groups. Blue for 40, Gold/yellow/orange for Light, Red for Random
- FlickerColor=[31 125 184; 219 129 50; 150 27 27]/255;
- FlickerColor=[31 125 184; 150 27 27; 219 129 50]/255; %40, Random, Light
- % FlickerColor=[0.5 0.5 0.5;0.9 0.1 0.3];
- load('Functions\GenMatCode-main\Plotfun\Color\colorMapPN.mat')
- load('Functions\GenMatCode-main\Plotfun\Color\colorMapPNraw.mat')
- %% WPLI - Weight Phase Lag Index - Parameters
- ParamWPLI=ParamPSD;
- ParamWPLI.Ytick= [0:0.1:0.2]; %#ok<NBRAK2>
- SubSaveWPLI=[SavePath 'WPLI\'];
- ParamWPLI.SigPlot='Anova';
- mkdir(SubSaveWPLI)
- ParamWPLI.statisP=1;
- P.xLeft=0.01; %%%%%%Left Margin
- P.xRight=0.01; %%%%%%Right Margin
- P.yTop=0.01; %%%%%%Top Margin
- P.yBottom=0.01; %%%%%%Bottom Margin
- P.xInt=0.005; %%%%%%Width-interval between subplots
- P.yInt=0.005; %%%%%%Height-interval between subplots
- %% WPLI - Weight Phase Lag Index - Calculation *** Fig4b - this takes a long time
- WPLIStimGroupIndices = [1 3 6]; % 1=40, 3=Random, 6=LightRT
- SubjGWPLI = SubjG(WPLIStimGroupIndices); % Which three groups to include
- GroupNameWPLI = GroupName(WPLIStimGroupIndices);
- todayDate = datestr(now, 'yymmdd');
- for iTrialType=3%1:length(TrialType)
- SaveTemp=[SubSaveWPLI todayDate '\' TrialTypeName{iTrialType} '\'];
- mkdir(SaveTemp)
- SubSaveFig=[SaveTemp 'Chan\'];
- mkdir(SubSaveFig)
- % CH-Ch WPLI plot.tif figure;
- iPlot=0;
- alphaPeakAmplitudeList = zeros(length(EEGchInd),length(EEGchInd),length(SubjGWPLI));
- alphaPeakFrequencyList = zeros(length(EEGchInd),length(EEGchInd),length(SubjGWPLI));
- % alphaPeakAmplitudeListEmpty = double.empty(length(EEGchInd),length(EEGchInd),length(SubjG),0)
- for iCh=1:length(EEGchInd)
- for jCh=iCh+1:length(EEGchInd)
- clear DataPlot
- for iStimGroup=1:length(SubjGWPLI)
- DataPlot{iStimGroup}= squeeze(WPLIall(SubjGWPLI{iStimGroup},:,EEGchInd(iCh),EEGchInd(jCh),iTrialType));
- Invalid=isnan(DataPlot{iStimGroup}(:,1));
- DataPlot{iStimGroup}(Invalid,:)=[];
- end
- if isempty(DataPlot{1})||isempty(DataPlot{2})
- continue;
- end
- iPlot=iPlot+1;
- subplotLU(length(EEGchInd),length(EEGchInd),iCh,jCh,P);
- ParamWPLI.PathSave=[SaveTemp 'Light40Rand' EEGch{iCh} '-' EEGch{jCh}];
- % [~,COHComStatis{iCom,iCh,jCh}]=RateHist_GroupPlot(Fplot,DataPlot,FlickerColor,ParamCOH);
- tic
- RateHist_GroupPlot(Fplot,DataPlot,FlickerColor,ParamWPLI);
- % toc
- text(50,ParamWPLI.Ytick(end),[EEGch{iCh} '-' EEGch{jCh}]);
- set(gca,'xlim',FBand,'xtick',[0:20:120],'xticklabel',[],'yticklabel',[]);
- end
- end
- %% Permutation to set WPLI threshold ***fig4bc
- % Create "significant" WPLI threhold curve using permutation of current channel pair data.
- % -MKA 2024-12-11
- %Set up save folder
- saveDate = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- SaveTemp=[SaveTrialSubj 'WPLIPermutation_' saveDate '\'];
- mkdir(SaveTemp);
- % Define parameters
- nPermutations = 10000; % Number of permutations, 10k or 1mil
- nSubjs = length(SubjID); % total number of subjects in analysis
- % Define the frequency range of interest: 2-55Hz and every half frequency inbetween
- % frequencies = [2:0.5:55]; % start at 1 or 2 hz? Cut off before 60 Hz
- % Pre-allocate storage for maximum WPLI curves across frequencies
- % WPLIperms = zeros(nPermutations, length(frequencies));
- % WPLIallPerm=zeros(length(FileStruct),length(FreInd),ChNTotal,ChNTotal-1,length(TrialType))+nan;
- %% Preallocate CohGroupPerm as a cell array
- CohGroupPerm = cell(3, nPermutations);
- % Begin permutations
- tStartPerm = tic;
- for iPermutation = 1:nPermutations
- % Step 1: Randomly select two subjects and a channel pair
- randSubjs = randperm(nSubjs, 2); %randomly choose a random Subject A and Subject B from all three groups.
- SubAInd = randSubjs(1);
- SubAData = EEGList{1,SubAInd};
- SubBInd = randSubjs(2);
- SubBData = EEGList{1,SubBInd};
- randChs = randperm(32,2); %randomly choose a chan Chi from subject i, Chj for subject j
- Chi = randChs(1);
- Chj = randChs(2);
- % Step 2: Find the lower number of trials between the two selected subjects
- nTrials_SubA = SubAData.trials;
- nTrials_SubB = SubBData.trials;
- minTrials = min(nTrials_SubA, nTrials_SubB);
- minTrialsIndex = 1:minTrials;
- % Step 3: Get `minTrials` from each subject
- clear TempTrial1 DataA TempTrial2 DataB TrialSpec
- DataA=squeeze(SubAData.AllChData(Chi,SampI,minTrialsIndex)); % analog to "tempSigA"
- DataB=squeeze(SubBData.AllChData(Chj,SampI,minTrialsIndex)); % analog to "tempSigB"
- %% Step 4: Calculate WPLI for selected trials
- % WPLIperms(iPermuation, :) = calculateWPLI(DataA, DataB);
- % Preallocate TempTrial1 and TempTrial2 as structure arrays "FOR SPEED"
- TempTrial1(minTrials).Data = []; % Preallocate Data field
- TempTrial1(minTrials).Time = []; % Preallocate Time field
- TempTrial2(minTrials).Data = []; % Preallocate Data field
- TempTrial2(minTrials).Time = []; % Preallocate Time field
- for iTrial=1:minTrials % loop by trial
- if minTrials>1
- TempTrial1(iTrial).Data=DataA(:,iTrial);
- TempTrial2(iTrial).Data=DataB(:,iTrial);
- else
- TempTrial1(iTrial).Data=DataA;
- TempTrial2(iTrial).Data=DataB;
- end
- TempTrial1(iTrial).Time=([1:length(TempTrial1(iTrial).Data)]-1)/512;
- TempTrial2(iTrial).Time=([1:length(TempTrial2(iTrial).Data)]-1)/512;
- end
- [TrialSpec.Sxy,TrialSpec.Sxx,TrialSpec.Syy,TrialSpec.w,TrialSpec.options,ValidIndex]=crossspec_EqualTriL(TempTrial1,TempTrial2,psdParameter); %% find in genmat code
- % save([SaveTemp 'Ch' num2str(Chi) 'Ch' num2str(Chj) '.mat'],'TrialSpec','ValidIndex','psdParameter');
- jTrialType = iTrialType;
- for jTrialType=3%1:length(TrialType) % group: hit, miss, etc.
- %iTrialType hardcoded to 3; 3=Hit&Miss (all trials)
- TrialI=[];
- parfor j=1:length(TrialType{jTrialType}) % starting pool takes time; does this need to be parfor?
- TrialI=union(TrialI,find(TrialTypeTemp==TrialType{jTrialType}(j)));
- end
- TrialI=intersect(TrialI,ValidIndex);
- if ~isempty(TrialI)
- % CohGroup{iGroup,iFile}{iCh,jCh}=Coh_TrialIndex(TrialSpec1,TrialI);
- CohGroupPerm{iPermutation}=crossspec_TrialIndex(TrialSpec,TrialI);
- % CohGroup -> {3x67 cell} -> {3 trialTypes x 67 subjects}
- end
- end
- end
- elapsedTime = toc(tStartPerm);
- disp(['Elapsed time for script: ', num2str(elapsedTime), ' seconds']);
- %Save Permuation variable
- filename = [nPermutations 'CohGroupPerm_', datestr(now, 'yyyy-mm-dd'), '.mat'];
- save(filename, 'CohGroupPerm');
- %% Get WPLI from coherence
- Fre=CohGroupPerm{1}.Fre; % may need to import CohGroup from a COHdata file
- FBand=[2 100]; % consider changing [1 100] to [2 100] due to normalization
- FreInd=find(Fre>=FBand(1)&Fre<=FBand(2));
- Fplot=Fre(FreInd);
- PSDallPerm=zeros(length(FileStruct),length(FreInd),ChNTotal,length(TrialType))+nan;
- COHallPerm=zeros(length(FileStruct),length(FreInd),ChNTotal,ChNTotal-1,length(TrialType))+nan;
- WPLIallPerm=zeros(length(FileStruct),length(FreInd),ChNTotal,ChNTotal-1,length(TrialType))+nan;
- for iPermutation = 1:nPermutations
- if isempty(CohGroupPerm{iPermutation})
- continue;
- end
- if iCh==1
- PSDallPerm(iPermutation,:,iCh)=CohGroupPerm{iPermutation}.Pxx(FreInd);
- PSDallPerm(iPermutation,:,jCh)=CohGroupPerm{iPermutation}.Pyy(FreInd);
- end
- COHallPerm(iPermutation,:,iCh,jCh)=CohGroupPerm{iPermutation}.Cxy(FreInd);
- WPLIallPerm(iPermutation,:,iCh,jCh)=CohGroupPerm{iPermutation}.wpli(FreInd);
- end
- end
- %% Step 5: Determine the significance threshold for each frequency
- % EXTRACT relevant data for wpli threshold
- HitMissDataset = CohGroupPerm(3,:);
- % Initialize an output cell array of the same size.
- extractedStructs = cell(1, numel(HitMissDataset));
- % Extract the (31, 32) cell data from each cell in CohGroupPerm.
- extractedStructs = cellfun(@(x) x{31, 32}, HitMissDataset, 'UniformOutput', false);
- % Convert the extracted 'wpli' data to a 10,000x513 double matrix.
- wpliMatrix = cell2mat(cellfun(@(x) x.wpli, extractedStructs, 'UniformOutput', false)');
- wpliFreqs = extractedStructs{1,1}.Fre;
- % FIND WPLI threshold (value_of_topk)
- % Sort each column of wpliMatrix in descending order
- sortedMatrix = sort(wpliMatrix, 1, 'descend');
- % Extract the top_kth greatest value from each column
- p_value_threshold = 0.01; % p-val Significance threshold analogus to alpha value of 0.01
- top_0_01 = ceil(nPermutations * p_value_threshold); % Top K for p-value cutoff
- value_of_top0_01 = sortedMatrix(top_0_01, :);
- p_value_threshold2 = 0.001; % p-val Significance threshold analogus to alpha value of 0.01
- top_0_001 = ceil(nPermutations * p_value_threshold2); % Top K for p-value cutoff
- value_of_top0_001 = sortedMatrix(top_0_001, :);
- p_value_threshold3 = 0.0001; % p-val Significance threshold analogus to alpha value of 0.01
- top_0_0001 = ceil(nPermutations * p_value_threshold3); % Top K for p-value cutoff
- value_of_top0_0001 = sortedMatrix(top_0_0001, :);
- %% Step 6: Plot permutation WPLI threshold curve
- % Plot wpliFreqs (x-axis) against value100 (y-axis)
- figure;
- hold on;
- upperFreqLimit = 55; % Upper frequency limit of plot in (hz). Otherwise plot will go to >250 Hz
- upperFreqIndex = find(wpliFreqs >= upperFreqLimit, 1, 'first');
- % Plot the first line
- plot(wpliFreqs, value_of_top0_01, 'LineWidth', 2, 'DisplayName', ...
- ['p = ' num2str(p_value_threshold) ', Top K = ' num2str(top_0_01)]);
- % Plot the second line
- plot(wpliFreqs, value_of_top0_001, 'LineWidth', 2, 'DisplayName', ...
- ['p = ' num2str(p_value_threshold2) ', Top K = ' num2str(top_0_001)]);
- % Plot the third line
- plot(wpliFreqs, value_of_top0_0001, 'LineWidth', 2, 'DisplayName', ...
- ['p = ' num2str(p_value_threshold3) ', Top K = ' num2str(top_0_0001)]);
- % Add a legend
- legend('show', 'Location', 'best');
- % Add axis labels and title
- xlabel('Frequency (Hz)', 'FontSize', 12);
- ylabel('WPLI', 'FontSize', 12);
- title([num2str(size(wpliMatrix, 1)) ' Permutations. Threshold Curves for Different p-Values'], 'FontSize', 14);
- % Set y-axis to start at zero
- xlim([0 55])
- % ylim([0, max(max(value_of_top0_01(1:upperFreqIndex)), max(value_of_top0_001(1:upperFreqIndex)), max(value_of_top0_0001(1:upperFreqIndex)))]);
- ylim([0, max([max(value_of_top0_01(1:upperFreqIndex)), ...
- max(value_of_top0_001(1:upperFreqIndex)), ...
- max(value_of_top0_0001(1:upperFreqIndex))])]);
- % plot(wpliFreqs(1:index), value_of_topk(1:index), 'LineWidth', 2);
- % plot(wpliFreqs(1:index), value_of_topk2(1:index), 'LineWidth', 2);
- %
- % legend()
- %
- % % Add axis labels and title
- % xlabel('Frequency (Hz)', 'FontSize', 12);
- % ylabel('WPLI', 'FontSize', 12);
- % title([num2str(nPermutations) ' permutations. Top ' num2str(top_k) ' WPLI value. pvalue threshold of ' num2str(p_value_threshold)], 'FontSize', 14);
- %
- % % Set y-axis to start at zero
- % ylim([0, max(value_of_topk(1:index))]);
- grid on; % improve readability of plot
- hold off;
- % wpli_threshold_curve = zeros(32, 32, length(frequencies));
- % for freq_idx = 1:length(frequencies)
- % % Sort WPLI values for the current frequency across all permutations
- % sorted_values = sort(perm_idx_WPLICurve(:, freq_idx), 'descend');
- %
- % % Find the WPLI value corresponding to the top `top_k` value
- % wpli_threshold_curve(iCh, jCh, freq_idx) = sorted_values(top_k);
- % end
- %% Real > Permutated WPLI
- % get real WPLI - from
- load('10kCohGroupPerm_2024-12-17.mat')
- upperFreqLimit = 55; % Upper frequency limit of plot in (hz). Otherwise plot will go to >250 Hz
- upperFreqIndex = find(wpliFreqs >= upperFreqLimit, 1, 'first');
- lowerFreqLimit = 2;
- lowerFreqIndex = find(wpliFreqs >= lowerFreqLimit, 1, 'first');
- averagePermutatedWPLI_0to55_top0_01 = mean(value_of_top0_01(1:upperFreqIndex), 'omitnan');
- averagePermutatedWPLI_0to55_top0_001 = mean(value_of_top0_001(1:upperFreqIndex), 'omitnan');
- averagePermutatedWPLI_0to55_top0_0001 = mean(value_of_top0_0001(1:upperFreqIndex), 'omitnan');
- averagePermutatedWPLI_2to55_top0_01 = mean(value_of_top0_01(lowerFreqIndex:upperFreqIndex), 'omitnan');
- averagePermutatedWPLI_2to55_top0_001 = mean(value_of_top0_001(lowerFreqIndex:upperFreqIndex), 'omitnan');
- averagePermutatedWPLI_2to55_top0_0001 = mean(value_of_top0_0001(lowerFreqIndex:upperFreqIndex), 'omitnan');
- permutatedWPLI = value_of_top0_001;
- %% Initialize the average WPLI storage
- AvgRealWPLI = cell(length(EEGchInd), length(EEGchInd)); % Cell array for all channel pairs
- % AvgRealWPLI is a 32x32 cell containing 3x197 doubles (average WPLI per stim group (3) per freq (197)
- % Loop through all channel pairs 32x32
- for iCh = 1:length(EEGchInd)
- for jCh = iCh+1:length(EEGchInd) % Avoid duplicates and diagonal (upper triangle)
- % Initialize a 2D array to store averages for this channel pair
- AvgRealWPLI{iCh, jCh} = zeros(length(SubjGWPLI), size(WPLIall, 2)); % Rows: StimGroups, Cols: Frequencies
- % Loop through stimulus groups
- for iStimGroup = 1:length(SubjGWPLI)
- % Extract WPLI data for this stimulus group and channel pair
- DataPlot = squeeze(WPLIall(SubjGWPLI{iStimGroup}, :, EEGchInd(iCh), EEGchInd(jCh), iTrialType));
- % Remove invalid rows containing NaN
- Invalid = isnan(DataPlot(:, 1));
- DataPlot(Invalid, :) = [];
- % Compute the average across all valid rows for this stim group
- if ~isempty(DataPlot) % Ensure there is data after removing NaN
- AvgRealWPLI{iCh, jCh}(iStimGroup, :) = mean(DataPlot, 1); % Average across rows
- end
- end
- end
- end
- % outcome:
- % AvgRealWPLI is a 32x32 cell containing 3x197 doubles (average WPLI per stim group (3) per freq (197)
- %% Peak WPLI Extraction
- %%% set up
- BOIAlphas=[1 4 8 8 10 13 30 39.5 43;4 8 13 10 13 30 37 41.5 100];
- BOI2HzAlphas=[2 4 8 8 10 13 30 39.5 43 55;4 8 13 10 13 30 37 41.5 55 100];
- BOI2Hz=[2 4 8 13 30 39.5 43 55;4 8 13 30 37 41.5 55 100]; % No LOWER or UPPER ALPHA
- BandName={'Delta','Theta','Alpha','LowAlpha','HighAlpha','Beta','Gamma-1','Gamma-E', 'Gamma-55','Gamma-2'};
- BandHzNameAlphas={'1-4 Hz','4-8 Hz','8-13Hz','8-10Hz','10-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-55 Hz', '55-100 Hz'};
- BandHzName2HzAlphas={'2-4 Hz','4-8 Hz','8-13Hz','8-10Hz','10-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-55 Hz', '55-100 Hz'};
- BandHzName2HzAlphas={'2-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-55 Hz', '55-100 Hz'};
- lowerboundHz = 2;
- upperboundHZ = 39; % can change to 55 Hz
- %%%
- % $% Filter frequency bands up to upperbound Hz
- BOI_filtered = BOI2Hz(:, BOI2Hz(2, :) <= upperboundHZ);
- BandName_filtered = BandName(BOI2Hz(2, :) <= upperboundHZ);
- BandHzName_filtered = BandHzName2Hz(BOI2Hz(2, :) <= upperboundHZ);
- %
- % Preallocate results (cell array for flexibility)
- numBands = size(BOI_filtered, 2);
- [numChannels, ~] = size(AvgRealWPLI);
- peakWPLI = cell(numChannels, numChannels);
- % %% TESTING ONLY - Create BOIsFreqIndices - comment when fixed
- % % Example: Fre is the frequency vector (197x1 double), BOI_filtered contains the bands up to 55 Hz
- % BOIsFreqIndices = cell(1, numBands);
- % BOIsFreqValues = cell(1, numBands); % To store frequencies for each band
- %
- % % Calculate the indices and corresponding frequencies for each band
- % for b = 1:numBands
- % BOIsFreqIndices{b} = find(Fplot >= BOI_filtered(1, b) & Fplot <= BOI_filtered(2, b));
- % BOIsFreqValues{b} = Fplot(BOIsFreqIndices{b}); % Map indices to frequencies
- % end
- %
- % % Display the indices and their corresponding frequencies for each band
- % for b = 1:numBands
- % fprintf('Band: %s (%s)\n', BandName_filtered{b}, BandHzName_filtered{b});
- % fprintf('Indices: %s\n', mat2str(BOIsFreqIndices{b}));
- % fprintf('Frequencies (Hz): %s\n', mat2str(BOIsFreqValues{b}));
- % fprintf('\n');
- % end
- %%% Loop over channel pairs
- for iCh = 1:length(EEGchInd)
- for jCh = 1:length(EEGchInd)
- if isempty(AvgRealWPLI{iCh, jCh})
- continue; % Skip empty cells
- end
- data = AvgRealWPLI{iCh, jCh}; % data: 3x197 double (stimulation groups x frequencies)
- % Preallocate storage for this channel pair
- peakWPLI{iCh, jCh} = zeros(size(data, 1), numBands); % stim groups x frequency bands
- % Loop over bands of interest
- for iBand = 1:numBands
- % Find indices corresponding to the frequency band
- freqIndices = Fplot >= BOI_filtered(1, iBand) & Fplot <= BOI_filtered(2, iBand);
- % Get peak WPLI for each stimulation group
- for group = 1:size(data, 1)
- peakWPLI{iCh, jCh}(group, iBand) = max(data(group, freqIndices));
- % peakWPLI: 32x32 cell of 3x5 double (3 stim groups, 5 BOIs)
- end
- end
- end
- end
- % Result is stored in peakWPLI{i, j}(group, iBand), where:
- % i, j = channel indices
- % group = stimulation group
- % iBand = frequency band index
- % %% TESTING ONLY - Max WPLI Frequency per band
- % % Example variables
- % maxWPLIFreqHz = cell(length(EEGchInd), numChannels); % To store the frequencies of max WPLI
- %
- % % Loop through all channel pairs
- % for i = 1:numChannels
- % for j = 1:numChannels
- % if isempty(AvgRealWPLI{i, j})
- % continue; % Skip empty cells
- % end
- %
- % data = AvgRealWPLI{i, j}; % 3x197 double (stimulation groups x frequencies)
- % maxWPLIFreqHz{i, j} = zeros(size(data, 1), numBands); % Preallocate for groups x bands
- %
- % % Loop through stimulation groups
- % for group = 1:size(data, 1)
- % % Loop through each band
- % for iBand = 1:numBands
- % freqIndices = BOIsFreqIndices{iBand}; % Get indices for the band
- % [~, maxIndex] = max(data(group, freqIndices)); % Find index of max value
- % maxWPLIFreqHz{i, j}(group, iBand) = Fplot(freqIndices(maxIndex)); % Map to frequency in Hz
- % end
- % end
- % end
- % end
- %
- % % Display example output for a specific channel pair
- % exampleChannelPair = [1, 2]; % Change to any valid pair
- % if ~isempty(maxWPLIFreqHz{exampleChannelPair(1), exampleChannelPair(2)})
- % fprintf('Max WPLI frequencies for channel pair (%d, %d):\n', exampleChannelPair(1), exampleChannelPair(2));
- % for group = 1:numGroups
- % fprintf(' %s:\n', GroupNameWPLI{group}); % Use the group name
- % for iBand = 1:numBands
- % fprintf(' Band: %s (%s) - Max WPLI at %.2f Hz\n', ...
- % BandName_filtered{iBand}, BandHzName_filtered{iBand}, ...
- % maxWPLIFreqHz{exampleChannelPair(1), exampleChannelPair(2)}(group, iBand));
- % end
- % end
- % end
- %%% Plot fraction of channel pairs with WPLI greater than p=0.01 permutated WPLI
- % Initialize fraction of channel pairs exceeding the threshold
- numGroups = 3; % Number of stimulation groups
- numBands = size(BOI_filtered, 2); % Number of frequency bands
- fractionExceed = zeros(numGroups, numBands);
- averagePermutatedWPLI_2to55_top0_0001 = 0.0894;
- % averagePermutatedWPLI_2to55_top0_001 = 0.04
- % 0.1202; % top quartile threshold
- averagePermutatedWPLIvalue = averagePermutatedWPLI_2to55_top0_0001; % top quartile threshold % averagePermutatedWPLI_2to55_top0_001;
- % Count total non-empty cells
- numChannels = size(AvgRealWPLI, 1);
- totalPairs = 0;
- for i = 1:numChannels
- for j = 1:numChannels
- if ~isempty(AvgRealWPLI{i, j})
- totalPairs = totalPairs + 1;
- end
- end
- end
- % Loop through stimulation groups and frequency bands
- for iGroup = 1:numGroups
- for iBand = 1:numBands
- exceedCount = 0;
- % Loop over all channel pairs
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(AvgRealWPLI{i, j})
- continue; % Skip empty cells
- end
- % Check if the value for the group and band exceeds the threshold
- if peakWPLI{i, j}(iGroup, iBand) > averagePermutatedWPLIvalue %
- exceedCount = exceedCount + 1;
- end
- end
- end
- % Calculate the fraction for this group and band
- fractionExceed(iGroup, iBand) = exceedCount / totalPairs;
- end
- end
- %% Peak Alpha WPLI 40Hz vs Light SIGNIFICANT CH ONLY ( stats preceding fig4D stats)
- %%% Groups
- GroupSubjs_40Hz = 1; % 40Hz group
- GroupSubjs_Light = 6; % LightRT group
- %%% Get all alpha values
- alphaLowerLimitFreqHz = 8;
- alphaUpperLimitFreqHz = 13;
- % Find indices of values in Fre between 8 and 13 (inclusive)
- allAlphaFreIndices = find(Fre >= alphaLowerLimitFreqHz & Fre <= alphaUpperLimitFreqHz);
- HitMissTrialType = 3;
- WPLIallAlpha = squeeze(WPLIall(:,allAlphaFreIndices,1:32,1:32,HitMissTrialType)); % size(WPLIall) ans = 67 197 40 39 3- 67subs x allFreqs x iCh x jCh x TrialType
- %WPLIallAlpha: (67subs, x 11 freqs x 32 x 32chs)
- %%% Find the peak WPLI value within alpha (dimension 2) and the corresponding Index (correspond to
- % Freq Hz) of the peak alpha WPLI value
- [peakAlphaValues4D, peakAlphaIndices4D] = max(WPLIallAlpha, [], 2);
- peakAlphaValues = squeeze(peakAlphaValues4D);
- peakAlphaIndices = squeeze(peakAlphaIndices4D);
- %%%%%%%%%%%%%% pre-process peak alpha WLPI values
- % peakAlphaValues = squeeze(peakAlphaValues); % 4d to 3d
- % test with single
- peakAlphaValueSingleSub = squeeze(peakAlphaValues(1,:,:));
- % Extract Peak Alpha WPLI values for each sub into groups: 40 Hz & Light
- PeakAlphaWPLIs_40HzGroup = peakAlphaValues(SubjG{GroupSubjs_40Hz},:,:);
- PeakAlphaWPLIs_LightGroup = peakAlphaValues(SubjG{GroupSubjs_Light},:,:);
- % Get average peak alpha WPLI for each group for all channel pairs
- MeanAlphaPeakWPLI_40Hz = squeeze(mean(PeakAlphaWPLIs_40HzGroup, 1));
- MeanAlphaPeakWPLI_Light = squeeze(mean(PeakAlphaWPLIs_LightGroup, 1));
- %%% Get alpha peak WPLI frequency from peakWPLI_Freq (see: %% Plot bar graph of # channels exceeding
- %%% p=0.0001 WPLI threshold (New Fig4C MS) MKA 2025-02-06)
- % Preallocate with NaN
- peakAlphaFreq_40HzGroup = NaN(numChannels, numChannels);
- peakAlphaFreq_LightGroup = NaN(numChannels, numChannels);
- % Apply cellfun with error handling
- validCells = ~cellfun(@isempty, peakWPLI_Freq); % Logical mask for non-empty cells
- peakAlphaFreq_40HzGroup(validCells) = cellfun(@(x) x(1,3), peakWPLI_Freq(validCells));
- peakAlphaFreq_LightGroup(validCells) = cellfun(@(x) x(1,3), peakWPLI_Freq(validCells));
- % %%%%%%%%%%%% Get frequency value of the peak alpha WPLI
- % % Initialize a copy of peakAlphaIndices
- % peakAlphaIndicesNaN = peakAlphaIndices;
- %
- % % test with single participant
- % singleSubPeakAlphaIndexAllChPairs = squeeze(peakAlphaIndices(1,:,:)); % should contain values between 1 and 11
- %
- % % Convert Indices to Correct Corresponding Frequnecy (Hz)
- % % Find valid indices (values between 1 and 11)
- % validIdx = singleSubPeakAlphaIndexAllChPairs >= 1 & singleSubPeakAlphaIndexAllChPairs <= 11;
- %
- % % Initialize the output array with NaN, preserving original shape
- % singleallchpfreqs = NaN(size(singleSubPeakAlphaIndexAllChPairs));
- %
- % % Perform mapping only for valid indices
- % singleallchpfreqs(validIdx) = alphaFreqHz(singleSubPeakAlphaIndexAllChPairs(validIdx));
- %
- % % If all alpha WPLI values are NaN, then set the max index to NaN
- % peakAlphaIndicesNaN(all(isnan(WPLIallAlpha),2)) = NaN;
- %
- % % % Reshape the result to 3D: 67x32x32 double
- % % PeakAlphaIndicesNaN3D = squeeze(peakAlphaIndicesNaN);
- %
- % % Convert Indices (3D) to Correct Corresponding Frequency (Hz)
- % validIdx = peakAlphaIndicesNaN >= 1 & peakAlphaIndicesNaN <= 11;
- %
- % % Initialize the output array with NaN, preserving original shape
- % PeakAlphaFreqs = NaN(size(peakAlphaIndicesNaN));
- %
- % % Perform mapping only for valid indices
- % PeakAlphaFreqs(validIdx) = alphaFreqHz(peakAlphaIndicesNaN(validIdx));
- %
- %
- % % Extract Peak Alpha WPLI frequency into groups: 40 Hz & Light
- % % PeakWPLIallAlpha: 67 subs x 32ch x 32ch
- % PeakAlphaFreqs_40HzGroup = PeakAlphaFreqs(SubjG{GroupSubjs_40Hz},:,:);
- % PeakAlphaFreqs_LightGroup = PeakAlphaFreqs(SubjG{GroupSubjs_Light},:,:);
- %
- % % Get average peak alpha WPLI frequncy for each group for all channel pairs
- % MeanPeakAlphaFreq_40Hz = squeeze(mean(PeakAlphaFreqs_40HzGroup, 1));
- % MeanPeakAlphaFreq_Light = squeeze(mean(PeakAlphaFreqs_LightGroup, 1));
- %%% Find channel pairs that exceed WPLI threshold
- % WPLI threshold:
- averagePermutatedWPLI_2to55_top0_0001 = 0.0894;
- averagePermutatedWPLIvalue = averagePermutatedWPLI_2to55_top0_0001;
- % display the averagePermutatedWPLIvalue
- fprintf("averagePermutatedWPLI_2to55_top0_0001: %.4f\n", averagePermutatedWPLIvalue);
- % create logical mask of all channel pairs that have a peak band WPLI that exceeds the WPLI threshold (e.g. 0.0894) for 40 Hz and Light
- % Groups. peakWPLI: 32x32 cell of 3x5 doubles
- % SignificantWPLI_40Hz = MeanAlphaPeakWPLI_40Hz > averagePermutatedWPLIvalue;
- % SignificantWPLI_Light = MeanAlphaPeakWPLI_Light > averagePermutatedWPLIvalue;
- SignificantWPLI_40Hz = exceedMask(:,:,1,3);
- SignificantWPLI_Light = exceedMask(:,:,3,3);
- % count the total number of channel pairs that exceed the WPLI threshold, display the result
- numSignificantPairs_40Hz = sum(sum(SignificantWPLI_40Hz));
- numSignificantPairs_Light = sum(sum(SignificantWPLI_Light));
- fprintf('\nNumber of Significant Channel Pairs (exceeding WPLI threshold) in 40Hz Group: %d\n', numSignificantPairs_40Hz);
- fprintf('Number of Significant Channel Pairs (exceeding WPLI threshold) in Light Group: %d\n', numSignificantPairs_Light);
- %%% use logical mask to extract peak alpha frequencies of signficant WPLI (exceeding threshold) channel pairs for 40 Hz and Light from
- % , display the result
- % SignificantAlphaFreqs_40Hz = MeanPeakAlphaFreq_40Hz;
- SignificantAlphaFreqs_40Hz = peakAlphaFreq_40HzGroup .* SignificantWPLI_40Hz;
- SignificantAlphaFreqs_40Hz(~SignificantWPLI_40Hz) = NaN;
- SignificantAlphaFreqs_Light = peakAlphaFreq_LightGroup .* SignificantWPLI_Light;
- SignificantAlphaFreqs_Light(~SignificantWPLI_Light) = NaN;
- % Compute average peak alpha frequency across all channel pairs that exceed WPLI thresold for each
- % group, display the result
- MeanSignificantAlphaFreq_40Hz = mean(SignificantAlphaFreqs_40Hz(SignificantAlphaFreqs_40Hz > 0));
- MeanSignificantAlphaFreq_Light = mean(SignificantAlphaFreqs_Light(SignificantAlphaFreqs_Light > 0));
- fprintf('\nMean Peak Alpha Frequency (Significant 40Hz Group): %.2f Hz\n', MeanSignificantAlphaFreq_40Hz);
- fprintf('Mean Peak Alpha Frequency (Significant Light Group): %.2f Hz\n', MeanSignificantAlphaFreq_Light);
- % Compute median values
- MedianSignificantAlphaFreq_40Hz = median(SignificantAlphaFreqs_40Hz(SignificantAlphaFreqs_40Hz > 0));
- MedianSignificantAlphaFreq_Light = median(SignificantAlphaFreqs_Light(SignificantAlphaFreqs_Light > 0));
- fprintf('\nMedian Peak Alpha Frequency (Significant 40Hz Group): %.2f Hz\n', MedianSignificantAlphaFreq_40Hz);
- fprintf('Median Peak Alpha Frequency (Significant Light Group): %.2f Hz\n', MedianSignificantAlphaFreq_Light);
- % Compute 25th and 75th percentiles
- Q1_40Hz = prctile(SignificantAlphaFreqs_40Hz(SignificantAlphaFreqs_40Hz > 0), 25);
- Q3_40Hz = prctile(SignificantAlphaFreqs_40Hz(SignificantAlphaFreqs_40Hz > 0), 75);
- Q1_Light = prctile(SignificantAlphaFreqs_Light(SignificantAlphaFreqs_Light > 0), 25);
- Q3_Light = prctile(SignificantAlphaFreqs_Light(SignificantAlphaFreqs_Light > 0), 75);
- fprintf('\n25th Percentile (Significant 40Hz Group): %.2f Hz\n', Q1_40Hz);
- fprintf('75th Percentile (Significant 40Hz Group): %.2f Hz\n', Q3_40Hz);
- fprintf('25th Percentile (Significant Light Group): %.2f Hz\n', Q1_Light);
- fprintf('75th Percentile (Significant Light Group): %.2f Hz\n', Q3_Light);
- % Compute STE (Standard Error of the Mean)
- std_40Hz = nanstd(SignificantAlphaFreqs_40Hz(:)); % Standard deviation
- std_Light = nanstd(SignificantAlphaFreqs_Light(:));
- N_40Hz = sum(~isnan(SignificantAlphaFreqs_40Hz(:))); % Sample size
- N_Light = sum(~isnan(SignificantAlphaFreqs_Light(:)));
- STE_40Hz = std_40Hz / sqrt(N_40Hz);
- STE_Light = std_Light / sqrt(N_Light);
- fprintf('\nStandard Error of the Mean (STE) - 40Hz Group: %.4f Hz\n', STE_40Hz);
- fprintf('Standard Error of the Mean (STE) - Light Group: %.4f Hz\n', STE_Light);
- % Test the distribution of alpha peak frequencies for normality, display results
- [h_40Hz, p_40Hz] = kstest(SignificantAlphaFreqs_40Hz(:));
- [h_Light, p_Light] = kstest(SignificantAlphaFreqs_Light(:));
- fprintf('\nKolmogorov–Smirnov Normality Test (40Hz Group): p = %.8f\n', p_40Hz);
- fprintf('Kolmogorov–Smirnov Normality Test (Light Group): p = %.8f\n', p_Light);
- % Create violin plot of 40 Hz and Light alpha peak frequency distributions
- figure;
- v = violinplot([SignificantAlphaFreqs_40Hz(:), SignificantAlphaFreqs_Light(:)], {'40Hz', 'Light'});
- ylabel('Peak Alpha Frequency (Hz)');
- title(sprintf('Violin Plot of Peak Alpha Frequency Distributions\nWPLI threshold: %.4f', averagePermutatedWPLIvalue));
- % Compute means and number of non-NaN data points
- mean_40Hz = nanmean(SignificantAlphaFreqs_40Hz(:));
- mean_Light = nanmean(SignificantAlphaFreqs_Light(:));
- N_40Hz = sum(~isnan(SignificantAlphaFreqs_40Hz(:)));
- N_Light = sum(~isnan(SignificantAlphaFreqs_Light(:)));
- % Annotate mean values on the plot
- hold on;
- plot(1, mean_40Hz, 'kd', 'MarkerFaceColor', 'k', 'MarkerSize', 8); % Mean for 40Hz
- plot(2, mean_Light, 'kd', 'MarkerFaceColor', 'k', 'MarkerSize', 8); % Mean for Light
- % Annotate median values on the plot
- plot(1, MedianSignificantAlphaFreq_40Hz, 'bs', 'MarkerFaceColor', 'b', 'MarkerSize', 8); % Median for 40Hz
- plot(2, MedianSignificantAlphaFreq_Light, 'bs', 'MarkerFaceColor', 'b', 'MarkerSize', 8); % Median for Light
- % Annotate 25th and 75th percentiles on the plot
- plot(1, Q1_40Hz, 'm^', 'MarkerFaceColor', 'm', 'MarkerSize', 6); % 25th Percentile 40Hz
- plot(1, Q3_40Hz, 'm^', 'MarkerFaceColor', 'm', 'MarkerSize', 6); % 75th Percentile 40Hz
- plot(2, Q1_Light, 'm^', 'MarkerFaceColor', 'm', 'MarkerSize', 6); % 25th Percentile Light
- plot(2, Q3_Light, 'm^', 'MarkerFaceColor', 'm', 'MarkerSize', 6); % 75th Percentile Light
- % Display text for mean, median, and percentiles
- text(1, mean_40Hz + 0.2, sprintf('Mean: %.2f Hz', mean_40Hz), 'HorizontalAlignment', 'center');
- text(2, mean_Light + 0.2, sprintf('Mean: %.2f Hz', mean_Light), 'HorizontalAlignment', 'center');
- text(1, MedianSignificantAlphaFreq_40Hz - 0.2, sprintf('Median: %.2f Hz', MedianSignificantAlphaFreq_40Hz), 'HorizontalAlignment', 'center', 'Color', 'b');
- text(2, MedianSignificantAlphaFreq_Light - 0.2, sprintf('Median: %.2f Hz', MedianSignificantAlphaFreq_Light), 'HorizontalAlignment', 'center', 'Color', 'b');
- text(1, Q1_40Hz - 0.3, sprintf('Q1: %.2f Hz', Q1_40Hz), 'HorizontalAlignment', 'center', 'Color', 'm');
- text(1, Q3_40Hz + 0.3, sprintf('Q3: %.2f Hz', Q3_40Hz), 'HorizontalAlignment', 'center', 'Color', 'm');
- text(2, Q1_Light - 0.3, sprintf('Q1: %.2f Hz', Q1_Light), 'HorizontalAlignment', 'center', 'Color', 'm');
- text(2, Q3_Light + 0.3, sprintf('Q3: %.2f Hz', Q3_Light), 'HorizontalAlignment', 'center', 'Color', 'm');
- % Display sample sizes
- text(1, min(ylim) + 1, sprintf('N = %d', N_40Hz), 'HorizontalAlignment', 'center');
- text(2, min(ylim) + 1, sprintf('N = %d', N_Light), 'HorizontalAlignment', 'center');
- hold off;
- % Rank sum test: testing if Light has significantly greater alpha peak frequency than 40 Hz
- [p_ranksum, h_ranksum] = ranksum(SignificantAlphaFreqs_40Hz(:), SignificantAlphaFreqs_Light(:), 'tail', 'left');
- fprintf('\nRank Sum Test p-value: %.16f\n', p_ranksum);
- % Display peak alpha frequency of channel pairs exceeding WPLI threshold in tables (32x32)
- ChannelLabels = {'Fp1', 'AF3', 'F7', 'F3', 'FC1', 'FC5', 'T7', 'C3', 'CP1', 'CP5', ...
- 'P7', 'P3', 'Pz', 'PO3', 'O1', 'Oz', 'O2', 'PO4', 'P4', 'P8', ...
- 'CP6', 'CP2', 'C4', 'T8', 'FC6', 'FC2', 'F4', 'F8', 'AF4', 'Fp2', 'Fz', 'Cz'};
- fprintf('\nMean Peak Alpha Frequency (Significant channel pairs only - in 40Hz Group):\n');
- disp(array2table(SignificantAlphaFreqs_40Hz, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- fprintf('\nMean Peak Alpha Frequency (Significant channel pairs only - in Light Group):\n');
- disp(array2table(SignificantAlphaFreqs_Light, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- fprintf('\nMean Peak Alpha WPLI (All channel pairs in 40Hz Group):\n');
- disp(array2table(MeanAlphaPeakWPLI_40Hz, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- fprintf('\nMean Peak Alpha WPLI (All channel pairs in Light Group):\n');
- disp(array2table(MeanAlphaPeakWPLI_Light, 'VariableNames', ChannelLabels, 'RowNames', ChannelLabels));
- %% Peak Alpha WPLI 40Hz vs Light SIGNIFICANT CH ONLY (abandoned approached)
- % Initialize logical masks for valid channel pairs
- numChannels = 32;
- validChannels_40Hz = false(numChannels, numChannels);
- validChannels_Light = false(numChannels, numChannels);
- group40HzIndex = 1;
- groupLightIndex = 3;
- % Identify valid channels where WPLI exceeds threshold in each group
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(peakWPLI{i, j})
- continue; % Skip empty cells
- end
- % Check if peak WPLI is greater than threshold for 40Hz and Light groups
- if peakWPLI{i, j}(group40HzIndex, 1) > averagePermutatedWPLIvalue
- validChannels_40Hz(i, j) = true;
- end
- if peakWPLI{i, j}(groupLightIndex, 1) > averagePermutatedWPLIvalue
- validChannels_Light(i, j) = true;
- end
- end
- end
- % Find common channel pairs where both groups exceed the threshold
- validChannels = validChannels_40Hz & validChannels_Light;
- % Collect flattened peak alpha frequencies for valid channels only
- selectedFreqs_40Hz = [];
- selectedFreqs_Light = [];
- for i = 1:numChannels
- for j = 1:numChannels
- if validChannels(i, j)
- selectedFreqs_40Hz = [selectedFreqs_40Hz; PeakAlphaFreqs_40HzGroup(:, i, j)];
- selectedFreqs_Light = [selectedFreqs_Light; PeakAlphaFreqs_LightGroup(:, i, j)];
- end
- end
- end
- %% Plot the results (no counts)
- figure;
- for iGroup = 1:numGroups
- subplot(1, numGroups, iGroup);
- bar(fractionExceed(iGroup, :));
- title(GroupNameWPLI{iGroup}); % Use group name as title
- xlabel('Frequency Band');
- ylabel('Fraction of Channel Pairs');
- % Customize x-axis labels with both BandName and BandHzName
- xticks(1:numBands);
- xticklabels(arrayfun(@(iBand) [BandName_filtered{iBand}, ' (', BandHzName_filtered{iBand}, ')'], ...
- 1:numBands, 'UniformOutput', false));
- xtickangle(45);
- ylim([0 1]); % Fractions are between 0 and 1
- end
- % Add super title
- sgtitle('Fraction of Channel Pairs Exceeding average permutated p=0.01 WPLI value');
- %% Same as above but with counts above each bar
- figure;
- for iGroup = 1:numGroups
- subplot(1, numGroups, iGroup);
- barHandle = bar(fractionExceed(iGroup, :));
- title(GroupNameWPLI{iGroup}); % Use group name as title
- xlabel('Frequency Band');
- ylabel('Fraction of Channel Pairs');
- % Customize x-axis labels with both BandName and BandHzName
- xticks(1:numBands);
- xticklabels(arrayfun(@(iBand) [BandName_filtered{iBand}, ' (', BandHzName_filtered{iBand}, ')'], ...
- 1:numBands, 'UniformOutput', false));
- xtickangle(45);
- ylim([0 1]); % Fractions are between 0 and 1
- %%% Add exceed count above each bar
- barHeights = fractionExceed(group, :);
- for iBand = 1:numBands
- % Position the text slightly above the bar height
- text(iBand, barHeights(iBand) + 0.02, num2str(round(barHeights(iBand) * totalPairs)), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10);
- end
- end
- % Add super title
- sgtitle('Fraction of Channel Pairs Exceeding average permutated p=0.0001 WPLI value');
- %% Bar graph with counts below
- figure;
- for group = 1:numGroups
- subplot(1, numGroups, group);
- barHandle = bar(fractionExceed(group, :));
- title(GroupNameWPLI{group}); % Use group name as title
- xlabel('Frequency Band');
- ylabel('Fraction of Channel Pairs');
- % Customize x-axis labels with both BandName and BandHzName
- xticks(1:numBands);
- xticklabels(arrayfun(@(iBand) [BandName_filtered{iBand}, ' (', BandHzName_filtered{iBand}, ')'], ...
- 1:numBands, 'UniformOutput', false));
- xtickangle(45);
- ylim([0 1]); % Fractions are between 0 and 1
- % Add exceed count below the top of each bar
- barHeights = fractionExceed(group, :);
- for iBand = 1:numBands
- % Position the text slightly below the bar height
- text(iBand, barHeights(iBand) - 0.02, num2str(round(barHeights(iBand) * totalPairs)), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10, 'VerticalAlignment', 'top');
- end
- end
- % Add super title
- sgtitle('Fraction of Channel Pairs Exceeding average permutated p=0.01 WPLI value');
- %% Plot the results 2025-01-08 MKA fig4D supp? - top quartile
- % BOI=[1 4 8 13 30 39.5;4 8 13 30 37 41.5];
- % BOI2HzFiveBands=[2 4 8 13 39.5;4 8 13 30 41.5];
- % BandNameFiveBands={'Delta','Theta','Alpha','Beta','Gamma-E'};
- % BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','39-41 Hz'};
- % BandHzName2HzFiveBands={'2-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','39-41 Hz'};
- BOI2Hz=[2 4 8 8 10 13 30 39.5 43 55;4 8 13 10 13 30 37 41.5 55 100];
- BandName={'Delta','Theta','Alpha','LowAlpha','HighAlpha','Beta','Gamma-1','Gamma-E', 'Gamma-55','Gamma-2'};
- BandHzName2Hz={'2-4 Hz','4-8 Hz','8-13Hz','8-10Hz','10-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-55 Hz', '55-100 Hz'};
- numBands = size(BOI2Hz, 2);
- %%% Get WPLI for each stim group for each BOI and ch Pair
- %%%% Loop thru all ch pairs
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(AvgRealWPLI{i, j})
- continue; % Skip empty cells
- end
- data = AvgRealWPLI{i, j}; % 3x197 double (stimulation groups x frequencies)
- % Preallocate storage for this channel pair
- peakWPLI{i, j} = zeros(size(data, 1), numBands); % stim groups x frequency bands
- % Loop over bands of interest
- for iBand = 1:numBands
- % Find indices corresponding to the frequency band
- freqIndices = Fplot >= BOI2Hz(1, iBand) & Fplot <= BOI2Hz(2, iBand);
- % Get peak WPLI for each stimulation group
- for group = 1:size(data, 1)
- peakWPLI{i, j}(group, iBand) = max(data(group, freqIndices));
- end
- end
- end
- end
- % Result is stored in peakWPLI{i, j}(group, iBand), where:
- % i, j = channel indices
- % group = stimulation group
- % iBand = frequency band index
- %%% Plot fraction of channel pairs with WPLI greater than p=0.01 permutated WPLI
- % Example variables (replace these with actual data)
- % averagePermutatedWPLItop0_01 = 0.5; % Replace with actual value
- % GroupNameWPLI = {'Group 1', 'Group 2', 'Group 3'}; % Replace with actual group names
- % Initialize fraction of channel pairs exceeding the threshold
- numGroups = 3; % Number of stimulation groups
- numBands = size(BOI2Hz, 2)-1; % Number of frequency bands
- fractionExceed = zeros(numGroups, numBands);
- % averagePermutatedWPLI_2to55_top0_0001 = 0.0894
- % averagePermutatedWPLI_2to55_top0_001 = 0.04
- averagePermutatedWPLIvalue = 0.1202; % top quartile threshold %
- % Count total non-empty cells
- numChannels = size(AvgRealWPLI, 1);
- totalPairs = 0;
- for i = 1:numChannels
- for j = 1:numChannels
- if ~isempty(AvgRealWPLI{i, j})
- totalPairs = totalPairs + 1;
- end
- end
- end
- % Loop through stimulation groups and frequency bands
- for group = 1:numGroups
- for iBand = 1:numBands
- exceedCount = 0;
- % Loop over all channel pairs
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(AvgRealWPLI{i, j})
- continue; % Skip empty cells
- end
- % Check if the value for the group and band exceeds the threshold
- if peakWPLI{i, j}(group, iBand) > averagePermutatedWPLIvalue %averagePermutatedWPLItop0_01
- exceedCount = exceedCount + 1;
- end
- end
- end
- % Calculate the fraction for this group and band
- fractionExceed(group, iBand) = exceedCount / totalPairs;
- end
- end
- figure;
- for iGroup = 1:numGroups
- subplot(1, numGroups, iGroup);
- barHandle = bar(fractionExceed(iGroup, :));
- title(GroupNameWPLI{iGroup}); % Use iGroup name as title
- xlabel('Frequency Band');
- ylabel('Fraction of Channel Pairs');
- % Customize x-axis labels with both BandName and BandHzName
- xticks(1:numBands);
- xticklabels(arrayfun(@(iBand) [BandName{iBand}, ' (', BandHzName2Hz{iBand}, ')'], ...
- 1:numBands, 'UniformOutput', false));
- xtickangle(45);
- ylim([0 1]); % Fractions are between 0 and 1
- % Add exceed count conditionally above or below the bar
- barHeights = fractionExceed(iGroup, :);
- for iBand = 1:numBands
- exceedCount = round(barHeights(iBand) * totalPairs); % Calculate exceed count
- if barHeights(iBand) < 0.2
- % Place count above the bar
- text(iBand, barHeights(iBand) + 0.04, num2str(exceedCount), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10);
- else
- % Place count below the top of the bar
- text(iBand, barHeights(iBand) - 0.01, num2str(exceedCount), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10, 'VerticalAlignment', 'top');
- end
- end
- % Store percentage of Alpha band exceedance for this iGroup
- alphaExceedPercent(iGroup) = barHeights(3) * 100; % Alpha band is iBand = 4
- end
- % Add super title
- sgtitle(['Fraction of Channel Pairs Exceeding top quartile WPLI value: ' num2str(averagePermutatedWPLIvalue)]);
- % Calculate and display the average percentage of Alpha band exceedance
- averageAlphaPercent = mean(alphaExceedPercent);
- disp(['Average Percentage of Channel Pairs Exceeding Threshold for Alpha Band: ', num2str(averageAlphaPercent), '%']);
- % Display percentages for each group
- for group = 1:numGroups
- disp(['Group ', GroupNameWPLI{group}, ': ', num2str(alphaExceedPercent(group)), '%']);
- end
- %% Plot bar graph of # channels exceeding p=0.0001 WPLI threshold (New Fig4C MS) MKA 2025-02-06
- BOI2HzFiveBands=[2 4 8 13 30; 4 8 13 30 37];
- BandNameFiveBands={'Delta','Theta','Alpha','Beta','Slow Gamma'};
- BandHzName2HzFiveBands={'2-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz'};
- numBands = size(BOI2HzFiveBands, 2);
- %%% Initialize storage for peak frequencies
- peakWPLI_Freq = cell(numChannels, numChannels);
- %%% Loop over channel pairs
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(AvgRealWPLI{i, j})
- continue; % Skip empty cells
- end
- AvgRealWPLI_ijChPair = AvgRealWPLI{i, j}; % AvgRealWPLI_ijChPair = 3x197 double (stimulation groups x frequencies)
- % Preallocate storage for this channel pair
- peakWPLI{i, j} = zeros(size(AvgRealWPLI_ijChPair, 1), numBands); % stim groups x frequency bands
- peakWPLI_Freq{i, j} = zeros(size(AvgRealWPLI_ijChPair, 1), numBands); % Store peak frequency
- % Loop over bands of interest
- for iBand = 1:numBands
- % Find indices corresponding to the frequency band
- iBandFreqIndices = Fplot >= BOI2HzFiveBands(1, iBand) & Fplot <= BOI2HzFiveBands(2, iBand);
- Fplot_iBand = Fplot(iBandFreqIndices); % Extract frequencies in this band
- % Get peak WPLI for each stimulation group
- for iGroup = 1:size(AvgRealWPLI_ijChPair, 1)
- AvgRealWPLI_ijChPair_iBand_iGroup = AvgRealWPLI_ijChPair(iGroup, iBandFreqIndices); %
- % Find peak WPLI value
- [peakWPLI{i, j}(iGroup, iBand), maxIdx] = max(AvgRealWPLI_ijChPair_iBand_iGroup);
- % Store corresponding frequency
- peakWPLI_Freq{i, j}(iGroup, iBand) = Fplot_iBand(maxIdx);
- end
- end
- end
- end
- % Result is stored in peakWPLI{i, j}(group, iBand), where:
- % i, j = channel indices
- % group = stimulation group
- % iBand = frequency band index
- %%% Plot fraction of channel pairs with WPLI greater than p=0.01 permutated WPLI
- % Example variables (replace these with actual data)
- % averagePermutatedWPLItop0_01 = 0.5; % Replace with actual value
- % GroupNameWPLI = {'Group 1', 'Group 2', 'Group 3'}; % Replace with actual group names
- % Initialize fraction of channel pairs exceeding the threshold
- numGroups = 3; % Number of stimulation groups
- numBands = size(BOI2HzFiveBands, 2); % Number of frequency bands
- fractionExceed = zeros(numGroups, numBands);
- % averagePermutatedWPLI_2to55_top0_0001 = 0.0894
- % averagePermutatedWPLI_2to55_top0_001 = 0.04
- averagePermutatedWPLIvalue = averagePermutatedWPLI_2to55_top0_0001; % top quartile threshold % averagePermutatedWPLI_2to55_top0_001;
- % Count total non-empty cells
- numChannels = size(AvgRealWPLI, 1);
- totalPairs = 0;
- %%% count the number of total channel pairs based on number of AvgRealWPLI values (use mask)
- for i = 1:numChannels
- for j = 1:numChannels
- if ~isempty(AvgRealWPLI{i, j})
- totalPairs = totalPairs + 1;
- end
- end
- end
- totalPairsMaskSum = sum(~cellfun(@isempty, AvgRealWPLI), 'all');
- % Preallocate arrays
- peakWPLIarray = nan(numChannels, numChannels, numGroups, numBands);
- exceedMask = false(numChannels, numChannels, numGroups, numBands);
- fractionExceed = zeros(numGroups, numBands);
- % Create a logical mask for non-empty channel pairs
- validPairs = ~cellfun(@isempty, AvgRealWPLI);
- % Loop through stimulation groups and frequency bands
- for iGroup = 1:numGroups
- for iBand = 1:numBands
- % % Extract peakWPLI values into an array (set NaN for empty pairs)
- % peakWPLIarray(validPairs, iGroup, iBand) = cellfun(@(x) x(iGroup, iBand), peakWPLI(validPairs));
- % peakWPLIarray(~validPairs) = NaN; % Ensure empty cells remain NaN
- % Extract peakWPLI values into an array (set NaN for empty pairs)
- tempValues = nan(numChannels, numChannels); % Temporary storage
- tempValues(validPairs) = cellfun(@(x) x(iGroup, iBand), peakWPLI(validPairs));
- % Store in preallocated array
- peakWPLIarray(:, :, iGroup, iBand) = tempValues;
- % Create a logical mask for values exceeding the threshold
- exceedMask(:, :, iGroup, iBand) = peakWPLIarray(:, :, iGroup, iBand) > averagePermutatedWPLIvalue;
- % Count the number of exceeding pairs
- exceedCount = sum(exceedMask(:, :, iGroup, iBand), 'all');
- % Calculate the fraction
- fractionExceed(iGroup, iBand) = exceedCount / totalPairs;
- end
- end
- % Loop through stimulation groups and frequency bands
- for group = 1:numGroups
- for iBand = 1:numBands
- exceedCount = 0;
- % Loop over all channel pairs
- for i = 1:numChannels
- for j = 1:numChannels
- if isempty(AvgRealWPLI{i, j})
- continue; % Skip empty cells
- end
- % Check if the value for the group and band exceeds the threshold
- if peakWPLI{i, j}(group, iBand) > averagePermutatedWPLIvalue %averagePermutatedWPLItop0_01
- exceedCount = exceedCount + 1;
- end
- end
- end
- % Calculate the fraction for this group and band
- fractionExceed(group, iBand) = exceedCount / totalPairs;
- end
- end
- %%% Plot High Functional Connectivity Bar Plot *** fig4c
- figure;
- for iGroup = 1:numGroups
- subplot(1, numGroups, iGroup);
- barHandle = bar(fractionExceed(iGroup, :));
- if iGroup ~= 3
- title(GroupNameWPLI{iGroup}); % Use iGroup name as title
- else
- title("Light"); % Use "Light" instead of "LightRT"
- end
- if iGroup ==2
- xlabel('Frequency Band');
- end
- if iGroup == 1
- ylabel('Fraction of Channel Pairs');
- end
- % Customize x-axis labels with both BandName and BandHzName
- iBand = 1;
- xticks(1:numBands);
- xticklabels(arrayfun(@(iBand) [BandNameFiveBands{iBand}], ...
- 1:numBands, 'UniformOutput', false));
- xtickangle(45);
- ylim([0 0.55]); % Fractions are between 0 and 1
- % Add exceed count conditionally above or below the bar
- barHeights = fractionExceed(iGroup, :);
- for iBand = 1:numBands
- exceedCount = round(barHeights(iBand) * totalPairs); % Calculate exceed count
- if barHeights(iBand) < 0.2
- % Place count above the bar
- text(iBand, barHeights(iBand) + 0.06500000000000000000000001, num2str(exceedCount), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10, 'VerticalAlignment', 'top'); %
- else
- % Place count below the top of the bar
- text(iBand, barHeights(iBand) + 0.065, num2str(exceedCount), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10, 'VerticalAlignment', 'top');
- end
- end
- % Store percentage of Alpha band exceedance for this iGroup
- alphaExceedPercent(iGroup) = barHeights(3) * 100; % Alpha band is iBand = 4
- end
- % Add super title
- sgtitle(['Fraction of Channel Pairs Out of 492 Exceeding permutated p=0.0001 WPLI value: ' num2str(averagePermutatedWPLIvalue)], 'FontSize', 6);
- % Calculate and display the average percentage of Alpha band exceedance
- averageAlphaPercent = mean(alphaExceedPercent);
- disp(['Average Percentage of Channel Pairs Exceeding Threshold for Alpha Band: ', num2str(averageAlphaPercent), '%']);
- % Display percentages for each group
- for group = 1:numGroups
- disp(['Group ', GroupNameWPLI{group}, ': ', num2str(alphaExceedPercent(group)), '%']);
- end
- % Set figure size
- set(gcf, 'PaperUnits', 'inches', 'PaperPosition', [0 0 4 2.5]); % 6x4 inches
- % Save as SVG
- saveDateFig4C = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- saveas(gcf, ['Fig4C_WPLI_exceed' saveDateFig4C '.svg']);
- saveas(gcf, ['Fig4C_WPLI_exceed' saveDateFig4C '.png']);
- %% Get Alpha Peak Amplitude and Alpha Peak Frequency *** fig4b
- iWPLICh = 1; % 1 = FP1
- jWPLICh = 5; % 5 = FC1
- for iStimGroup = 1:length(SubjGWPLI)
- groupMean = mean(DataPlot{iStimGroup});
- alphaMean = groupMean(13:23);
- [alphaPeakAmplitude, alphaPeakIndex] = max(groupMean(13:23));
- alphaFreqs = Fplot(13:23); % 13 to 23 should be 8 to 13 Hz
- alphaPeakFrequency = alphaFreqs(alphaPeakIndex);
- alphaPeakAmplitudeList(iWPLICh,jWPLICh,iStimGroup) = alphaPeakAmplitude;
- alphaPeakFrequencyList(iWPLICh,jWPLICh,iStimGroup) = alphaPeakFrequency;
- end
- % Create the actual plot fig4b (commented for getting alpha measurements) UNCOMMENT TO PLOT!
- figure;
- xrange = [0 37]; % x axis range (frequency)
- subplot('Position',[0.1 0.1 0.88 0.88])
- % Cut data down to 55Hz
- % Fplot55=Fplot(1:107);
- % DataPlot55 = cellfun(@(x) x(1:107), DataPlot, 'UniformOutput', false); % Works like this-> DataPlot55=DataPlot(1:107);
- RateHist_GroupPlot(Fplot,DataPlot,FlickerColor,ParamWPLI); %% Lu's function
- % Add a dotted line at averagePermutatedWPLIvalue
- yline(averagePermutatedWPLIvalue, '--', 'Color', 'k', 'LineWidth', 1.2);
- text(range(xrange)/2-5,ParamWPLI.Ytick(end),[EEGch{iWPLICh} '-' EEGch{jWPLICh}],'FontSize', 10);
- % set(gca,'xlim',[0 100],'xtick',[0:20:120],'ylim',[0 0.3],'ytick',ParamWPLI.Ytick);
- set(gca,'xlim',xrange,'xtick',[1 4 8 13 30 37 40 50 60 80 100],'ylim',[0 0.15],'ytick',[0 0.05 0.1 0.15]);
- xlabel('Frequency Hz')
- % xlim(xrange);
- ylabel('WPLI')
- title(['EEG Channel Pair: ' EEGch{iWPLICh} '-' EEGch{jWPLICh}]);
- ax=gca;
- ax.XGrid = 'on';
- ax.YGrid = 'off';
- ax.FontSize = 7; % Set the desired font size for tick marks
- LuFontStandard
- papersizePX=[0 0 8 8];
- papersizePX=1.3*[0 0 5 3.2]; % 09/09/24
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SubSaveFig '40LightRandBands_' EEGch{iWPLICh} '-' EEGch{jWPLICh}],'svg');
- % saveas(gcf,[SubSaveFig '40LightRandBands_' EEGch{iWPLICh} '-' EEGch{jWPLICh}],'tiff');
- close all
- nonzerosGroup1= nonzeros(alphaPeakAmplitudeList(:,:,1));
- nonzerosGroup2= nonzeros(alphaPeakAmplitudeList(:,:,2));
- nonzerosGroup3= nonzeros(alphaPeakAmplitudeList(:,:,3));
- AlphaPeakSaveFilename = fullfile(SaveFolder, 'AlphaPeakAmpAndFreq') %#ok<NOPTS>
- save(AlphaPeakSaveFilename,"alphaPeakAmplitudeList","alphaPeakFrequencyList");
- % papersizePX=[0 0 6*length(EEGchInd) 6*length(EEGchInd)];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllCh40Random' TrialTypeName{iCom}],'pdf');
- % saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllCh40Random' TrialTypeName{iCom}],'png');
- % saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllCh40Random' TrialTypeName{iCom} '.eps'],'epsc');
- close all
- close all
- %% Frequency Band Definition, for maps - May need to start running from here for Fig4
- BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- % Gamma-E is 40
- BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- FreqFunc{1}=@nanmean;
- FreqFunc{2}=@nanmedian;
- FreqFunc{3}=@nanmax;
- FreqFuncNames={'mean','median','peak'}; % Check three different spots in band - previously called 'FunGroupName'
- %comparison between groups w/ freq data
- diffTPmap=zeros(length(ChanEEGLab),length(ChanEEGLab),size(BOI,2),length(TrialType)); % for T test
- diffRPmap=diffTPmap;
- diffTmap=diffTPmap;
- rSpear=diffTPmap;
- pSpear=diffTPmap;
- % % TNodeTh=10;
- % FC_BrainEEGLu(ChanPos,AdjWeight,NodeWeight,Param)
- %% Preallocate ChannelPairName Cell Array
- signifChPairNameTopo = cell(3,3,3,3,2);
- signifChPairNameTopo{3,3,3,3,2} = [];
- % WPLIBResults = struct();
- %% FC parameters for plotting; (may contain p-value variable)
- clear FCpara
- FCpara.ColorMap=colorMapPN; %%%Color map for correlation link
- %% Create orange indigo colormap
- % Number of colors in the colormap
- n = 64;
- % Define orange and indigo RGB values
- orange = [1, 0.75, 0];
- indigo = [0.2, 0.1, 1];
- % Create a colormap by interpolating between orange and indigo
- custom_cmap = [linspace(indigo(1), orange(1), n)', ...
- linspace(indigo(2), orange(2), n)', ...
- linspace(indigo(3), orange(3), n)'];
- % Apply the custom colormap
- % colormap(custom_cmap);
- FCpara.ColorMap=custom_cmap; %%%Color map for correlation link
- %% Other parameters
- FCpara.NodeColor=[0.8 0.8 0.8]; %%%Node Color of Nodes for FC, not important, it is actually defined in ChanPos
- FCpara.Clim=[-1 1]; %%%Color Limit FC
- % FCpara.MarkerSize=8; %%%MarkerSize of scatter
- % FCpara.EdgeColor=[1 0 0]; %%% This is not needed as ColorMap field and Clim field would determine the edge color
- FCpara.EdgeTh=0.1; %%%
- FCpara.NodeTh=0.05; %%%
- FCparaT=FCpara; %%%%T test parameters
- FCparaT.EdgeTh=3; %%%
- FCparaT.NodeTh=0.001; %%%
- FCspear=FCpara; %%%%Spearman r parameters
- FCspear.EdgeTh=0.1; %%% This is the plotting threshold
- FCspear.NodeTh=0.001; %%%
- WPLIEdgeTh=0.6;
- WPLINodeTh=0.05;
- TEdgeTh=1;
- TNodeTh=0.001;
- pTEdgeTh=0.05;
- pSpearEdgeTh=0.05; %8/8/24 0.05 to 0.1
- rSpearEdgeTh=0.1;
- rSpearNodeTh=0.001;
- ScaleWPLI=0.5;
- ScaleT=1;
- ScaleSpear=0.2;
- % BOI=[5;15];
- BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- %% FC calculation - WPLI-Behavior - Spearman Topo Plots *** (old fig4c) fig4d fig4e fig4f
- FCpara.EdgeTh=0.1; %%%
- BOI=[2 4 8 8 10 13 30 39 43;4 8 13 10 13 30 37 41 100]; %[1 4 8 8 10 13 30 39.5 43;4 8 13 10 13 30 37 41.5 100];
- BandName={'Delta','Theta','Alpha','LowAlpha','HighAlpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- BandHzName={'2-4 Hz','4-8 Hz','8-13Hz','8-10Hz','10-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- for iFreqFunc=[3] %1:length(FreqFuncNames) % mean = 1, median =2, peak = 3
- todayDate = datestr(now, 'yymmdd');
- for iTrialType=3 %1:length(TrialType) % 1=Hit, 2=Miss, 3=HitANDMiss
- %% Create save folder
- SaveTemp=[SubSaveWPLI TrialTypeName{iTrialType} '\'];
- SaveTemp=[SaveTemp todayDate '_' FreqFuncNames{iFreqFunc} '_p' num2str(pSpearEdgeTh) '_colored\' ];
- mkdir(SaveTemp)
- %% WPLI figure - ALL groups (6 groups) & ALL BOI - *** (old fig4c) fig4d Complete version - see MS version below
- % Fig 4 C and D are composed of panels created by this section, cut and pasted together in
- % illustrator
- % FCpara.EdgeTh=0.06;
- % FCpara.EdgeTh=0.15; % previous arbitray threshold
- FCpara.EdgeTh=0.1202; % top quartile threshold
- % FCpara.EdgeTh=averagePermutatedWPLI_2to55_top0_0001; % = 0.0894 - top 0.0001 permutation threshold
- % FCpara.EdgeTh=averagePermutatedWPLI_2to55_top0_001; % = 0.0484 - top 0.001 permutation threshold
- FCgroups = [1,3,6]; % [1,3,6] = [40hz , Random, LightRT]
- figure;
- nGroups = length(FCgroups); % (1:3) Just first 3 groups
- for iBOI=1:size(BOI,2)-1
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<BOI(2,iBOI));
- for iStimGroup=1:length(FCgroups)
- if iFreqFunc==3
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),[],2),1));
- else
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),2),1));
- end
- EdgeColor=[0.8 0.8 0.8];
- % FC_BrainEEGLu(ChanPosColin27,MapGroup{iG,iFF,iCom},[],EdgeTh,NodeTh,EdgeColor,[])
- % axis off
- subplotLU(nGroups,size(BOI,2),iStimGroup,iBOI);
- % WPLIsForPlot(iStimGroup,iBOI,iTrialType) = MapGroup{iStimGroup,iBOI,iTrialType};
- % nChPairAboveThreshold(iStimGroup,iBOI,iTrialType) = sum(WPLIsForPlot>FCpara.EdgeTh);
- % Calculate the number of channel pairs with WPLI > EdgeTh
- currentMap = MapGroup{iStimGroup, iBOI, iTrialType};
- nChPairAboveThreshold = sum(currentMap(:) > FCpara.EdgeTh);
- AboveThreholdChannelPairAllGroups(iStimGroup,iBOI,iTrialType) = nChPairAboveThreshold;
- %%% The plotting function
- FC_BrainEEGLu(ChanPosColin27,MapGroup{iStimGroup,iBOI,iTrialType},[],FCpara)
- axis off
- % Add text below the plot
- text(0.5, -0.15, sprintf('Pairs > Th: %d', nChPairAboveThreshold), ...
- 'Units', 'normalized', 'HorizontalAlignment', 'center', 'FontSize', 10);
- if iStimGroup==nGroups
- xlabel(BandName{iBOI});
- text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- end
- if iBOI==1
- ylabel(GroupName{FCgroups(iStimGroup)})
- yt=text(0,0.1,0.1,GroupName{FCgroups(iStimGroup)},'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- end
- end
- % Define the edge threshold title
- edgeThresholdTitle = sprintf('Edge Threshold: %.4f', FCpara.EdgeTh);
- % Add the title displaying the edge threshold
- sgtitle(edgeThresholdTitle, 'FontSize', 6, 'FontWeight', 'bold', 'Interpreter', 'none');
- % % Add the title displaying the edge threshold and position it higher
- % titleHandle = sgtitle(edgeThresholdTitle, 'FontSize', 12);
- % titleHandle.Position = [0.5, 0.98, 0]; % [x, y, z] position in normalized figure units
- % subplot('position',[0.5 0.51 0.3 0.01]);
- % b=colorbar('southoutside');
- % set(gca,'xtick',[],'ytick',[])
- % set(b,'position',[0.5 0.5 0.3 0.03],'Limits',[0 1],'Ticks',[0 1],'Ticklabels',PowerLab);
- % xlabel(b,'Log Normalized Power')
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6*nGroups+3];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % Adjust title spacing relative to the subplots
- t = sgtitle(edgeThresholdTitle, 'FontSize', 6);
- % t.Position(2) = t.Position(2) + 0.03; % Raise the title slightly
- saveWPLIFigName = ['WPLI40_' num2str(nGroups) 'Groups_' num2str(100*FCpara.EdgeTh) 'E-2EdgeThrs620.png'];
- % saveas(gcf,[SaveTemp saveWPLIFigName],'pdf');
- saveas(gcf,[SaveTemp saveWPLIFigName],'png');
- saveas(gcf,[SaveTemp saveWPLIFigName],'svg');
- % saveas(gcf,[SaveTemp saveWPLIFigName],'epsc');
- FCpara.EdgeTh=0.1; % reset
- %% WPLI figure *** fig4d MS version
- % Fig 4 C and D are composed of panels created by this section, cut and pasted together in
- % illustrator
- % Lower Alpha and Upper Alpha only
- BOI=[8 10; 10 13]; %[1 4 8 8 10 13 30 39.5 43;4 8 13 10 13 30 37 41.5 100];
- BandName={'LowerAlpha','UpperAlpha'};
- BandHzName={'8-10Hz','10-13Hz'};
- % FCpara.EdgeTh=0.06;
- % FCpara.EdgeTh=0.15; % previous arbitray threshold
- FCpara.EdgeTh=0.1202; % top quartile threshold
- % FCpara.EdgeTh=averagePermutatedWPLI_2to55_top0_0001; % = 0.0894 - top 0.0001 permutation threshold
- % FCpara.EdgeTh=averagePermutatedWPLI_2to55_top0_001; % = 0.0484 - top 0.001 permutation threshold
- FCgroups = [1,3,6]; % [1,3,6] = [40hz , Random, LightRT]
- figure;
- nGroups = length(FCgroups); % (1:3) Just first 3 groups
- for iBOI=1:size(BOI,2) % just lower alpha and upper alpha
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<BOI(2,iBOI));
- for iStimGroup=1:length(FCgroups)
- if iFreqFunc==3
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),[],2),1));
- else
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{FCgroups(iStimGroup)},NeedI,EEGchInd,EEGchInd,iTrialType),2),1));
- end
- EdgeColor=[0.8 0.8 0.8];
- % FC_BrainEEGLu(ChanPosColin27,MapGroup{iG,iFF,iCom},[],EdgeTh,NodeTh,EdgeColor,[])
- % axis off
- % subplotLU(nGroups,size(BOI,2),iStimGroup,iBOI); % old 3x2
- % subplotLU(1, nGroups*size(BOI,2), 1, iStimGroup+3*(iBOI-1)); % 1x6 grid
- subplotLU(size(BOI,2), nGroups, iBOI, iStimGroup); % 2x3 grid
- % WPLIsForPlot(iStimGroup,iBOI,iTrialType) = MapGroup{iStimGroup,iBOI,iTrialType};
- % nChPairAboveThreshold(iStimGroup,iBOI,iTrialType) = sum(WPLIsForPlot>FCpara.EdgeTh);
- % Calculate the number of channel pairs with WPLI > EdgeTh
- currentMap = MapGroup{iStimGroup, iBOI, iTrialType};
- nChPairAboveThreshold = sum(currentMap(:) > FCpara.EdgeTh);
- AboveThreholdChannelPairAllGroups(iStimGroup,iBOI,iTrialType) = nChPairAboveThreshold;
- %%% The plotting function
- FC_BrainEEGLu(ChanPosColin27,MapGroup{iStimGroup,iBOI,iTrialType},[],FCpara)
- axis off
- % Add text below the plot
- % text(0.5, -0.15, sprintf('Pairs > Th: %d', nChPairAboveThreshold), ...
- % 'Units', 'normalized', 'HorizontalAlignment', 'center', 'FontSize', 10);
- if iStimGroup==2
- xlabel(BandName{iBOI});
- text(0.125,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',18)
- end
- xlabel(GroupName{FCgroups(iStimGroup)})
- yt=text(-0.125,0,0.1,GroupName{FCgroups(iStimGroup)},'horizontalalignment','center','verticalalignment','bottom','fontsize',14);
- end
- end
- % Define the edge threshold title
- % edgeThresholdTitle = sprintf('Edge Threshold: %.4f', FCpara.EdgeTh);
- % % Add the title displaying the edge threshold
- % sgtitle(edgeThresholdTitle, 'FontSize', 6, 'FontWeight', 'bold', 'Interpreter', 'none');
- % t.Position(2) = t.Position(2) + 0.05; % Move title slightly up
- % % Add the title displaying the edge threshold and position it higher
- % titleHandle = sgtitle(edgeThresholdTitle, 'FontSize', 12);
- % titleHandle.Position = [0.5, 0.98, 0]; % [x, y, z] position in normalized figure units
- % subplot('position',[0.5 0.51 0.3 0.01]);
- % b=colorbar('southoutside');
- % set(gca,'xtick',[],'ytick',[])
- % set(b,'position',[0.5 0.5 0.3 0.03],'Limits',[0 1],'Ticks',[0 1],'Ticklabels',PowerLab);
- % xlabel(b,'Log Normalized Power')
- LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2)*4 6/3*nGroups+3]; % 1x6
- % 3x2 grid: papersizePX=[0 0 6*size(BOI,2) 6*nGroups+3];
- papersizePX=[0 0 nGroups*6 size(BOI,2)*6+2.5]; % 2x3 : [0 0 width{x} heigth{y}]
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % Adjust title spacing relative to the subplots
- % t = sgtitle(edgeThresholdTitle, 'FontSize', 6);
- % t.Position(2) = t.Position(2) + 0.03; % Raise the title slightly
- % saveas(gcf,[SaveTemp saveWPLIFigName],'pdf');
- saveDateFig4D = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- saveWPLIFigName = ['WPLI40_' num2str(nGroups) 'Groups_' saveDateFig4D '_' num2str(100*FCpara.EdgeTh) 'E-2EdgeThrs620.png'];
- saveas(gcf,['Fig4Panels/' saveWPLIFigName ],'png');
- % saveas(gcf,['Fig4Panels/' saveWPLIFigName],'svg');
- % saveas(gcf,[SaveTemp saveWPLIFigName],'epsc');
- FCpara.EdgeTh=0.1; % reset
- %% Perform Chi-Squared on proportions on elevated channels: 40vL & 40VRand
- % Data
- total_pairs = 496;
- elevated_40Hz = 93;
- elevated_Light = 32;
- % Define contingency table
- table_40Hz_Light = [elevated_40Hz, total_pairs - elevated_40Hz;
- elevated_Light, total_pairs - elevated_Light];
- % % Perform chi-squared test and compute effect size
- % [chi2_40Hz_Light, p_40Hz_Light, V_40Hz_Light] = analyzeChiSquared(table_40Hz_Light, total_pairs);
- %
- % % Display results
- % fprintf('Results for 40Hz vs Light:\n');
- % fprintf('Chi-squared (X^2): %.2f\n', chi2_40Hz_Light);
- % fprintf('p-value: %.4f\n', p_40Hz_Light);
- % fprintf('Cramér''s V (Effect size): %.4f\n', V_40Hz_Light);
- %% Chi Squared Tests: 40vLight, 40vRandom for Lower and Upper Alpha Fig4D stats - OLD
- % Contingency tables for the tests
- % Lower Alpha:
- % 40Hz vs Light
- observed_LowerAlpha_40vLight = [93, 403;
- 32, 464];
- % Lower Alpha: 40Hz vs Random
- observed_LowerAlpha_40vRandom = [93, 403;
- 7, 489];
- % Upper Alpha:
- % 40Hz vs Light
- observed_UpperAlpha_40vLight = [63, 433;
- 7, 489];
- % Upper Alpha: 40Hz vs Random
- observed_UpperAlpha_40vRandom = [63, 433;
- 267, 229];
- % Perform chi-squared tests
- fprintf('Lower Alpha (40Hz vs Light):\n');
- [chi2_LA_40vLight, p_LA_40vLight, V_LA_40vLight, dof_LA_40vLight, total_LA_40vLight] = chi_squared_test(observed_LowerAlpha_40vLight);
- fprintf('\nLower Alpha (40Hz vs Random):\n');
- [chi2_LA_40vRandom, p_LA_40vRandom, V_LA_40vRandom, dof_LA_40vRandom, total_LA_40vRandom] = chi_squared_test(observed_LowerAlpha_40vRandom);
- fprintf('\nUpper Alpha (40Hz vs Light):\n');
- [chi2_UA_40vLight, p_UA_40vLight, V_UA_40vLight, dof_UA_40vLight, total_UA_40vLight] = chi_squared_test(observed_UpperAlpha_40vLight);
- fprintf('\nUpper Alpha (40Hz vs Random):\n');
- [chi2_UA_40vRandom, p_UA_40vRandom, V_UA_40vRandom, dof_UA_40vRandom, total_UA_40vRandom] = chi_squared_test(observed_UpperAlpha_40vRandom);
- % FDR correction:
- % Lower Alpha p-values
- p_values_LowerAlpha = [p_LA_40vLight, p_LA_40vRandom];
- % Upper Alpha p-values
- p_values_UpperAlpha = [p_UA_40vLight, p_UA_40vRandom];
- % Apply FDR correction to Lower Alpha and Upper Alpha
- adjusted_p_LowerAlpha = fdr_correction(p_values_LowerAlpha);
- adjusted_p_UpperAlpha = fdr_correction(p_values_UpperAlpha);
- % Display results
- disp('FDR-corrected p-values for Lower Alpha:');
- disp(adjusted_p_LowerAlpha);
- disp('FDR-corrected p-values for Upper Alpha:');
- disp(adjusted_p_UpperAlpha);
- % Display FDR-corrected p-values for Lower Alpha in scientific notation
- disp('FDR-corrected p-values for Lower Alpha (scientific notation):');
- fprintf('%.15e\n', adjusted_p_LowerAlpha);
- % Display FDR-corrected p-values for Upper Alpha in scientific notation
- disp('FDR-corrected p-values for Upper Alpha (scientific notation):');
- fprintf('%.15e\n', adjusted_p_UpperAlpha);
- %% Chi-squared test of top quartile ch pairs & permutated channel pairs - no longer needed 1/16/24
- % % Assuming AboveThresholdChannelPairAllGroupsTopQuart and
- % % AboveThresholdChannelPairAllGroupsPermutated are already loaded.
- %
- % % Set denominator for proportions
- % denominator = 496;
- %
- % % Extract dimensions
- % dims = size(AboveThreholdChannelPairAllGroupsTopQuart);
- %
- % % Initialize matrices for storing results
- % chi2_stat = zeros(dims); % Chi-squared statistic
- % p_value = zeros(dims); % P-value
- % h_test = zeros(dims); % Hypothesis test result (1: reject null, 0: fail to reject)
- %
- % % Loop through each element
- % for i = 1:dims(1)
- % for j = 1:dims(2)
- % for k = 1:dims(3)
- % % Observed data
- % obs1 = AboveThreholdChannelPairAllGroupsTopQuart(i,j,k);
- % obs2 = AboveThreholdChannelPairAllGroupsPermutated(i,j,k);
- %
- % % Proportions
- % prop1 = obs1 / denominator;
- % prop2 = obs2 / denominator;
- %
- % % Pooled proportion under null hypothesis
- % pooled_p = (obs1 + obs2) / (2 * denominator);
- %
- % % Expected counts under null hypothesis
- % exp1 = pooled_p * denominator;
- % exp2 = pooled_p * denominator;
- %
- % % Chi-squared statistic for this pair
- % chi2_stat(i,j,k) = ((obs1 - exp1)^2 / exp1) + ((obs2 - exp2)^2 / exp2);
- %
- % % Degrees of freedom
- % df = 1;
- %
- % % Compute p-value
- % p_value(i,j,k) = 1 - chi2cdf(chi2_stat(i,j,k), df);
- %
- % % Hypothesis test: reject null if p < 0.05
- % h_test(i,j,k) = p_value(i,j,k) < 0.05;
- % end
- % end
- % end
- %
- % % Display results for inspection
- % disp('Chi-squared statistics:');
- % disp(chi2_stat);
- %
- % disp('P-values (3D matrix):');
- % disp(p_value);
- %
- % disp('Hypothesis test results (3D matrix, 1: reject null, 0: fail to reject):');
- % disp(h_test);
- %% WPLI figure (Both Controls)
- % figure;
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<BOI(2,iBOI));
- % for iStimGroup=1:length(SubjG)
- % if iFreqFunc==3
- % Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{iStimGroup},NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- % MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{iStimGroup},NeedI,EEGchInd,EEGchInd,iTrialType),[],2),1));
- % else
- % Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(WPLIall(SubjG{iStimGroup},NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(WPLIall(SubjG{iStimGroup},NeedI,EEGchInd,EEGchInd,iTrialType),2),1));
- % end
- %
- % EdgeColor=[0.8 0.8 0.8];
- % % FC_BrainEEGLu(ChanPosColin27,MapGroup{iG,iFF,iCom},[],EdgeTh,NodeTh,EdgeColor,[])
- % % axis off
- %
- % subplotLU(2,size(BOI,2),iStimGroup,iBOI);
- % FC_BrainEEGLu(ChanPosColin27,MapGroup{iStimGroup,iBOI,iTrialType},[],FCpara)
- % axis off
- % if iStimGroup==2
- % xlabel(BandName{iBOI});
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- % end
- %
- % if iBOI==1
- % ylabel(GroupName{iStimGroup})
- % yt=text(0,0.1,0.1,GroupName{iStimGroup},'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % end
- % end
- % % subplot('position',[0.5 0.51 0.3 0.01]);
- % % b=colorbar('southoutside');
- % % set(gca,'xtick',[],'ytick',[])
- % % set(b,'position',[0.5 0.5 0.3 0.03],'Limits',[0 1],'Ticks',[0 1],'Ticklabels',PowerLab);
- % % xlabel(b,'Log Normalized Power')
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- % WPLI40BothControlsFigName = 'WPLI40BothControls620';
- % % saveas(gcf,[SaveTemp WPLI40BothControlsFigName],'pdf');
- % saveas(gcf,[SaveTemp WPLI40BothControlsFigName],'png');
- % % saveas(gcf,[SaveTemp WPLI40BothControlsFigName],'epsc');
- %% WPLI Difference Figure (VARIABLES NEED TO BE RENAMED IN THIS SECTION)
- % figure;
- % pTEdgeTh=0.1;
- % %comparison between groups w/ freq data
- % diffTPmap=zeros(length(ChanEEGLab),length(ChanEEGLab),size(BOI,2),length(TrialType)); % for T test
- % diffRPmap=diffTPmap;
- % diffTmap=diffTPmap;
- %
- % % Group selection: 1=40Hz, 2=Light, 3=Random, 4=LightRT
- % Group1 = 1;
- % Group2 = 2;
- %
- % for iBOI=1:size(BOI,2)-1 % minus 1 to remove BOI with 60 Hz
- % for iCh=1:length(ChanEEGLab)
- % for jCh=iCh+1:length(ChanEEGLab)
- % [~,diffTPmap(iCh,jCh,iBOI,iTrialType),~,stats]=ttest2(Tdata{Group1,iBOI,iTrialType}(:,iCh,jCh),Tdata{Group2,iBOI,iTrialType}(:,iCh,jCh));
- % [diffRPmap(iCh,jCh,iBOI,iTrialType),~,~]=ranksum(Tdata{Group1,iBOI,iTrialType}(:,iCh,jCh),Tdata{Group2,iBOI,iTrialType}(:,iCh,jCh));
- % diffTmap(iCh,jCh,iBOI,iTrialType)=stats.tstat;
- % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- % Adj=diffTmap(:,:,iBOI,iTrialType);
- % AdjP=diffTPmap(:,:,iBOI,iTrialType);
- % Adj(AdjP>pTEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCparaT)
- % axis off
- %
- % if iBOI==1
- % yt=text(-0.0,0.1,0.1,['T, Sig-Diff FC, ' GroupName{Group1} '-' GroupName{Group2} ],'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- %
- % % % subplotLU(2,size(BOI,2),2,iFF);
- % % % xlabel(BName{iFF});
- % % % text(0,-0.55,[BName{iFF} ' (' BName2{iFF} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- % % % if iFF==1
- % % % a=ylabel('40Hz-Random');
- % % % % a.Position=[0.01 0.5 0.03 0.4];
- % % % % a.verticalalignment='middle';
- % % % % set(a,'Position',[0.01 0.5 0.03 0.4],'Verticalalignment','middle')
- % % % set(a,'Verticalalignment','middle')
- % % % yt=text(-120,0,'P, 40-Rand.','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % % % end
- %
- % % xlabel(BName{iFF});
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % WPLIDiffFigName = ['WPLIDiff ' GroupName{Group1} '-' GroupName{Group2} ' p' num2str(pTEdgeTh)];
- % sgtitle(WPLIDiffFigName)
- %
- %
- % % saveas(gcf,[SaveTemp WPLIDiffBothControlsfigName],'pdf');
- % saveas(gcf,[SaveTemp WPLIDiffFigName '.png'],'png');
- % % saveas(gcf,[SaveTemp WPLIDiffBothControlsfigName],'epsc');
- %% Define Group Set Names - beginning of fig4e fig4f
- GroupSetsName{1} ='40andL'; % 40 and Light
- GroupSetsName{2}='40andR'; % 40 and Random
- GroupSetsName{3}='All3Groups'; % All three groups
- %% Loop thru all groups *** fig4e fig4f
- pSpearEdgeTh = 0.1;
- for iGroupSet = [1 2]% 1:length(GroupSetsName)
- if iGroupSet == 1
- %% 40&LightRT
- % included subs
- Group1 = 1; % 1= 40Hz flicker group
- Group2 = 6; % 2 = LightRT group
- dataName = [TrialTypeName{iTrialType} ' ' FreqFuncNames{iFreqFunc} ' p' num2str(pSpearEdgeTh) ' ' GroupName{Group1} GroupName{Group2}];
- IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 + LightRT
- elseif iGroupSet == 2
- %% 40andR
- Group1 = 1; % 1= 40Hz flicker group
- Group2 = 3; % 3 = Random group
- dataName = [TrialTypeName{iTrialType} ' ' FreqFuncNames{iFreqFunc} ' p' num2str(pSpearEdgeTh) ' ' GroupName{Group1} GroupName{Group2}];
- IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 + Random
- elseif iGroupSet == 3
- %% All3Groups
- Group1 = 1; % 1= 40Hz flicker group
- Group2 = 6; % 6 = LightRT
- Group3 = 3; % 3 = Random group
- dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2} GroupName{Group3}];
- IncludedSubj=union(SubjG{Group1},SubjG{Group2},SubjG{Group3}); %40 + LightRT + Random
- end
- %% Topo plot ALPHA GENERAL
- %% Define Bands of Interest
- % BOI=[8 8 10; 13 10 13];
- % BandName={'Alpha','LowAlpha','HighAlpha'};
- % BandHzName={'8-13Hz','8-10Hz','10-13Hz'};
- BOI=[ 8 10; 10 13];
- BandName={'LowAlpha','HighAlpha'};
- BandHzName={'8-10Hz','10-13Hz'};
- %% Spearman Acc-FC
- SpearmanAccFctopo = figure;
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- if iFreqFunc==3
- WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- else
- WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- end
- Acctemp=Acc(IncludedSubj);
- %% Include only subjects with high accuracy (>80%) - Accuracy cuts
- highAccThreshold = 0.8;
- highAccSubjectsIndex = Acctemp>highAccThreshold;
- WPLItemp = WPLItemp(highAccSubjectsIndex,:,:);
- Acctemp80 = Acctemp(highAccSubjectsIndex);
- %% loop thru each channel - calculate Spearman correlation R and p-value
- for iCh=1:length(ChanEEGLab)-1
- % for jCh=2:length(ChanEEGLab)
- [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),Acctemp80,'type','spearman','rows','pairwise');
- % end
- end
- subplotLU(1,size(BOI,2),1,iBOI); %can change to 2 for second row
- Adj=rSpear(:,:,iBOI,iTrialType); %32x32 of r values?
- AdjP=pSpear(:,:,iBOI,iTrialType); %32x32 of p values?
- Adj(AdjP>pSpearEdgeTh)=0; % deletes all r values of ch-pairs with p-value > threshold
- signifchPairRAccTopo = Adj~=0; % creates 32x32 logical of significant channel pairs
- signifChPairNameTopo{iFreqFunc,iTrialType,iGroupSet,iBOI,1} = getListofSignifChPairs(signifchPairRAccTopo,EEGch); % get list of channel names not equal to zero
- %% Now, plot only for significant positive WPLI-accuracy correlations
- % posWPLIAccChPairFolder = ['PositiveAccCorr\' GroupSetsName{iGroupSet} '\' BName{iBOI} '\'];
- % mkdir([SaveTemp posWPLIAccChPairFolder])
- % for iCh = 1:length(EEGchInd)
- % for jCh = iCh+1:length(EEGchInd)
- % % Check if the channel pair has a positive significant correlation
- % if Adj(iCh, jCh) > 0
- % clear DataPlot;
- %
- % for iStimGroup = 1:length(SubjGWPLI)
- % DataPlot{iStimGroup} = squeeze(WPLIall(SubjGWPLI{iStimGroup}, :, EEGchInd(iCh), EEGchInd(jCh), iTrialType));
- % Invalid = isnan(DataPlot{iStimGroup}(:, 1));
- % DataPlot{iStimGroup}(Invalid, :) = [];
- % end
- %
- % if isempty(DataPlot{1}) || isempty(DataPlot{2})
- % continue;
- % end
- %
- % iPlot = iPlot + 1;
- %
- % % Plot WPLI data for the channel pair
- % figure;
- % xrange = [0 50]; % Frequency range for x-axis
- % subplot('Position', [0.1 0.1 0.88 0.88]);
- % RateHist_GroupPlot(Fplot, DataPlot, FlickerColor, ParamWPLI); % Custom function for plotting
- %
- % text(range(xrange)/2 - 5, ParamWPLI.Ytick(end), [EEGch{iCh} '-' EEGch{jCh}], 'FontSize', 10); % Add channel pair label
- % set(gca, 'xlim', xrange, 'xtick', [1 4 8 13 30 40 50 60 80 100], 'ylim', [0 0.2], 'ytick', ParamWPLI.Ytick);
- % xlabel('Frequency (Hz)');
- % ylabel('WPLI');
- %
- % % Formatting for grid and font size
- % ax = gca;
- % ax.XGrid = 'on';
- % ax.YGrid = 'off';
- % ax.FontSize = 7;
- %
- % % Set paper size and save the figure
- % LuFontStandard; % Custom function for standard fonts
- % papersizePX = 1.3 * [0 0 5 3.2]; % Custom figure size
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf, 'PaperPosition', papersizePX, 'PaperSize', papersizePX(3:4));
- %
- % % Save the figure in SVG format
- % % saveas(gcf, [SaveTemp 'PositiveAccCorr\' '40LightRandBands_' EEGch{iCh} '-' EEGch{jCh}], 'svg');
- % saveas(gcf, [SaveTemp posWPLIAccChPairFolder 'WPLI_40LR_' EEGch{iCh} '-' EEGch{jCh}], 'png');
- % end
- % end
- % end
- % figure(SpearmanAccFctopo);
- %% PLotting and axises ****fig4e
- FC_BrainEEGLu(ChanPosColin27,Adj,[sum(Adj,1)/2],FCspear) % plotting function! (3rd parameter is node weight)
- nSignifChPairs = sum(AdjP<pSpearEdgeTh & AdjP>0, 'all');
- axis off
- if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-Acc','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- text(-0.11,0,-0.1,['nChpairs=' num2str(nSignifChPairs)],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==2
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0]) % MKA 9/23
- % title(dataName, 'Units', 'normalized', 'Position', [0, 0.9, 0])
- end
- %% Display the list of significant channel pairs below the subplot
- % signifChPairNames = getListofSignifChPairs(signifchPairRAccTopo, EEGch);
- % % text(0.5, -0.2, strjoin(signifChPairNames, ', '), 'Units', 'normalized', 'HorizontalAlignment', 'center', 'FontSize', 8);
- % % verticalSignifChPairs = strjoin(signifChPairNames, '\n');
- % % text(-0.11, -0.2, verticalSignifChPairs, 'Units', 'normalized', 'HorizontalAlignment', 'center', 'FontSize', 8);
- %
- % % New subplot for channel pair names (as three columns)
- % subplotLU(2, size(BOI, 2), 2, iBOI); % New row (2nd row) for the names
- %
- % % Divide the list into three columns
- % numNames = length(signifChPairNames);
- % numPerCol = ceil(numNames / 3);
- %
- % % Split the list of significant channel pairs into three columns
- % col1 = signifChPairNames(1:numPerCol);
- % col2 = signifChPairNames(numPerCol+1:min(2*numPerCol, numNames));
- % col3 = signifChPairNames(2*numPerCol+1:end);
- %
- % % Prepare the text to display in columns
- % colText = sprintf('%s\n', col1{:});
- % colText2 = sprintf('%s\n', col2{:});
- % colText3 = sprintf('%s\n', col3{:});
- %
- % % Display the three columns of significant channel pairs
- % text(0.2, 0.5, colText, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % text(0.5, 0.5, colText2, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % text(0.8, 0.5, colText3, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % axis off
- end
- %% Set up and save figure
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6+2]; % size of paper - height and width of brain plot 9/10. gain increase the papersize to try to increase the resolution
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- SpearmanFCAccName1 = ['SpearmanFCAcc_ALPHA' '_' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'pdf');
- saveas(gcf,[SaveTemp SpearmanFCAccName1 '.png'],'png');
- print(gcf, '-dsvg', [SaveTemp SpearmanFCAccName1 '.svg'] , '-r0'); % -r0 ensures full vector output.
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'svg'); % -r0 ensures full vector output.);
- % saveas(gcf,[SaveTemp SpearmanFCAccName1 '.eps'],'epsc');
- close all
- %% Spearman RT-FC - Topo plot GENERAL ALPHA ***fig4f
- SpearmanRTFCtopo = figure;
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- if iFreqFunc==3
- WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- else
- WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- end
- RTtemp=SubjsAvgRT(IncludedSubj);
- %% Include only subjects with high accuracy (>80%) - Accuracy cuts
- highAccThreshold = 0.8;
- highAccSubjectsIndex = Acctemp>highAccThreshold;
- WPLItemp = WPLItemp(highAccSubjectsIndex,:,:);
- RTtemp = RTtemp(highAccSubjectsIndex);
- %%
- for iCh=1:length(ChanEEGLab)-1
- % for jCh=2:length(ChanEEGLab)
- [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),RTtemp,'type','spearman','rows','pairwise');
- % end
- end
- subplotLU(1,size(BOI,2),1,iBOI); %can change to 2 for second row
- Adj=rSpear(:,:,iBOI,iTrialType); %32x32 of r values?
- AdjP=pSpear(:,:,iBOI,iTrialType); %32x32 of p values?
- Adj(AdjP>pSpearEdgeTh)=0;
- signifchPairRRTTopo = Adj~=0; % creates 32x32 logical of significant channel pairs
- signifChPairNameTopo{iFreqFunc,iTrialType,iGroupSet,iBOI,2} = getListofSignifChPairs(signifchPairRRTTopo,EEGch); % get list of channel names not equal to zero
- %% Now, plot only for significant negative WPLI-accuracy correlations
- % negWPLIRTChPairFolder = ['NegativeRTCorr\' GroupSetsName{iGroupSet} '\' BName{iBOI} '\'];
- % mkdir([SaveTemp negWPLIRTChPairFolder])
- % for iCh = 1:length(EEGchInd)
- % for jCh = iCh+1:length(EEGchInd)
- % % Check if the channel pair has a positive significant correlation
- % if Adj(iCh, jCh) < 0
- % clear DataPlot;
- %
- % for iStimGroup = 1:length(SubjGWPLI)
- % DataPlot{iStimGroup} = squeeze(WPLIall(SubjGWPLI{iStimGroup}, :, EEGchInd(iCh), EEGchInd(jCh), iTrialType));
- % Invalid = isnan(DataPlot{iStimGroup}(:, 1));
- % DataPlot{iStimGroup}(Invalid, :) = [];
- % end
- %
- % if isempty(DataPlot{1}) || isempty(DataPlot{2})
- % continue;
- % end
- %
- % iPlot = iPlot + 1;
- %
- % % Plot WPLI data for the channel pair
- % figure;
- % xrange = [0 50]; % Frequency range for x-axis
- % subplot('Position', [0.1 0.1 0.88 0.88]);
- % RateHist_GroupPlot(Fplot, DataPlot, FlickerColor, ParamWPLI); % Custom function for plotting
- %
- % text(range(xrange)/2 - 5, ParamWPLI.Ytick(end), [EEGch{iCh} '-' EEGch{jCh}], 'FontSize', 10); % Add channel pair label
- % set(gca, 'xlim', xrange, 'xtick', [1 4 8 13 30 40 50 60 80 100], 'ylim', [0 0.2], 'ytick', ParamWPLI.Ytick);
- % xlabel('Frequency (Hz)');
- % ylabel('WPLI');
- %
- % % Formatting for grid and font size
- % ax = gca;
- % ax.XGrid = 'on';
- % ax.YGrid = 'off';
- % ax.FontSize = 7;
- %
- % % Set paper size and save the figure
- % LuFontStandard; % Custom function for standard fonts
- % papersizePX = 1.3 * [0 0 5 3.2]; % Custom figure size
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf, 'PaperPosition', papersizePX, 'PaperSize', papersizePX(3:4));
- %
- % % Save the figure in SVG format
- % % saveas(gcf, [SaveTemp 'PositiveAccCorr\' '40LightRandBands_' EEGch{iCh} '-' EEGch{jCh}], 'svg');
- % saveas(gcf, [SaveTemp negWPLIRTChPairFolder 'WPLI_40LR_' EEGch{iCh} '-' EEGch{jCh}], 'png');
- % end
- % end
- % end
- % figure(SpearmanRTFCtopo);
- %% Plot & axises ***fig4f
- FC_BrainEEGLu(ChanPosColin27,Adj,[sum(Adj,1)/2],FCspear)
- nSignifChPairs = sum(AdjP<pSpearEdgeTh & AdjP>0, 'all');
- axis off
- if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-RT','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- text(-0.11,0,-0.1,['nChpairs=' num2str(nSignifChPairs)],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==2
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0]) % MKA 9/23
- % title(dataName, 'Units', 'normalized', 'Position', [0, 0.9, 0])
- end
- %% Display the list of significant channel pairs below the subplot
- % signifChPairNames = getListofSignifChPairs(signifchPairRRTTopo, EEGch);
- %
- % % New subplot for channel pair names (as three columns)
- % subplotLU(2, size(BOI, 2), 2, iBOI); % New row (2nd row) for the names
- %
- % % Divide the list into three columns
- % numNames = length(signifChPairNames);
- % numPerCol = ceil(numNames / 3);
- %
- % % Split the list of significant channel pairs into three columns
- % col1 = signifChPairNames(1:numPerCol);
- % col2 = signifChPairNames(numPerCol+1:min(2*numPerCol, numNames));
- % col3 = signifChPairNames(2*numPerCol+1:end);
- %
- % % Prepare the text to display in columns
- % colText = sprintf('%s\n', col1{:});
- % colText2 = sprintf('%s\n', col2{:});
- % colText3 = sprintf('%s\n', col3{:});
- %
- % % Display the three columns of significant channel pairs
- % text(0.2, 0.5, colText, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % text(0.5, 0.5, colText2, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % text(0.8, 0.5, colText3, 'Units', 'normalized', 'HorizontalAlignment', 'left', 'FontSize', 6);
- % axis off
- end
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6+2];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- SpearmanFCRTName2 = ['SpearmanFCRT_ALPHA' '_' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCRTName2],'pdf');
- saveas(gcf,[SaveTemp SpearmanFCRTName2 '.png'],'png');
- saveas(gcf,[SaveTemp SpearmanFCRTName2 '.svg'],'svg');
- % saveas(gcf,[SaveTemp SpearmanFCRTName2 '.eps'],'epsc');
- close all
- end
- %% Spearman Acc-FC - Topo plot (pre 6/18/24) 40 vs Light (All BANDS)
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 2; % 2 = Light group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Light
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % WPLIijChPair = squeeze(WPLItemp(:,iCh,iCh+1:end));
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(WPLIijChPair,Acctemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-Acc','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==4
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCAccName1 = ['SpearmanFCAcc' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'png');
- % saveas(gcf,[SaveTemp SpearmanFCAccName1 '.eps'],'epsc');
- % close all
- %% Spearman Acc-FC - Topo plot (pre 6/18/24) (40 vs Light) ALPHA
- % BOI=[8 8 10; 13 10 13];
- % BandName={'Alpha','LowAlpha','HighAlpha'};
- % % Gamma-E is 40
- % BandHzName={'8-13Hz','8-10Hz','10-13Hz',};
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 2; % 2 = Light group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 + Light
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),Acctemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- %
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-Acc','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==2
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCAccName1 = ['SpearmanFCAccALPHA_p' num2str(pSpearEdgeTh*100) '_' dataName];
- % % saveas(gcf,[SaveTemp SpearmanFCAccName1],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'png');
- % % saveas(gcf,[SaveTemp SpearmanFCAccName1 '.eps'],'epsc');
- % close all
- %% Spearman Acc-FC - Topo plot (40 vs Random) All BANDS
- % BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- % BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- % % Gamma-E is 40
- % BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 3; % 3 = Random group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{1},SubjG{3}); % 40 vs Random
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),Acctemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-Acc','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- % if iBOI==4
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- % SpearmanFCAccfigName = ['SpearmanFCAcc' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCAccfigName],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCAccfigName],'png');
- % saveas(gcf,[SaveTemp SpearmanFCAccfigName 'eps'],'epsc');
- % close all
- %% Spearman Acc-FC - Topo plot (40+RANDOM) ALPHA
- % BOI=[8 8 10; 13 10 13];
- % BandName={'Alpha','LowAlpha','HighAlpha'};
- % % Gamma-E is 40
- % BandHzName={'8-13Hz','8-10Hz','10-13Hz',};
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 3; % 2 = Random group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Random
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),Acctemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-Acc','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==2
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCAccName1 = ['SpearmanFCAccALPHA' dataName];
- % % saveas(gcf,[SaveTemp SpearmanFCAccName1],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCAccName1],'png');
- % % saveas(gcf,[SaveTemp SpearmanFCAccName1 '.eps'],'epsc');
- % close all
- %% Spearman RT-FC - Topo plot (40+Light) ALL BANDS
- % BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- % BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- % % Gamma-E is 40
- % BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- %
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 2; % 2 = Light group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Light
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % RTtemp=SubjsAvgRT(IncludedSubj);
- % %Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),RTtemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-RT','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==4
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCRTName1 = ['SpearmanFCRT' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCRTName1],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCRTName1],'png');
- % saveas(gcf,[SaveTemp SpearmanFCRTName1 '.eps'],'epsc');
- % close all
- %% Spearman RT-FC - Topo plot (40 vs Random) ALL BANDS
- % BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- % BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- % % Gamma-E is 40
- % BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 3; % 3 = Random group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Light
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % RTtemp=SubjsAvgRT(IncludedSubj);
- % %Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),RTtemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-RT','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==4
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCRTName2 = ['SpearmanFCRT' dataName];
- % saveas(gcf,[SaveTemp SpearmanFCRTName2],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCRTName2],'png');
- % saveas(gcf,[SaveTemp SpearmanFCRTName2 '.eps'],'epsc');
- % close all
- %% Spearman RT-FC - Topo plot (40+Light) ALPHA ONLY
- % BOI=[8 8 10; 13 10 13];
- % BandName={'Alpha','LowAlpha','HighAlpha'};
- % % Gamma-E is 40
- % BandHzName={'8-13Hz','8-10Hz','10-13Hz',};
- %
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 2; % 2 = Light group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Light
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % RTtemp=SubjsAvgRT(IncludedSubj);
- % %Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),RTtemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-RT','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==4
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCRTName1 = ['SpearmanFCRTALPHA' dataName];
- % % saveas(gcf,[SaveTemp SpearmanFCRTName1],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCRTName1],'png');
- % saveas(gcf,[SaveTemp SpearmanFCRTName1 '.eps'],'epsc');
- % close all
- %% Spearman RT-FC - Topo plot (40 vs Random) ALPHA ONLY
- % BOI=[8 8 10; 13 10 13];
- % BandName={'Alpha','LowAlpha','HighAlpha'};
- % % Gamma-E is 40
- % BandHzName={'8-13Hz','8-10Hz','10-13Hz',};
- %
- % figure;
- %
- % Group1 = 1; % 1= 40Hz flicker group
- % Group2 = 3; % 3 = Random group
- % dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- %
- % IncludedSubj=union(SubjG{Group1},SubjG{Group2}); %40 vs Random
- % for iBOI=1:size(BOI,2)
- % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % if iFreqFunc==3
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),[],2));
- %
- % else
- % WPLItemp=squeeze(FreqFunc{iFreqFunc}(WPLIall(IncludedSubj,NeedI,EEGchInd,EEGchInd,iTrialType),2));
- % end
- % RTtemp=SubjsAvgRT(IncludedSubj);
- % %Acctemp=Acc(IncludedSubj);
- %
- % for iCh=1:length(ChanEEGLab)-1
- % % for jCh=2:length(ChanEEGLab)
- % [rSpear(iCh,iCh+1:end,iBOI,iTrialType),pSpear(iCh,iCh+1:end,iBOI,iTrialType)]=corr(squeeze(WPLItemp(:,iCh,iCh+1:end)),RTtemp,'type','spearman','rows','pairwise');
- % % end
- % end
- % subplotLU(1,size(BOI,2),1,iBOI);
- %
- % Adj=rSpear(:,:,iBOI,iTrialType);
- % AdjP=pSpear(:,:,iBOI,iTrialType);
- % Adj(AdjP>pSpearEdgeTh)=0;
- % FC_BrainEEGLu(ChanPosColin27,Adj,[],FCspear)
- % axis off
- % if iBOI==1
- % yt=text(0,0.1,0.1,'Sig-Corr. FC-RT','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % text(-0.1,0,0.1,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % if iBOI==2
- % title(dataName, 'Units', 'normalized', 'Position', [0.5, 0.9, 0])
- % end
- % end
- %
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6+2];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- %
- %
- % SpearmanFCRTName2 = ['SpearmanFCRTALPHA' dataName];
- % % saveas(gcf,[SaveTemp SpearmanFCRTName2],'pdf');
- % saveas(gcf,[SaveTemp SpearmanFCRTName2],'png');
- % % saveas(gcf,[SaveTemp SpearmanFCRTName2 '.eps'],'epsc');
- % close all
- end
- end
- close all
- %% PSD fig2b
- SubSavePSD=[SavePath 'PSD\'];
- PowerLim=[-7 -2];
- PowerLab={'-7' '-2'};
- TLim=[-5 5];
- TLab={'-5' '5'};
- PLim=[-4 4];
- PLab={'10e-4' '10e-0'};
- for iFreqFunc=1:length(FreqFuncNames)
- clear MapGroup diffTmap diffMap Tdata;
- clear diffTPmap diffRPmap diffTmap
- for iTrialType=1:length(TrialType)
- % iCom=1;
- SaveTemp=[SubSavePSD TrialTypeName{iTrialType} '\'];
- SaveTemp=[SaveTemp FreqFuncNames{iFreqFunc} '\' ];
- mkdir(SaveTemp)
- % Band of interest
- BOI=[5;15];
- BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- %
- figure;
- IncludedSubj=union(SubjG{1},SubjG{2});
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % for iCh=1:length(ChanEEGLab)
- if iFreqFunc==3
- PSDtemp=squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),[],2));
- else
- PSDtemp=squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),2));
- end
- Acctemp=Acc(IncludedSubj); % Behavior accuracy
- % Power and acuracy correlation
- [rSpear(:,iBOI,iTrialType),pSpear(:,iBOI,iTrialType)]=corr(PSDtemp,Acctemp,'type','spearman','rows','pairwise');
- % end
- %% Visualize the data with topoplot in eeglab
- subplotLU(2,size(BOI,2),1,iBOI);
- topoplot(rSpear(:,iBOI,iTrialType), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-1 1]);
- if iBOI==1
- yt=text(-0.55,0,'EEG-Behavior R','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- b=colorbar('southoutside');set(b,'position',[0.52 0.93 0.2 0.01],'xtick',[-1 1],'xticklabel',{'-1' '1'},'xlim',[-1 1]);
- xlabel(b,'PSD-Acc Correlation','verticalalignment','top')
- end
- subplotLU(2,size(BOI,2),2,iBOI);
- topoplot(log10(pSpear(:,iBOI,iTrialType)), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-4 4]); % p-value
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==1
- a=ylabel('40Hz-BothControls');
- % set(a,'position',[0.01 0.5 0.03 0.4],'verticalalignment','middle')
- set(a,'verticalalignment','middle')
- yt=text(-0.55,0,'P EEG-Behavior','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- % c=colorbar('southoutside');set(c,'position',[0.52 0.46 0.2 0.03],'xtick',[-4 0],'xticklabel',{'10e-4' '10e-0'},'xlim',[-4 0]);
- % xlabel(c,'P values','verticalalignment','top')
- c=colorbar('southoutside');
- set(gca,'xtick',[],'ytick',[])
- set(c,'position',[0.52 0.51 0.2 0.01],'Limits',[PLim(1) 0],'ticks',[PLim(1) 0],'ticklabels',PLab);
- xlabel(c,'P values','verticalalignment','top')
- end
- end
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SaveTemp 'SpearmanPSDAcc'],'pdf');
- saveas(gcf,[SaveTemp 'SpearmanPSDAcc'],'png');
- saveas(gcf,[SaveTemp 'SpearmanPSDAcc.eps'],'epsc');
- close all
- %% Scatter plot with behavior - PSDAcc fig
- IncludedSubj=[SubjG{1}(:);SubjG{2}(:)];
- FlickerID=[zeros(size(SubjG{1}(:)))+1;zeros(size(SubjG{2}(:)))+2];
- Param.Corr='Spearman'; %%%Type of correlation, see Matlab function corr for more details
- Param.Pth=0.05; %%%threshold of Pvalue
- Param.ColorMap=colorMapPN; %%%Color map for correlation link
- Param.NodeColor=repmat([0.8 0.8 0.8],6,1); %%%Color of Nodes for correlation link plot
- Param.Clim=[-0.6 0.6]; %%%Color Limit for Correlation
- Param.Title='Pool All Sample'; %%Any title for label the figure
- Param.MarkerSize=8; %%%MarkerSize of scatter
- Param.SubjIDColor=FlickerColor;
- Param.SubjID=FlickerID;
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- figure;
- % for iCh=1:length(ChanEEGLab)
- if iFreqFunc==3
- PSDtemp=squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),[],2));
- else
- PSDtemp=squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),2));
- end
- Acctemp=Acc(IncludedSubj);
- tempName=EEGch;
- tempName{end+1}='Acc';
- multiCorr2GroupSubplot(6,6,[PSDtemp Acctemp],size(PSDtemp,2)+1,tempName,Param)
- LuFontStandard;
- papersizePX=[0 0 6*6 6*6];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SaveTemp Param.Corr BandName{iBOI} BandHzName{iBOI} 'PSDAcc'],'pdf');
- saveas(gcf,[SaveTemp Param.Corr BandName{iBOI} BandHzName{iBOI} 'PSDAcc'],'png');
- saveas(gcf,[SaveTemp Param.Corr BandName{iBOI} BandHzName{iBOI} 'PSDAcc.eps'],'epsc');
- close all
- end
- end
- %
- % close all
- %
- end
- FreqFunc{1}=@nanmean;
- FreqFunc{2}=@nanmedian;
- FreqFunc{3}=@nanmax;
- FreqFuncNames={'mean','median','peak'};
- diffTPmap=zeros(length(ChanEEGLab),length(ChanEEGLab),size(BOI,2),length(TrialType));
- diffRPmap=diffTPmap;
- diffTmap=diffTPmap;
- rSpear=diffTPmap;
- pSpear=diffTPmap;
- % % TNodeTh=10;
- COHEdgeTh=0.2;
- COHNodeTh=0.01;
- TEdgeTh=3;
- TNodeTh=0.001;
- pTEdgeTh=0.05;
- pSpearEdgeTh=0.05;
- rSpearEdgeTh=0.1;
- rSpearNodeTh=0.001;
- ScaleCOH=0.5;
- ScaleT=1;
- ScaleSpear=0.2;
- close all
- %% PSD all three groups together plot- Ranktest fig2b
- SubSavePSD=[SavePath 'PSD\'];
- % SubSaveCOH=[SavePath 'COH\'];
- ParamPSD.Ytick = [-8.1:3:-2.1];
- ParamPSD.SigPlot='Ranktest';
- saveDate = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- SubSavePSD=[SubSavePSD 'Ranktest_' saveDate '\'];
- mkdir(SubSavePSD)
- for iTrialType=3 %1:length(TrialType)
- SaveTemp=[SubSavePSD TrialTypeName{iTrialType} '\'];
- mkdir(SaveTemp)
- SubSaveFig=[SaveTemp 'Chan\'];
- mkdir(SubSaveFig)
- FBand=[1 55];
- %% HzAllChPSD40Random
- figure;
- for iCh=1:length(EEGchInd)
- clear DataPlot
- for iStimGroup=1:length(SubjG)
- DataPlot{iStimGroup}= squeeze(LogPSD(SubjG{iStimGroup},:,EEGchInd(iCh),iTrialType));
- Invalid=isnan(DataPlot{iStimGroup}(:,1));
- DataPlot{iStimGroup}(Invalid,:)=[];
- end
- if isempty(DataPlot{1})||isempty(DataPlot{2})
- continue;
- end
- % subplotLUpage(6,6,iCh);
- ParamPSD.PathSave=[SaveTemp '40LightRandCh' EEGch{iCh}];
- % figure;
- % subplot('Position',[0.1 0.1 0.88 0.88])
- [~,FlickComStatis{iTrialType,iCh}]=RateHist_GroupPlot(Fplot,DataPlot,FlickerColor,ParamPSD); %plot and stats,
- text(27.5,-2,EEGch{iCh}); % text(27.5,0.3,EEGch{iCh}); %pre 6/14/24
- set(gca,'xlim',FBand,'xtick',[1 4 8 13 30 37 39 41 43 55],'ylim',[-7 -2],'ytick',[-7 -6 -5 -4 -3 -2]);
- xlabel('Frequency Hz')
- ylabel('Normalized Power (Log)')
- ax=gca;
- ax.XGrid = 'on';
- ax.YGrid = 'off';
- LuFontStandard
- papersizePX=[0 0 12 12];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SubSaveFig 'ThreeGroup_' EEGch{iCh}],'tiff');
- saveas(gcf,[SubSaveFig 'ThreeGroup_' EEGch{iCh}],'png');
- saveas(gcf,[SubSaveFig 'ThreeGroup_' EEGch{iCh}],'svg');
- saveas(gcf,[SubSaveFig 'ThreeGroup_' EEGch{iCh} '.eps'],'epsc');
- close all
- end
- %
- papersizePX=[0 0 6*6 6*6];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllChPSD40LightRand' TrialTypeName{iTrialType}],'pdf');
- saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllChPSD40LightRand' TrialTypeName{iTrialType}],'png');
- saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllChPSD40LightRand' TrialTypeName{iTrialType}],'svg');
- saveas(gcf,[SaveTemp num2str(FBand(1)) '-' num2str(FBand(2)) 'HzAllChPSD40LightRand' TrialTypeName{iTrialType} '.eps'],'epsc');
- end
- close all
- ParamPSD.Ytick=[-8:4:0]; % reset this param to original value to not mess up other functions: ParamPSD.Ytick=[-8:4:0];
- %% Set-up FOOOF save folder
- fooof_starttime = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- fooof_save_folder=['FOOOF Results' '\' fooof_starttime '\'];
- mkdir(fooof_save_folder)
- %% Plot single FOOOF PSD
- % set up fooof input variables:
- allFreqs = Fplot; % = row vector of frequency values
- iStimGroup = 3; % 1=40; 2=Light, 3=Random;
- trialtype = 3; % 3=HIT&MISS
- singleFOOOFEEGCh = 1;
- subjectNumInStimGroup = 1;
- input_power_spectrum = PSDall(SubjG{iStimGroup}(subjectNumInStimGroup),:,singleFOOOFEEGCh,trialtype); % size(PSDall) = 67 197 40 3
- % PSDall(participants, frequencies, channels, trialtypes)
- f_range = [2 55]; % f_range = fitting range - !!different upper ranges yield different results
- % set default settings values - % settings = fooof model settings, in a struct
- settings = struct(...
- 'peak_width_limits', [0.5, 12], ...
- 'max_n_peaks', Inf, ...
- 'min_peak_height', 0.0, ...
- 'peak_threshold', 2.0, ...
- 'aperiodic_mode', 'fixed', ...
- 'verbose', true);
- return_model = 1; % return_model = boolean of whether to return the FOOOF model fit, optional
- % run fooof:
- firstsubjectfirstCh = fooof(Fplot, input_power_spectrum, f_range, settings, return_model);
- % Plot FOOOF results:
- % Extract data from the results structure
- fooof_freqs = firstsubjectfirstCh.freqs; % Frequency values
- power_spectrum = firstsubjectfirstCh.power_spectrum; % Original power spectrum
- % fooofed_spectrum = firstsubjectfirstCh.fooofed_spectrum; % Full FOOOF fit
- ap_fit = firstsubjectfirstCh.ap_fit; % Aperiodic fit
- difference_spectrum = power_spectrum - ap_fit;
- % fooofed_difference_spectrum = fooofed_spectrum - ap_fit;
- % Plot settings
- figure;
- hold on;
- % Plot the original power spectrum
- plot(fooof_freqs, power_spectrum, 'k', 'LineWidth', 1.5, 'DisplayName', 'Power Spectrum');
- % Plot the FOOOFed spectrum (from fooof results)
- % plot(fooof_freqs, fooofed_spectrum, 'r', 'LineWidth', 1.5, 'DisplayName', 'FOOOFed Spectrum');
- % Plot the aperiodic fit
- plot(fooof_freqs, ap_fit, 'b--', 'LineWidth', 1.5, 'DisplayName', 'Aperiodic Fit');
- % Plot the difference spectrum (subtracted in MATLAB)
- plot(fooof_freqs, difference_spectrum, 'g--', 'LineWidth', 1.5, 'DisplayName', 'Adjusted Spectrum (PS-ApFit)');
- % % Plot the FOOOFed difference spectrum (subtracted in MATLAB)
- % plot(fooof_freqs, fooofed_difference_spectrum, '--', 'LineWidth', 1.5, 'DisplayName', 'fooofedSpect minus apfit');
- % Set logarithmic scale for frequency
- % set(gca, 'XScale', 'log'); % Logarithmic x-axis
- % set(gca, 'YScale', 'log'); % Logarithmic y-axis
- % Add labels, legend, and grid
- xlabel('Frequency (Hz)');
- ylabel('Power');
- legend_handle = legend('show');
- % legend('show');
- grid on;
- % Position the legend in the middle right of the plot
- set(legend_handle, 'Location', 'east');
- fooof_figname = ['S' num2str(SubjG{iStimGroup}(subjectNumInStimGroup)) '_FOOOF_' EEGch{singleFOOOFEEGCh} '_' num2str(f_range(1)) '-' num2str(f_range(2)) ' Hz'];
- title(['S' num2str(SubjG{iStimGroup}(subjectNumInStimGroup)) ' (' GroupName{iStimGroup} ') - Ch:' EEGch{singleFOOOFEEGCh} ' - ' num2str(f_range(1)) '-' num2str(f_range(2)) ' Hz']);
- hold off;
- % Save the figure as a single file
- saveas(gcf, [fooof_save_folder fooof_figname '.png']);
- %% FOOOF PSD - prep for fig2c
- % set up fooof input variables:
- allFreqs = Fplot; % = row vector of frequency values
- f_range = [2 45]; % f_range = fitting range
- % set default settings values - % settings = fooof model settings, in a struct
- settings = struct(...
- 'peak_width_limits', [0.5, 12], ...
- 'max_n_peaks', Inf, ...
- 'min_peak_height', 0.0, ...
- 'peak_threshold', 2.0, ...
- 'aperiodic_mode', 'fixed', ...
- 'verbose', true);
- return_model = 1; % return_model = boolean of whether to return the FOOOF model fit, optional
- trialType = 3;
- input_power_spectrum = PSDall(SubjG{iStimGroup}(1),:,1,trialType);
- dummy_fooof = fooof(Fplot, input_power_spectrum, f_range, settings, return_model);
- dummy_fooof.difference_spectrum = dummy_fooof.power_spectrum - dummy_fooof.ap_fit;
- nSubjPSDs = length(PSDall(:,1,1,3)); % effectively gets the total number of EEG subjects that have a PSD
- nCh = length(ChanEEGLab);
- emptyStruct = struct(); % Create an empty structure
- clear allFooofResults allFoooFDiffPSD
- allFooofResults = repmat(dummy_fooof, nSubjPSDs, nCh); % Replicate the empty structure 32 times
- for iSub = 1:nSubjPSDs
- for iCh=1:length(ChanEEGLab)
- input_power_spectrum = PSDall(iSub,:,iCh,3); % power_spectrum = row vector of power values
- % PSDall(participants, frequencies, channels, trialtypes)
- % run fooof:
- iSubiChFoofResults = fooof(Fplot, input_power_spectrum, f_range, settings, return_model);
- % Extract data from the results structure
- fooof_freqs = iSubiChFoofResults.freqs; % Frequency values
- power_spectrum = iSubiChFoofResults.power_spectrum; % Original power spectrum
- fooofed_spectrum = iSubiChFoofResults.fooofed_spectrum; % Full FOOOF fit
- ap_fit = iSubiChFoofResults.ap_fit; % Aperiodic fit
- iSubiChFoofResults.difference_spectrum = power_spectrum - ap_fit;
- allFooofResults(iCh) = iSubiChFoofResults;
- allFooofDiffPSD(iSub,:,iCh,trialType) = iSubiChFoofResults.difference_spectrum;
- end
- end
- %% Plot average FOOOF results:
- % % Extract data from the results structure
- % fooof_freqs = iChFooofResults.freqs; % Frequency values
- % power_spectrum = iChFooofResults.power_spectrum; % Original power spectrum
- % fooofed_spectrum = iChFooofResults.fooofed_spectrum; % Full FOOOF fit
- % ap_fit = iChFooofResults.ap_fit; % Aperiodic fit
- % difference_spectrum = power_spectrum - ap_fit;
- % % fooofed_difference_spectrum = fooofed_spectrum - ap_fit;
- %
- % % Plot settings
- % figure;
- % hold on;
- %
- % % Plot the original power spectrum
- % plot(fooof_freqs, power_spectrum, 'k', 'LineWidth', 1.5, 'DisplayName', 'Power Spectrum');
- %
- % % Plot the FOOOFed spectrum (from fooof results)
- % plot(fooof_freqs, fooofed_spectrum, 'r', 'LineWidth', 1.5, 'DisplayName', 'FOOOFed Spectrum');
- %
- % % Plot the aperiodic fit
- % plot(fooof_freqs, ap_fit, 'b--', 'LineWidth', 1.5, 'DisplayName', 'Aperiodic Fit');
- %
- % % Plot the difference spectrum (subtracted in MATLAB)
- % plot(fooof_freqs, difference_spectrum, 'g--', 'LineWidth', 1.5, 'DisplayName', 'powerSpect minus apfit');
- %
- % % % Plot the FOOOFed difference spectrum (subtracted in MATLAB)
- % % plot(fooof_freqs, fooofed_difference_spectrum, '--', 'LineWidth', 1.5, 'DisplayName', 'fooofedSpect minus apfit');
- %
- % % Set logarithmic scale for frequency
- % % set(gca, 'XScale', 'log'); % Logarithmic x-axis
- % % set(gca, 'YScale', 'log'); % Logarithmic y-axis
- %
- % % Add labels, legend, and grid
- % xlabel('Frequency (Hz)');
- % ylabel('Power');
- % legend('show');
- % grid on;
- % title(['FOOOF Analysis Results: ' num2str(f_range(1)) '-' num2str(f_range(2)) ' Hz']);
- % hold off;
- %%
- % Predefine the number of stimulation groups, subjects, and channels
- nStimGroups = 3;
- nFreqs = length(fooof_freqs);
- nCh = 32;
- % Preallocate for average difference spectra per channel and stim group
- avgDiffSpectraChannels = zeros(nStimGroups, nFreqs, nCh);
- % Compute the average difference spectrum for each channel and stim group
- for iStimGroup = 1:nStimGroups
- for iCh = 1:nCh
- % Extract difference spectra for the current stim group and channel
- diffSpectraGroup = allFooofDiffPSD(SubjG{iStimGroup},:,iCh,trialtype); % Subj x Freq
- % Average across subjects
- avgDiffSpectraChannels(iStimGroup, :, iCh) = mean(diffSpectraGroup, 1, 'omitnan');
- end
- end
- % Plot the average difference spectra for each channel, one plot per stim group
- for iStimGroup = 1:nStimGroups
- figure;
- hold on;
- colors = lines(nCh); % Generate distinct colors for each channel
- for iCh = 1:nCh
- plot(fooof_freqs, avgDiffSpectraChannels(iStimGroup, :, iCh), 'LineWidth', 1.5, ...
- 'DisplayName', EEGch{iCh}, 'Color', colors(iCh, :));
- end
- % Customize the plot
- xlabel('Frequency (Hz)');
- ylabel('Difference Spectrum Power');
- title(['Average Difference Spectrum by Channel - Stim Group ' GroupName{iStimGroup}]);
- legend('show', 'Location', 'eastoutside');
- grid on;
- hold off;
- % Save the figure
- saveas(gcf, [fooof_save_folder 'Avg_Diff_Spectrum_by_Channel_StimGroup' GroupName{iStimGroup} '.png']);
- end
- %% FOOOFed Spectrum Plot + settings
- figure;
- hold on;
- % Plot the original power spectrum
- plot(fooof_freqs, power_spectrum, 'k', 'LineWidth', 1.5, 'DisplayName', 'Power Spectrum');
- % Plot the FOOOFed spectrum (from fooof results)
- % plot(fooof_freqs, fooofed_spectrum, 'r', 'LineWidth', 1.5, 'DisplayName', 'FOOOFed Spectrum');
- % Plot the aperiodic fit
- plot(fooof_freqs, ap_fit, 'b--', 'LineWidth', 1.5, 'DisplayName', 'Aperiodic Fit');
- % Plot the difference spectrum (subtracted in MATLAB)
- plot(fooof_freqs, difference_spectrum, 'g--', 'LineWidth', 1.5, 'DisplayName', 'Adjusted Spectrum (PS-ApFit)');
- % % Plot the FOOOFed difference spectrum (subtracted in MATLAB)
- % plot(fooof_freqs, fooofed_difference_spectrum, '--', 'LineWidth', 1.5, 'DisplayName', 'fooofedSpect minus apfit');
- % Set logarithmic scale for frequency
- % set(gca, 'XScale', 'log'); % Logarithmic x-axis
- % set(gca, 'YScale', 'log'); % Logarithmic y-axis
- % Add labels, legend, and grid
- xlabel('Frequency (Hz)');
- ylabel('Power');
- legend_handle = legend('show');
- % legend('show');
- grid on;
- % Position the legend in the middle right of the plot
- set(legend_handle, 'Location', 'east');
- fooof_figname = ['S' num2str(SubjG{iStimGroup}(subjectNumInStimGroup)) '_FOOOF_' EEGch{singleFOOOFEEGCh} '_' num2str(f_range(1)) '-' num2str(f_range(2)) ' Hz'];
- title(['S' num2str(SubjG{iStimGroup}(subjectNumInStimGroup)) ' (' GroupName{iStimGroup} ') - Ch:' EEGch{singleFOOOFEEGCh} ' - ' num2str(f_range(1)) '-' num2str(f_range(2)) ' Hz']);
- hold off;
- % Save the figure as a single file
- saveas(gcf, [fooof_save_folder fooof_figname '.png']);
- %% PSD topographical Plots on Brain (heatmaps) - group difference, PSD-Acc correlation brain *** fig2c fig2d fig3
- PowerLim=[-7 -2];
- PowerLab={'-7' '-2'};
- TLim=[-5 5];
- TLab={'-5' '5'};
- PLim=[-4 4];
- PLab={'10e-4' '10e-0'};
- fooof_freqs = firstsubjectfirstCh.freqs; % Frequency values
- for iFreqFunc=3 %1:length(FreqFuncNames)
- clear MapGroup diffTmap diffMap Tdata;
- clear diffTPmap diffRPmap diffTmap
- for iTrialType=3%1:length(TrialType)
- % iCom=1;
- PSDsaveDate = datestr(datetime, 'yy-mm-dd_HHMMSSFFF');
- SaveTemp=['Fig2Results\' PSDsaveDate '\'];
- SaveTemp=[SaveTemp FreqFuncNames{iFreqFunc} '\' ];
- mkdir(SaveTemp)
- BOI=[5;15];
- BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- %
- %% PSD on brain ***old Fig2C
- % figure;
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- for iStimGroup=1:length(SubjG)
- if iFreqFunc==3
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(LogPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),[],2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(LogPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),[],2),1));
- else
- Tdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(LogPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),2));
- MapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(LogPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),2),1));
- end
- subplotLU(2,size(BOI,2),iStimGroup,iBOI); %
- [~,~,~,xmesh,ymesh]=topoplot(MapGroup{iStimGroup,iBOI,iTrialType}, ChanEEGLab,'colormap',jet,'maplimits',PowerLim);
- if iStimGroup==2
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- end
- if iBOI==1
- ylabel(GroupName{iStimGroup})
- yt=text(-0.55,0,GroupName{iStimGroup},'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- end
- end
- % subplot('position',[0.5 0.51 0.3 0.01]);
- % b=colorbar('southoutside');
- % set(gca,'xtick',[],'ytick',[])
- % set(b,'position',[0.5 0.5 0.3 0.03],'Limits',[0 1],'Ticks',[0 1],'Ticklabels',PowerLab);
- % xlabel(b,'Log Normalized Power')
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % saveas(gcf,[SaveTemp 'GroupPSDonBrain'],'pdf');
- % saveas(gcf,[SaveTemp 'GroupPSDonBrain'],'png');
- % saveas(gcf,[SaveTemp 'GroupPSDonBrain.eps'],'epsc');
- %% FOOOF PSD on brain *** old Fig2C
- % % Ensure the desired colormap is loaded
- % % batlow is part of the cmocean or scientific colormaps package
- % if exist('batlow', 'file') == 2
- % cmap = batlow; % Load batlow if available
- % else
- % cmap = parula; % Fallback to parula if batlow isn't available
- % end
- %
- % figure;
- % BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- % BandName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- % BandHzName={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- % PowerLim = [-0.5 1];
- % for iBOI=1:size(BOI,2)
- % % NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- % NeedI=find(fooof_freqs>=BOI(1,iBOI)&fooof_freqs<=BOI(2,iBOI))';
- %
- % for iStimGroup=1:length(SubjG)
- % if iFreqFunc==3
- % FooofTdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(allFooofDiffPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),[],2));
- % FooofMapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(allFooofDiffPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),[],2),1));
- %
- % else
- % FooofTdata{iStimGroup,iBOI,iTrialType}=squeeze(FreqFunc{iFreqFunc}(allFooofDiffPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),2));
- % FooofMapGroup{iStimGroup,iBOI,iTrialType}=squeeze(nanmean(FreqFunc{iFreqFunc}(allFooofDiffPSD(SubjG{iStimGroup},NeedI,EEGchInd,iTrialType),2),1));
- % end
- % subplotLU(3,size(BOI,2),iStimGroup,iBOI); %
- % [~,~,~,xmesh,ymesh]=topoplot(FooofMapGroup{iStimGroup,iBOI,iTrialType}, ChanEEGLab,'colormap',parula,'maplimits',PowerLim);
- % if iStimGroup==3
- % xlabel(BandName{iBOI});
- % text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- %
- % end
- % if iBOI==1
- % ylabel(GroupName{iStimGroup})
- % yt=text(-0.55,0,GroupName{iStimGroup},'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- % end
- % end
- % end
- % % subplot('position',[0.5 0.51 0.3 0.01]);
- % b=colorbar('southoutside');
- % set(gca,'xtick',[],'ytick',[])
- % % set(b,'position',[0.5 0.5 0.3 0.03],'Limits',[0 1],'Ticks',[0 1],'Ticklabels',PowerLab);
- % xlabel(b,'(not Log Normalized) Power')
- % LuFontStandard;
- % papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % % saveas(gcf,[SaveTemp 'FOOOFPSD'],'pdf');
- % saveas(gcf,[SaveTemp 'FOOOFPSD_oldColorbarRange'],'png');
- % % saveas(gcf,[SaveTemp 'PSD40BothControls.eps'],'epsc');
- %% Updated FOOOF color map 1/22/25 *** Fig2C
- % % Compute global 10% minimum and 90% maximum across all data
- % allData = []; % Initialize an empty array to collect all data values
- % for iBOI = 1:size(BOI, 2)
- % for iStimGroup = 1:length(SubjG)
- % % Collect all FooofMapGroup data into a single array
- % allData = [allData; FooofMapGroup{iStimGroup, iBOI, iTrialType}(:)];
- % end
- % end
- %
- % % Compute 10% and 90% percentiles
- % cbarMin = prctile(allData, 10);
- % cbarMax = prctile(allData, 90);
- %
- % % Update PowerLim based on the computed values
- % FOOOFPowerLim = [cbarMin, cbarMax];
- %
- % figure;
- % for iBOI = 1:size(BOI, 2)
- % NeedI = find(fooof_freqs >= BOI(1, iBOI) & fooof_freqs <= BOI(2, iBOI))';
- %
- % for iStimGroup = 1:3 %length(SubjG)
- % subplotLU(3, size(BOI, 2), iStimGroup, iBOI);
- % [~, ~, ~, xmesh, ymesh] = topoplot(FooofMapGroup{iStimGroup, iBOI, iTrialType}, ChanEEGLab, ...
- % 'colormap', parula, 'maplimits', FOOOFPowerLim);
- %
- % if iStimGroup == 3
- % xlabel(BandName{iBOI});
- % text(0, -0.55, [BandName{iBOI} ' (' BandHzName{iBOI} ')'], ...
- % 'horizontalalignment', 'center', 'verticalalignment', 'top', 'fontsize', 10);
- % end
- % if iBOI == 1
- % ylabel(GroupName{iStimGroup});
- % text(-0.55, 0, GroupName{iStimGroup}, ...
- % 'horizontalalignment', 'center', 'verticalalignment', 'bottom', ...
- % 'fontsize', 10, 'rotation', 90);
- % end
- % end
- % end
- %
- % % b = colorbar('southoutside');
- % % caxis(FOOOFPowerLim); % Set colorbar limits to match PowerLim
- % % xlabel(b, '(not Log Normalized) Power');
- %
- % LuFontStandard;
- % papersizePX = [0 0 6 * size(BOI, 2) 6 * 2 + 3];
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf, 'PaperPosition', papersizePX, 'PaperSize', papersizePX(3:4));
- % saveas(gcf, [SaveTemp 'FOOOFPSD_updatedColorbarRange'], 'png');
- %
- %% Plot and save FOOOF vertical colorbar separately *** Fig2C
- % figure;
- %
- % % Create a dummy image to generate a colorbar
- % imagesc([0 1]); % Placeholder data
- % colormap(parula); % Use the same colormap
- % caxis(FOOOFPowerLim); % Apply the same color limits
- %
- % % Customize colorbar
- % b = colorbar('eastoutside'); % Set colorbar orientation to vertical
- %
- % % Set ticks and format tick labels with 2 significant figures
- % tickValues = linspace(FOOOFPowerLim(1), FOOOFPowerLim(2), 5); % Generate 5 evenly spaced tick values
- % set(b, 'Ticks', tickValues); % Set tick positions
- % set(b, 'TickLabels', arrayfun(@(x) sprintf('%.2g', x), tickValues, 'UniformOutput', false)); % Format tick labels
- %
- % % Add label to the colorbar
- % ylabel(b, '(not Log Normalized) Power', 'fontsize', 12, ...
- % 'rotation', 270, 'VerticalAlignment', 'bottom', ...
- % 'HorizontalAlignment', 'center');
- %
- % % Adjust figure layout to fit the colorbar and label
- % set(gca, 'Visible', 'off'); % Hide axes
- % set(gcf, 'PaperUnits', 'centimeters');
- % set(gcf, 'PaperPosition', [0 0 2 10]); % Adjust to fit vertical colorbar
- % set(gcf, 'PaperSize', [2 10]);
- %
- % % Save colorbar as a PNG file
- % saveas(gcf, [SaveTemp 'FOOOF_Colorbar'], 'png');
- %% Group differences on brain *** old fig2d ? suppfig2
- figure;
- for iBOI=1:size(BOI,2)
- for iCh=1:length(ChanEEGLab)
- [~,diffTPmap(iCh,iBOI,iTrialType),~,stats]=ttest2(Tdata{2,iBOI,iTrialType}(:,iCh),Tdata{1,iBOI,iTrialType}(:,iCh));
- [diffRPmap(iCh,iBOI,iTrialType),~,~]=ranksum(Tdata{2,iBOI,iTrialType}(:,iCh),Tdata{1,iBOI,iTrialType}(:,iCh));
- diffTmap(iCh,iBOI,iTrialType)=stats.tstat;
- end
- subplotLU(2,size(BOI,2),1,iBOI);
- topoplot(diffTmap(:,iBOI,iTrialType), ChanEEGLab,'colormap',colorMapPN,'maplimits',TLim);
- if iBOI==1
- yt=text(-0.55,0,['T, ' GroupName{Group1} '-' GroupName{Group2}],'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- b=colorbar('southoutside');
- % set(b,'position',[0.52 0.93 0.2 0.03],'xtick',[-6 6],'xticklabel',{'-6' '6'},'xlim',[-6 6]);
- set(gca,'xtick',[],'ytick',[])
- set(b,'position',[0.52 0.93 0.2 0.01],'ticks',TLim,'ticklabels',TLab);
- xlabel(b,'T statistics','verticalalignment','top')
- end
- subplotLU(2,size(BOI,2),2,iBOI);
- topoplot(log10(diffTPmap(:,iBOI,iTrialType)), ChanEEGLab,'colormap',colorMapPN,'maplimits',PLim);
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==1
- a=ylabel('40Hz-BothControls');
- % a.Position=[0.01 0.5 0.03 0.4];
- % a.verticalalignment='middle';
- % set(a,'Position',[0.01 0.5 0.03 0.4],'Verticalalignment','middle')
- set(a,'Verticalalignment','middle')
- yt=text(-0.55,0,['P, ' GroupName{Group1} '-' GroupName{Group2}],'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- c=colorbar('southoutside');
- % set(c,'position',[0.52 0.46 0.2 0.03],'xtick',[-4 0],'xticklabel',{'10e-4' '10e-0'},'xlim',[-4 0]);
- set(gca,'xtick',[],'ytick',[])
- set(c,'position',[0.52 0.51 0.2 0.01],'Limits',[PLim(1) 0],'ticks',[PLim(1) 0],'ticklabels',PLab);
- xlabel(c,'P values','verticalalignment','top')
- end
- end
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SaveTemp 'PSDDiff40BothControls'],'pdf');
- saveas(gcf,[SaveTemp 'PSDDiff40BothControls'],'png');
- saveas(gcf,[SaveTemp 'PSDDiff40BothControls.eps'],'epsc');
- %% Group differences on brain - Calculate t-test stat and plot *** fig2d - suppfig2
- % Define group pairs to compare % see: open: GroupName
- groupPairs = [
- 1, 2; % First pair: Group1 = 1 (40 Hz), Group2 = 2 (Light)
- 1, 3 % Second pair: Group1 = 1, Group2 = 3 (Random)
- ];
- % Channel subset Fp1, Cz, Oz
- % Channels of interest (indices)
- PSDttestChSubset = [1, 32, 16]; % [1, 32, 16] = [Fp1, Cz, Oz]
- % Initialize a matrix to store p-values for FDR correction
- allPValues = [];
- % Loop through each group pair
- for iPair = 1:size(groupPairs, 1)
- Group1 = groupPairs(iPair, 1);
- Group2 = groupPairs(iPair, 2);
- dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} GroupName{Group1} GroupName{Group2}];
- figure;
- for iBOI=1:size(BOI,2)
- %% calculate stats test
- for iCh=1:length(ChanEEGLab)
- [~,diffTPmap(iCh,iBOI,iTrialType),~,stats]=ttest2(Tdata{Group1,iBOI,iTrialType}(:,iCh),Tdata{Group2,iBOI,iTrialType}(:,iCh)); % two-sided ttest
- [diffRPmap(iCh,iBOI,iTrialType),~,~]=ranksum(Tdata{Group1,iBOI,iTrialType}(:,iCh),Tdata{Group2,iBOI,iTrialType}(:,iCh));
- diffTmap(iCh,iBOI,iTrialType)=stats.tstat;
- end
- % Collect p-values for channels of interest
- for chIdx = 1:length(PSDttestChSubset)
- iCh = PSDttestChSubset(chIdx);
- % allPValues = [p-value, t-stat, groupPair, BOI, Ch]
- allPValues(end+1, :) = [diffTPmap(iCh, iBOI, iTrialType), diffTmap(iCh, iBOI, iTrialType), iPair, iBOI, iCh]; % Store p-value with metadata
- end
- %% Plot T-stat
- subplotLU(2,size(BOI,2),1,iBOI);
- topoplot(diffTmap(:,iBOI,iTrialType), ChanEEGLab,'colormap',colorMapPN,'maplimits',TLim);
- if iBOI==1
- yt=text(-0.55,0,['T, ' GroupName{Group1} '-' GroupName{Group2}],'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- b=colorbar('southoutside');
- % set(b,'position',[0.52 0.93 0.2 0.03],'xtick',[-6 6],'xticklabel',{'-6' '6'},'xlim',[-6 6]);
- set(gca,'xtick',[],'ytick',[])
- set(b,'position',[0.52 0.93 0.2 0.01],'ticks',TLim,'ticklabels',TLab);
- xlabel(b,'T statistics','verticalalignment','top')
- end
- %% Plot p-value
- subplotLU(2,size(BOI,2),2,iBOI);
- topoplot(log10(diffTPmap(:,iBOI,iTrialType)), ChanEEGLab,'colormap',colorMapPN,'maplimits',PLim);
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==1
- a=ylabel([GroupName{Group1} '-' GroupName{Group2}]);
- % a.Position=[0.01 0.5 0.03 0.4];
- % a.verticalalignment='middle';
- % set(a,'Position',[0.01 0.5 0.03 0.4],'Verticalalignment','middle')
- set(a,'Verticalalignment','middle')
- yt=text(-0.55,0,['P, ' GroupName{Group1} '-' GroupName{Group2}],'horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- c=colorbar('southoutside');
- % set(c,'position',[0.52 0.46 0.2 0.03],'xtick',[-4 0],'xticklabel',{'10e-4' '10e-0'},'xlim',[-4 0]);
- set(gca,'xtick',[],'ytick',[])
- set(c,'position',[0.52 0.51 0.2 0.01],'Limits',[PLim(1) 0],'ticks',[PLim(1) 0],'ticklabels',PLab);
- xlabel(c,'P values','verticalalignment','top')
- end
- end
- LuFontStandard;
- papersizePX=[0 0 6*size(BOI,2) 6*2+3];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- saveas(gcf,[SaveTemp 'PSDDiff' GroupName{Group1} '-' GroupName{Group2}],'pdf');
- saveas(gcf,[SaveTemp 'PSDDiff' GroupName{Group1} '-' GroupName{Group2}],'png');
- saveas(gcf,[SaveTemp 'PSDDiff' GroupName{Group1} '-' GroupName{Group2} '.eps'],'epsc');
- end
- %% PSD ttest FDR Correction fig2d stats
- % Filter p-values for the first 5 bands
- numBandsToInclude = 5; % Only include the first 5 bands
- % allPValues = [p-value, t-stat, groupPiar, BOI, Ch]
- filteredPValues = allPValues(allPValues(:, 4) <= numBandsToInclude, :);
- % Extract only the raw p-values for FDR correction
- pValuesForFDR = filteredPValues(:, 1);
- % % Perform FDR Correction (three different methods below)
- BHFDR = mafdr(pValuesForFDR, 'BHFDR', true); % Benjamini-Hochberg FDR correction
- [FDRST,Q,aPrioriProb] = mafdr(pValuesForFDR); % Storey-Tibshirani method (2002)
- % fdh_bh, parameters - gets the critical p value
- q=0.05;
- method='pdep';
- report='yes';
- [fdrbh_h, fdrbh_crit_p, fdrbh_adj_p]=fdr_bh(pValuesForFDR,q,method,report);
- % Add FDR corrected p-values back to the filtered results
- filteredPValuesPlusFDR = [filteredPValues, fdrAdjustedPValues];
- % Display Results
- fprintf('Channel\tGroup Pair\tBand\tT-stat\tRaw P-value\tFDR Corrected P-value\n');
- for i = 1:size(filteredPValuesPlusFDR, 1)
- % Get channel name from the struct
- chName = ChanEEGLab(filteredPValuesPlusFDR(i, 5)).labels; % Access the 'labels' field of the struct
- % Extract group indices
- group1Idx = groupPairs(filteredPValuesPlusFDR(i, 3), 1);
- group2Idx = groupPairs(filteredPValuesPlusFDR(i, 3), 2);
- % Get group pair names
- groupPair = sprintf('%s-%s', GroupName{group1Idx}, GroupName{group2Idx});
- % Get band name
- band = BandName{filteredPValuesPlusFDR(i, 4)}; % Assuming BandName is a cell array
- % Get t-test stat
- tstat = filteredPValuesPlusFDR(i, 2);
- % Get raw and FDR-corrected p-values
- rawP = filteredPValuesPlusFDR(i, 1);
- fdrP = filteredPValuesPlusFDR(i, 6);
- % Print result
- fprintf('%s\t%s\t%s\t%.4f\t%.4f\t%.4f\n', chName, groupPair, band, tstat, rawP, fdrP);
- end
- % Display total number of comparisons
- numComparisons = size(filteredPValuesPlusFDR, 1);
- fprintf('Total number of comparisons used for FDR correction: %d\n', numComparisons);
- %% NEW PSD-ACC and PSD_RT 2025-02-04 MKA
- %% % Set-up for PSD-Beh - Spearman PSD-Acc and PSD-RT ***fig3b & fig3c
- SaveTemp = ['Fig3Results\' PSDsaveDate '\'];
- mkdir(SaveTemp)
- % PSD groups: 1=40Hz, 3=Random, 6=LightRT
- PSDBehaviorGroup1 = 1;
- PSDBehaviorGroup2 = 3;
- PSDBehaviorGroup3 = 6;
- allGroupNames = [GroupName{PSDBehaviorGroup1} GroupName{PSDBehaviorGroup2} GroupName{PSDBehaviorGroup3}];
- dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} allGroupNames];
- IncludedSubj = union(SubjG{PSDBehaviorGroup1}, union(SubjG{PSDBehaviorGroup2}, SubjG{PSDBehaviorGroup3}));
- figstatsChSubset = PSDttestChSubset;
- % Create separate figures for PSD-Acc and PSD-RT
- figureAcc = figure;
- figureRT = figure;
- Acctemp = Acc(IncludedSubj);
- RTtemp = SubjsAvgRT(IncludedSubj);
- %%% Variables for scatterplot:
- FlickerID=[zeros(size(SubjG{PSDBehaviorGroup1}(:)))+1;zeros(size(SubjG{PSDBehaviorGroup2}(:)))+2;zeros(size(SubjG{PSDBehaviorGroup3}(:)))+3];
- Param.Corr='Spearman'; %%%Type of correlation, see Matlab function corr for more details
- Param.Pth=0.05; %%%threshold of Pvalue
- Param.EdgeColor=colorMapPN; %%%Color map for correlation link
- Param.NodeColor=repmat([0.8 0.8 0.8],6,1); %%%Color of Nodes for correlation link plot
- Param.Clim=[-1 1]; %%%Color Limit for Correlation
- Param.Title='Pool All Sample'; %%Any title for label the figure
- Param.MarkerSize=8; %%%MarkerSize of scatter
- Param.SubjIDColor=FlickerColor;
- Param.SubjID=FlickerID;
- %%% Loop thru BOI for Fig3b and Fig3c heatmaps & plot
- for iBOI = 1:size(BOI, 2)
- NeedI = find(Fplot >= BOI(1, iBOI) & Fplot <= BOI(2, iBOI));
- if iFreqFunc == 3
- PSDtemp = squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj, NeedI, EEGchInd, iTrialType), [], 2));
- else
- PSDtemp = squeeze(FreqFunc{iFreqFunc}(LogPSD(IncludedSubj, NeedI, EEGchInd, iTrialType), 2));
- end
- %% Scatterplot of correlation - indiv behavior and PSD fig3a+
- %% % PSD_Acc scatter
- PSDAcc_scatterplot = figure;
- tempName=EEGch;
- tempName{end+1}='Acc';
- multiCorr2GroupSubplot(6,6,[PSDtemp Acctemp],size(PSDtemp,2)+1,tempName,Param)
- LuFontStandard;
- papersizePX=[0 0 6*6 6*6];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames],'pdf');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames],'png');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames '.eps'],'epsc');
- %% % PSD_RT scatter
- PSDRT_scatterplot = figure;
- tempName=EEGch;
- tempName{end+1}='RT';
- multiCorr2GroupSubplot(6,6,[PSDtemp RTtemp],size(PSDtemp,2)+1,tempName,Param)
- LuFontStandard;
- papersizePX=[0 0 6*6 6*6];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames],'pdf');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDRT_' allGroupNames],'png');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDRT_' allGroupNames '.eps'],'epsc');
- %% Plot PSD-Acc and PSD-RT: R values and P Values topoplots
- %%% Calculate correlations & pvalues
- [PSDAcc_rSpear(:, iBOI, iTrialType), PSDAcc_pSpear(:, iBOI, iTrialType)] = corr(PSDtemp, Acctemp, 'type', 'spearman', 'rows', 'pairwise');
- [PSDRT_rSpear(:, iBOI, iTrialType), PSDRT_pSpear(:, iBOI, iTrialType)] = corr(PSDtemp, RTtemp, 'type', 'spearman', 'rows', 'pairwise');
- %% % Plot PSD-Acc Correlation
- figure(figureAcc);
- %%%% Plot R value correlation topoplot PSD-Acc(fig3b)
- subplotLU(2,size(BOI,2),1,iBOI);
- topoplot(PSDAcc_rSpear(:,iBOI,iTrialType), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-1 1]); % Changed from 'maplimits',[-1 1]
- if iBOI==1
- yt=text(-0.55,0,'EEG-Behavior R','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- b=colorbar('southoutside');set(b,'position',[0.52 0.93 0.2 0.01],'xtick',[-1 1],'xticklabel',{'-1' '1'},'xlim',[-1 1]);
- xlabel(b,'PSD-Acc Correlation','verticalalignment','top')
- end
- %%%% Plot PSD-Acc P-value topoplot (fig3b supplement)
- subplotLU(2,size(BOI,2),2,iBOI);
- topoplot(log10(PSDAcc_pSpear(:,iBOI,iTrialType)), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-4 4]);
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==1
- a=ylabel(allGroupNames);
- % set(a,'position',[0.01 0.5 0.03 0.4],'verticalalignment','middle')
- set(a,'verticalalignment','middle')
- yt=text(-0.55,0,'P EEG-Behavior','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- % c=colorbar('southoutside');set(c,'position',[0.52 0.46 0.2 0.03],'xtick',[-4 0],'xticklabel',{'10e-4' '10e-0'},'xlim',[-4 0]);
- % xlabel(c,'P values','verticalalignment','top')
- c=colorbar('southoutside');
- set(gca,'xtick',[],'ytick',[])
- set(c,'position',[0.52 0.51 0.2 0.01],'Limits',[PLim(1) 0],'ticks',[PLim(1) 0],'ticklabels',PLab);
- xlabel(c,'P values','verticalalignment','top')
- end
- %% % Plot PSD-RT Correlation
- figure(figureRT);
- %%%% Plot PSD-RT R value (correlation) heatmap (fig3c)
- subplotLU(2,size(BOI,2),1,iBOI);
- topoplot(PSDRT_rSpear(:,iBOI,iTrialType), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-1 1]); % Changed from 'maplimits',[-1 1]
- if iBOI==1
- yt=text(-0.55,0,'EEG-Behavior R','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- if iBOI==size(BOI,2)
- b=colorbar('southoutside');set(b,'position',[0.52 0.93 0.2 0.01],'xtick',[-1 1],'xticklabel',{'-1' '1'},'xlim',[-1 1]);
- xlabel(b,'PSD-RT Correlation','verticalalignment','top')
- end
- %%%% Plot PSD-RT P-value fig3c supp
- subplotLU(2,size(BOI,2),2,iBOI);
- topoplot(log10(PSDRT_pSpear(:,iBOI,iTrialType)), ChanEEGLab,'colormap',colorMapPN,'maplimits',[-4 4]);
- xlabel(BandName{iBOI});
- text(0,-0.55,[BandName{iBOI} ' (' BandHzName{iBOI} ')'],'horizontalalignment','center','verticalalignment','top','fontsize',10)
- if iBOI==1
- a=ylabel(allGroupNames);
- % set(a,'position',[0.01 0.5 0.03 0.4],'verticalalignment','middle')
- set(a,'verticalalignment','middle')
- yt=text(-0.55,0,'P EEG-Behavior','horizontalalignment','center','verticalalignment','bottom','fontsize',10,'rotation',90);
- end
- %%%%% add colorbar
- if iBOI==size(BOI,2)
- % c=colorbar('southoutside');set(c,'position',[0.52 0.46 0.2 0.03],'xtick',[-4 0],'xticklabel',{'10e-4' '10e-0'},'xlim',[-4 0]);
- % xlabel(c,'P values','verticalalignment','top')
- c=colorbar('southoutside');
- set(gca,'xtick',[],'ytick',[])
- set(c,'position',[0.52 0.51 0.2 0.01],'Limits',[PLim(1) 0],'ticks',[PLim(1) 0],'ticklabels',PLab);
- xlabel(c,'P values','verticalalignment','top')
- end
- end
- %%% Apply formatting and save figures for heatmaps
- LuFontStandard;
- papersizePX = [0 0 6*size(BOI,2) 6*2+3];
- set(figureAcc, 'PaperUnits', 'centimeters');
- set(figureAcc, 'PaperPosition', papersizePX, 'PaperSize', papersizePX(3:4));
- saveas(figureAcc, [SaveTemp 'SpearmanPSDAcc_' allGroupNames], 'png');
- set(figureRT, 'PaperUnits', 'centimeters');
- set(figureRT, 'PaperPosition', papersizePX, 'PaperSize', papersizePX(3:4));
- saveas(figureRT, [SaveTemp 'SpearmanPSDRT_' allGroupNames], 'png');
- close all;
- %% Perform FDR correction for PSD_Acc and PSD_RT *** stats for fig3b and fig3c
- % Define the subset of channels and bands
- figstatsChSubset = [1, 32, 16]; % Indices for Fp1, Cz, Oz
- numBandsToInclude = 5; % First 5 bands
- % Initialize container for p-values
- PSDAcc_allPValues = [];
- PSDRT_allPValues = [];
- %%% Extract p-values and r-values for specified channels and bands
- for iBOI = 1:numBandsToInclude
- for iCh = figstatsChSubset
- % Get the p-value and r-value for the current channel and band
- PSDAcc_pValue = PSDAcc_pSpear(iCh, iBOI, iTrialType);
- PSDAcc_rValue = PSDAcc_rSpear(iCh, iBOI, iTrialType);
- PSDRT_pValue = PSDRT_pSpear(iCh, iBOI, iTrialType);
- PSDRT_rValue = PSDRT_rSpear(iCh, iBOI, iTrialType);
- % Append to the list of all p-values with associated metadata
- PSDAcc_allPValues = [PSDAcc_allPValues; PSDAcc_rValue, PSDAcc_pValue, iBOI, iCh];
- PSDRT_allPValues = [PSDRT_allPValues; PSDRT_rValue, PSDRT_pValue, iBOI, iCh];
- end
- end
- %%% Perform FDR correction
- % Extract raw p-values for FDR correction
- PSDAcc_pValuesForFDR = PSDAcc_allPValues(:, 2);
- PSDRT_pValuesForFDR = PSDRT_allPValues(:, 2);
- % Perform FDR correction
- [PSDAcc_fdrAdjustedPValues,Q_Acc,aPrioriProb_Acc,R_squared_Acc] = mafdr(PSDAcc_pValuesForFDR, 'BHFDR', true);
- [PSDRT_fdrAdjustedPValues,Q_RT,aPrioriProb_RT,R_squared_RT] = mafdr(PSDRT_pValuesForFDR, 'BHFDR', true);
- % Append FDR-adjusted p-values
- PSDAcc_allPValues = [PSDAcc_allPValues, PSDAcc_fdrAdjustedPValues];
- PSDRT_allPValues = [PSDRT_allPValues, PSDRT_fdrAdjustedPValues];
- %%% Display and Save Results for PSD_Acc
- outputFile_Acc = fullfile(SaveTemp, 'PSD_Acc_FDR_corrected_stats.txt');
- fid_Acc = fopen(outputFile_Acc, 'w');
- fprintf(fid_Acc, 'Channel\tBand\tR-value\tRaw_P-value\tFDR Corrected P-value\n');
- fprintf('FDR-corrected p-values for PSD-Acc:\n');
- % Display total number of comparisons
- numComparisons = size(PSDAcc_allPValues, 1);
- fprintf('Total number of comparisons used for FDR correction: %d\n', numComparisons);
- fprintf('Channel\tBand\tR-value\tRaw_P-value\tFDR Corrected P-value\n');
- for i = 1:size(PSDAcc_allPValues, 1)
- chName = ChanEEGLab(PSDAcc_allPValues(i, 4)).labels;
- band = BandName{PSDAcc_allPValues(i, 3)};
- rValue = PSDAcc_allPValues(i, 1);
- rawP = PSDAcc_allPValues(i, 2);
- fdrP = PSDAcc_allPValues(i, 5);
- fprintf('%s\t%s\t%.4f\t%.4f\t%.4f\n', chName, band, rValue, rawP, fdrP);
- fprintf(fid_Acc, '%s\t%s\t%.4f\t%.4f\t%.4f\n', chName, band, rValue, rawP, fdrP);
- end
- fclose(fid_Acc);
- fprintf('PSD-Acc results saved to %s\n', outputFile_Acc);
- %%% Display and Save Results for PSD_RT
- outputFile_RT = fullfile(SaveTemp, 'PSD_RT_FDR_corrected_stats.txt');
- fid_RT = fopen(outputFile_RT, 'w');
- fprintf(fid_RT, 'Ch\tBand\tR-value\tRaw_P-value\tFDR Corrected P-value\n');
- fprintf('FDR-corrected p-values for PSD-RT:\n');
- % Display total number of comparisons
- numComparisons = size(PSDRT_allPValues, 1);
- fprintf('Total number of comparisons used for FDR correction: %d\n', numComparisons);
- fprintf('Ch\tBand\tR-value\tRaw_P-value\tFDR Corrected P-value\n');
- for i = 1:size(PSDRT_allPValues, 1)
- chName = ChanEEGLab(PSDRT_allPValues(i, 4)).labels;
- band = BandName{PSDRT_allPValues(i, 3)};
- rValue = PSDRT_allPValues(i, 1);
- rawP = PSDRT_allPValues(i, 2);
- fdrP = PSDRT_allPValues(i, 5);
- fprintf('%s\t%s\t%.4f\t%.4f\t%.4f\n', chName, band, rValue, rawP, fdrP);
- fprintf(fid_RT, '%s\t%s\t%.4f\t%.4f\t%.4f\n', chName, band, rValue, rawP, fdrP);
- end
- fclose(fid_RT);
- fprintf('PSD-RT results saved to %s\n', outputFile_RT);
- end
- end
- %% PSD-Acc - Loop of correlation scatter plot? (future fig3a+b?)
- FlickerColor=[31 125 184; 150 27 27; 219 129 50]/255; %40, Random, Light % blue, red, gold
- for iFreqFunc=3%1:length(FunGroupName)
- clear MapGroup diffTmap diffMap Tdata;
- clear diffTPmap diffRPmap diffTmap
- for iTrialType=3%1:length(TrialType)
- % iCom=1;
- SaveTemp=[SubSavePSD TrialTypeName{iTrialType} '\'];
- SaveTemp=[SaveTemp FunGroupName{iFreqFunc} '\' ];
- mkdir(SaveTemp)
- BOI=[5;15];
- BOI=[1 4 8 13 30 39.5 43;4 8 13 30 37 41.5 100];
- BName={'Delta','Theta','Alpha','Beta','Gamma-1','Gamma-E','Gamma-2'};
- BName2={'1-4 Hz','4-8 Hz','8-13Hz','13-30 Hz','30-37 Hz','39-41 Hz','43-100 Hz'};
- PSDBehaviorGroup1 = 1;
- PSDBehaviorGroup2 = 3;
- PSDBehaviorGroup3 = 6; % 6 = LightRT
- allGroupNames = [GroupName{PSDBehaviorGroup1} GroupName{PSDBehaviorGroup2} GroupName{PSDBehaviorGroup3}];
- dataName = [TrialTypeName{iTrialType} FreqFuncNames{iFreqFunc} allGroupNames];
- IncludedSubj=[SubjG{PSDBehaviorGroup1}(:);SubjG{PSDBehaviorGroup2}(:);SubjG{PSDBehaviorGroup3}(:)]; % 1 3 6 = 40, Random, Light
- FlickerID=[zeros(size(SubjG{PSDBehaviorGroup1}(:)))+1;zeros(size(SubjG{PSDBehaviorGroup2}(:)))+2;zeros(size(SubjG{PSDBehaviorGroup3}(:)))+3];
- Param.Corr='Spearman'; %%%Type of correlation, see Matlab function corr for more details
- Param.Pth=0.05; %%%threshold of Pvalue
- Param.EdgeColor=colorMapPN; %%%Color map for correlation link
- Param.NodeColor=repmat([0.8 0.8 0.8],6,1); %%%Color of Nodes for correlation link plot
- Param.Clim=[-1 1]; %%%Color Limit for Correlation
- Param.Title='Pool All Sample'; %%Any title for label the figure
- Param.MarkerSize=8; %%%MarkerSize of scatter
- Param.SubjIDColor=FlickerColor;
- Param.SubjID=FlickerID;
- %% Scatterplot of correlation - indiv behavior and PSD
- for iBOI=1:size(BOI,2)
- NeedI=find(Fplot>=BOI(1,iBOI)&Fplot<=BOI(2,iBOI));
- figure;
- % for iCh=1:length(ChanEEGLab)
- if iFreqFunc==3
- PSDtemp=squeeze(FunGroup{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),[],2));
- else
- PSDtemp=squeeze(FunGroup{iFreqFunc}(LogPSD(IncludedSubj,NeedI,EEGchInd,iTrialType),2));
- end
- Acctemp=Acc(IncludedSubj);
- tempName=EEGch;
- tempName{end+1}='Acc';
- multiCorr2GroupSubplot(6,6,[PSDtemp Acctemp],size(PSDtemp,2)+1,tempName,Param)
- LuFontStandard;
- papersizePX=[0 0 6*6 6*6];
- set(gcf, 'PaperUnits', 'centimeters');
- set(gcf,'PaperPosition',papersizePX,'PaperSize',papersizePX(3:4));
- % saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames],'pdf');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames],'png');
- saveas(gcf,[SaveTemp Param.Corr BName{iBOI} BName2{iBOI} 'PSDAcc_' allGroupNames '.eps'],'epsc');
- close all
- end
- end
- %
- % cl
S4_ALLSubjects_NoCut_NoNotch_2_100hz.m at commit 8afead0, no license · at the source
Overview
- Coulter Department of Biomedical Engineering, Georgia Institute of Technology & Emory University, Atlanta, GA, United States
- National Institute of Mental Health, National Institutes of Health, Bethesda, MD, United States
Abstract
Gamma oscillations (30–100 Hz) have long been theorized to play a key role in sensory processing and attention by coordinating neural firing across distributed neurons. Gamma oscillations can be generated internally by neural circuits during attention or exogenously by stimuli that turn on and off at gamma frequencies. However, it remains unknown if driving gamma activity via exogenous sensory stimulation affects attention. We tested the hypothesis that non-invasive audiovisual stimulation in the form of flashing lights and sounds (flicker) at 40 Hz improves attention in an attentional vigilance task and affects neural oscillations associated with attention. We recorded scalp EEG activity of healthy adults (n = 62) during 1 hour of either 40 Hz audiovisual flicker, no flicker as control, or randomized flicker as sham stimulation, while subjects performed a psychomotor vigilance task. Participants exposed to 40 Hz flicker stimulation had better accuracy and faster reaction times than participants in the control groups. The 40 Hz group showed increased 40 Hz activity compared to the control groups in agreement with previous studies. Surprisingly, 40 Hz subjects had significantly lower delta power (2–4 Hz), which is associated with arousal, and higher functional connectivity in lower alpha (8–10 Hz), which is associated with attention processes. Furthermore, decreased delta power and increased lower alpha functional connectivity were correlated with better attention task performance. This study reveals how 40 Hz audiovisual stimulation improves attention performance with potential implications for therapeutic interventions for attention disorders and attention improvement.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 13 matches between paragraphs and lines of code.
singerlabgt/FlickerEEGAttention_HealthyAdults_Manuscript
8afead01e123de2e52cdaf8a3ce5694f63251062, 20 February 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
869 files
- Behavior Analysis/
PlotAllAttentionTaskFigs , Python, 45 linesScript.py - Behavior Analysis/
StatsTest_Attention.py , Python, 202 lines - Behavior Analysis/
dataframe_creation.py , Python, 151 lines - Behavior Analysis/
plot_fig1_graphs.py , Python, 58 lines - Behavior Analysis/
plots_for_AttentionTask. , Python, 434 linespy - Behavior Analysis/
plots_for_Fig1_illustrat , Python, 703 linesor.py - EEG Analysis/
Functions/ , MATLAB, 8 linesCalculateAvgRTforEaSubjD otsyncTest.m - EEG Analysis/
Functions/ , MATLAB, 8 linesFieldName2Struct.m - EEG Analysis/
Functions/ , MATLAB, 8 linesGenMatCode-main/ General/ FieldName2Struct.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ General/ FindKeywords.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ General/ GT_FileFoundKeyWord.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ General/ ImageInsert.m - EEG Analysis/
Functions/ , MATLAB, 21 linesGenMatCode-main/ General/ MapFields1to2.m - EEG Analysis/
Functions/ , MATLAB, 4 linesGenMatCode-main/ General/ Merge2Stru.m - EEG Analysis/
Functions/ , MATLAB, 8 linesGenMatCode-main/ General/ MergeField.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ General/ RunRcode.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ General/ SearchFile.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ General/ SingleStructFiledMerge.m - EEG Analysis/
Functions/ , MATLAB, 13 linesGenMatCode-main/ General/ StrFieldTransfer.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ General/ StrSubIndex.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ General/ StructFiledMerge.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ General/ TimeRangeModify.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ General/ TimeRangeModifyDemo.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ General/ copyFormat.m - EEG Analysis/
Functions/ , MATLAB, 54 linesGenMatCode-main/ General/ copyFormatOld.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ General/ deleteFile.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ General/ deleteFormat.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ General/ dirFile.m - EEG Analysis/
Functions/ , MATLAB, 9 linesGenMatCode-main/ General/ fieldmerge.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ General/ loadMat_Lu.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ General/ save_parfor.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ General/ uniqueStrCell.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ GraphAnalysis/ Adj2Cyto.m - EEG Analysis/
Functions/ , MATLAB, 8 linesGenMatCode-main/ GraphAnalysis/ Adj2List.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ GraphAnalysis/ Adj2WeightList.m - EEG Analysis/
Functions/ , MATLAB, 123 linesGenMatCode-main/ GraphAnalysis/ CVAccBNLU.m - EEG Analysis/
Functions/ , MATLAB, 120 linesGenMatCode-main/ GraphAnalysis/ CVModelLearnLU.m - EEG Analysis/
Functions/ , MATLAB, 80 linesGenMatCode-main/ GraphAnalysis/ CVModelStructureLearnLU. m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ GraphAnalysis/ CellMatch_str.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ GraphAnalysis/ Cir_arcPlot.m - EEG Analysis/
Functions/ , MATLAB, 158 linesGenMatCode-main/ GraphAnalysis/ CircBundlePlot.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ GraphAnalysis/ CircBundlePlotEdge.m - EEG Analysis/
Functions/ , MATLAB, 411 linesGenMatCode-main/ GraphAnalysis/ CircosAAL.m - EEG Analysis/
Functions/ , MATLAB, 412 linesGenMatCode-main/ GraphAnalysis/ CircosAALYeo.m - EEG Analysis/
Functions/ , MATLAB, 406 linesGenMatCode-main/ GraphAnalysis/ CircosAALYeoHist.m - EEG Analysis/
Functions/ , MATLAB, 226 linesGenMatCode-main/ GraphAnalysis/ CircosGE.m - EEG Analysis/
Functions/ , MATLAB, 256 linesGenMatCode-main/ GraphAnalysis/ CircosGE1.m - EEG Analysis/
Functions/ , MATLAB, 323 linesGenMatCode-main/ GraphAnalysis/ CircosGE2.m - EEG Analysis/
Functions/ , MATLAB, 209 linesGenMatCode-main/ GraphAnalysis/ CircosPlot.m - EEG Analysis/
Functions/ , MATLAB, 78 linesGenMatCode-main/ GraphAnalysis/ CircosPre.m - EEG Analysis/
Functions/ , MATLAB, 82 linesGenMatCode-main/ GraphAnalysis/ Cluster2BrainNet.m - EEG Analysis/
Functions/ , MATLAB, 93 linesGenMatCode-main/ GraphAnalysis/ ClusterIndividual2BrainN et.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ GraphAnalysis/ CorrMat2Degree.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ GraphAnalysis/ CytoPrepare.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ GraphAnalysis/ Data2Corr.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ GraphAnalysis/ Data2IDMatchPhInfo.m - EEG Analysis/
Functions/ , MATLAB, 10 linesGenMatCode-main/ GraphAnalysis/ DemomanhattanPlot.m - EEG Analysis/
Functions/ , MATLAB, 6 linesGenMatCode-main/ GraphAnalysis/ Edge2Degree.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ GraphAnalysis/ Edge2DegreeFixCon.m - EEG Analysis/
Functions/ , MATLAB, 34 linesGenMatCode-main/ GraphAnalysis/ Edge2NodeIndex.m - EEG Analysis/
Functions/ , MATLAB, 58 linesGenMatCode-main/ GraphAnalysis/ EdgeCorrPlot.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ GraphAnalysis/ EdgeExtract.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ GraphAnalysis/ EdgeNode2EdgeListIndex.m - EEG Analysis/
Functions/ , MATLAB, 141 linesGenMatCode-main/ GraphAnalysis/ GT_CirBundleHeatPlot.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ GraphAnalysis/ GT_CirBundlePlot.m - EEG Analysis/
Functions/ , MATLAB, 192 linesGenMatCode-main/ GraphAnalysis/ LearnStructureLU.m - EEG Analysis/
Functions/ , MATLAB, 445 linesGenMatCode-main/ GraphAnalysis/ LoopsFind.m - EEG Analysis/
Functions/ , MATLAB, 259 linesGenMatCode-main/ GraphAnalysis/ LuPairRegressPlotGroup.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ GraphAnalysis/ ParcorrfMRI.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ GraphAnalysis/ adj2loop.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ GraphAnalysis/ arcPlot.m - EEG Analysis/
Functions/ , MATLAB, 33 linesGenMatCode-main/ GraphAnalysis/ arcPlotDemo.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ GraphAnalysis/ barplotLu.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ GraphAnalysis/ bonf_holm.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ GraphAnalysis/ colorMapCreat.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ GraphAnalysis/ compare_loop.m - EEG Analysis/
Functions/ , MATLAB, 398 linesGenMatCode-main/ GraphAnalysis/ consensusplot.m - EEG Analysis/
Functions/ , MATLAB, 9 linesGenMatCode-main/ GraphAnalysis/ corr2Fisher.m - EEG Analysis/
Functions/ , MATLAB, 34 linesGenMatCode-main/ GraphAnalysis/ corrValueRemove.m - EEG Analysis/
Functions/ , MATLAB, 28 linesGenMatCode-main/ GraphAnalysis/ corrfMRI.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ GraphAnalysis/ demoAdj2Loop.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ GraphAnalysis/ edgeFromMetaResult.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ GraphAnalysis/ edge_list2net.m - EEG Analysis/
Functions/ , MATLAB, 51 linesGenMatCode-main/ GraphAnalysis/ extract_edges_all.m - EEG Analysis/
Functions/ , MATLAB, 267 linesGenMatCode-main/ GraphAnalysis/ fast_mo_sgn.m - EEG Analysis/
Functions/ , MATLAB, 59 linesGenMatCode-main/ GraphAnalysis/ heterogeneity_test_rando m.m - EEG Analysis/
Functions/ , MATLAB, 319 linesGenMatCode-main/ GraphAnalysis/ hrgplot.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ GraphAnalysis/ linerrorbar.m - EEG Analysis/
Functions/ , MATLAB, 111 linesGenMatCode-main/ GraphAnalysis/ link_forestplot.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ GraphAnalysis/ link_test_simple.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ GraphAnalysis/ mk_matrix2dag.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ GraphAnalysis/ mutli_site_analysis.m - EEG Analysis/
Functions/ , MATLAB, 386 linesGenMatCode-main/ GraphAnalysis/ optimalleaforderLU.m - EEG Analysis/
Functions/ , MATLAB, 109 linesGenMatCode-main/ GraphAnalysis/ rose2.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Neuroscience/ Behaviors/ InsertTimeCoor.m - EEG Analysis/
Functions/ , MATLAB, 127 linesGenMatCode-main/ Neuroscience/ Behaviors/ KalmanFilterTrajectory.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Neuroscience/ Behaviors/ RemoveSpeedDownArtifacts .m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Neuroscience/ Behaviors/ RoutinMerge.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Neuroscience/ Behaviors/ RoutinSimilarity.m - EEG Analysis/
Functions/ , MATLAB, 44 linesGenMatCode-main/ Neuroscience/ Behaviors/ RunningTh.m - EEG Analysis/
Functions/ , MATLAB, 142 linesGenMatCode-main/ Neuroscience/ Behaviors/ VelocityPeriStim.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ Neuroscience/ Behaviors/ VelocityRatio.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Neuroscience/ Behaviors/ speedCal.m - EEG Analysis/
Functions/ , MATLAB, 10 linesGenMatCode-main/ Neuroscience/ Placecell/ Bankformat.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ Neuroscience/ Placecell/ BehaviorEgo_Nex.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ Neuroscience/ Placecell/ BehaviorEgo_NexNormTrace .m - EEG Analysis/
Functions/ , MATLAB, 246 linesGenMatCode-main/ Neuroscience/ Placecell/ CauWaveDemo1.m - EEG Analysis/
Functions/ , MATLAB, 98 linesGenMatCode-main/ Neuroscience/ Placecell/ CauWaveDemo2.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ Neuroscience/ Placecell/ CauWaveDemo3.m - EEG Analysis/
Functions/ , MATLAB, 451 linesGenMatCode-main/ Neuroscience/ Placecell/ ComputeMaps.m - EEG Analysis/
Functions/ , MATLAB, 372 linesGenMatCode-main/ Neuroscience/ Placecell/ ComputeMapsJu.m - EEG Analysis/
Functions/ , MATLAB, 386 linesGenMatCode-main/ Neuroscience/ Placecell/ ComputeMapsJu2.m - EEG Analysis/
Functions/ , MATLAB, 154 linesGenMatCode-main/ Neuroscience/ Placecell/ Compute_placefield_map.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ Neuroscience/ Placecell/ Compute_rate_map.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Neuroscience/ Placecell/ DemoEgoMapCont.m - EEG Analysis/
Functions/ , MATLAB, 209 linesGenMatCode-main/ Neuroscience/ Placecell/ DemoMapCohWavelet.m - EEG Analysis/
Functions/ , MATLAB, 78 linesGenMatCode-main/ Neuroscience/ Placecell/ DemoMapCont.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ Neuroscience/ Placecell/ DemoMapSpeed.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Neuroscience/ Placecell/ DemoPathTrial.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Neuroscience/ Placecell/ DetermineXYlimits.m - EEG Analysis/
Functions/ , MATLAB, 11 linesGenMatCode-main/ Neuroscience/ Placecell/ DistCal.m - EEG Analysis/
Functions/ , MATLAB, 86 linesGenMatCode-main/ Neuroscience/ Placecell/ EgoMapCont.m - EEG Analysis/
Functions/ , MATLAB, 59 linesGenMatCode-main/ Neuroscience/ Placecell/ EgoSpikePosLu.m - EEG Analysis/
Functions/ , MATLAB, 58 linesGenMatCode-main/ Neuroscience/ Placecell/ ExtractTrajectory.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ Neuroscience/ Placecell/ FieldFind2D_Lu.m - EEG Analysis/
Functions/ , MATLAB, 167 linesGenMatCode-main/ Neuroscience/ Placecell/ File2PathTrial.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_FieldRate1D.m - EEG Analysis/
Functions/ , MATLAB, 46 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_MapCont.m - EEG Analysis/
Functions/ , MATLAB, 79 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_PhasePrecessionPlot.m - EEG Analysis/
Functions/ , MATLAB, 183 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_PhasePrecessionPlotEX Group.m - EEG Analysis/
Functions/ , MATLAB, 182 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_PhasePrecessionPlotGr oup.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_PlaceField_1DCir.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_PlaceField_1DCirPlot. m - EEG Analysis/
Functions/ , MATLAB, 78 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_RateHist.m - EEG Analysis/
Functions/ , MATLAB, 44 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_rateMap.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_rateMapAdaptive.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Neuroscience/ Placecell/ GT_rateMapAdaptiveShuffl e.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Neuroscience/ Placecell/ InfieldCheck.m - EEG Analysis/
Functions/ , MATLAB, 126 linesGenMatCode-main/ Neuroscience/ Placecell/ KalmanFilterTrajectory.m - EEG Analysis/
Functions/ , MATLAB, 372 linesGenMatCode-main/ Neuroscience/ Placecell/ MapCohWavelet.m - EEG Analysis/
Functions/ , MATLAB, 80 linesGenMatCode-main/ Neuroscience/ Placecell/ MapCont.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Neuroscience/ Placecell/ MapCorr.m - EEG Analysis/
Functions/ , MATLAB, 319 linesGenMatCode-main/ Neuroscience/ Placecell/ MapSpeed.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Neuroscience/ Placecell/ MultiColorbar/ test_multicb.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ Neuroscience/ Placecell/ NormPlaceField2D.m - EEG Analysis/
Functions/ , MATLAB, 204 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupancyVector_map.m - EEG Analysis/
Functions/ , MATLAB, 155 linesGenMatCode-main/ Neuroscience/ Placecell/ Occupancy_map.m - EEG Analysis/
Functions/ , MATLAB, 327 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupyMapAdaptiveSmoothi ng_Nex.m - EEG Analysis/
Functions/ , MATLAB, 369 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupyMapAdaptiveSmoothi ng_NexLuOldVersion.m - EEG Analysis/
Functions/ , MATLAB, 39 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupyMapGroup_Nex.m - EEG Analysis/
Functions/ , MATLAB, 310 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupyMapTrial_Nex.m - EEG Analysis/
Functions/ , MATLAB, 178 linesGenMatCode-main/ Neuroscience/ Placecell/ OccupymapAdaptiveSmoothi ng.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Neuroscience/ Placecell/ PCAMapGroup_Nex.m - EEG Analysis/
Functions/ , MATLAB, 21 linesGenMatCode-main/ Neuroscience/ Placecell/ PathFindMotion.m - EEG Analysis/
Functions/ , MATLAB, 138 linesGenMatCode-main/ Neuroscience/ Placecell/ PhasePrecesionUPMC.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Neuroscience/ Placecell/ PlaceCellMutualInfo.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Neuroscience/ Placecell/ PlaceFieldAngularShift.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ Neuroscience/ Placecell/ PlaceFieldFind2D.m - EEG Analysis/
Functions/ , MATLAB, 180 linesGenMatCode-main/ Neuroscience/ Placecell/ RateMapAdaptiveShuffle_N ex.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ Neuroscience/ Placecell/ RateMapAdaptiveSmoothing _Nex.m - EEG Analysis/
Functions/ , MATLAB, 192 linesGenMatCode-main/ Neuroscience/ Placecell/ RateMapAdaptive_Nex.m - EEG Analysis/
Functions/ , MATLAB, 233 linesGenMatCode-main/ Neuroscience/ Placecell/ RateMap_Nex.m - EEG Analysis/
Functions/ , MATLAB, 99 linesGenMatCode-main/ Neuroscience/ Placecell/ RebuildDataWaveMissingPo ints.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ Neuroscience/ Placecell/ RemoveRearingArtifacts.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Neuroscience/ Placecell/ RemoveSpeedDownArtifacts .m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Neuroscience/ Placecell/ RemoveSpeedDownArtifacts _NAT.m - EEG Analysis/
Functions/ , MATLAB, 42 linesGenMatCode-main/ Neuroscience/ Placecell/ RunDistDect.m - EEG Analysis/
Functions/ , MATLAB, 108 linesGenMatCode-main/ Neuroscience/ Placecell/ SmoothDec.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ Neuroscience/ Placecell/ Sparsity.m - EEG Analysis/
Functions/ , MATLAB, 152 linesGenMatCode-main/ Neuroscience/ Placecell/ SpatialShuffle_Nex.m - EEG Analysis/
Functions/ , MATLAB, 80 linesGenMatCode-main/ Neuroscience/ Placecell/ SpeedThreshold.m - EEG Analysis/
Functions/ , MATLAB, 69 linesGenMatCode-main/ Neuroscience/ Placecell/ TsDirMotion.m - EEG Analysis/
Functions/ , MATLAB, 301 linesGenMatCode-main/ Neuroscience/ Placecell/ TsHeadMotion_Nex.m - EEG Analysis/
Functions/ , MATLAB, 87 linesGenMatCode-main/ Neuroscience/ Placecell/ TsHeadMotion_NexJulie.m - EEG Analysis/
Functions/ , MATLAB, 164 linesGenMatCode-main/ Neuroscience/ Placecell/ TsTriMotionMap.m - EEG Analysis/
Functions/ , MATLAB, 336 linesGenMatCode-main/ Neuroscience/ Placecell/ TsTriMotionMap_Nex.m - EEG Analysis/
Functions/ , MATLAB, 140 linesGenMatCode-main/ Neuroscience/ Placecell/ VectorContinuity.m - EEG Analysis/
Functions/ , MATLAB, 50 linesGenMatCode-main/ Neuroscience/ Placecell/ VectorSmility.m - EEG Analysis/
Functions/ , MATLAB, 6 linesGenMatCode-main/ Neuroscience/ Placecell/ adjustMap.m - EEG Analysis/
Functions/ , MATLAB, 60 linesGenMatCode-main/ Neuroscience/ Placecell/ autoCorrelationMap.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Neuroscience/ Placecell/ boxCoverage.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Neuroscience/ Placecell/ boxCoverage2.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Neuroscience/ Placecell/ boxCoverage3.m - EEG Analysis/
Functions/ , MATLAB, 70 linesGenMatCode-main/ Neuroscience/ Placecell/ boxcarSmoothing.m - EEG Analysis/
Functions/ , MATLAB, 189 linesGenMatCode-main/ Neuroscience/ Placecell/ cicular_common_UPMC.m - EEG Analysis/
Functions/ , MATLAB, 65 linesGenMatCode-main/ Neuroscience/ Placecell/ correlation.m - EEG Analysis/
Functions/ , MATLAB, 135 linesGenMatCode-main/ Neuroscience/ Placecell/ dataSplit.m - EEG Analysis/
Functions/ , MATLAB, 121 linesGenMatCode-main/ Neuroscience/ Placecell/ demo.m - EEG Analysis/
Functions/ , MATLAB, 130 linesGenMatCode-main/ Neuroscience/ Placecell/ demo1.m - EEG Analysis/
Functions/ , MATLAB, 61 linesGenMatCode-main/ Neuroscience/ Placecell/ fieldMotionCohere.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Neuroscience/ Placecell/ fieldcohere.m - EEG Analysis/
Functions/ , MATLAB, 1 lineGenMatCode-main/ Neuroscience/ Placecell/ getSpkInd.m - EEG Analysis/
Functions/ , MATLAB, 5,967 linesGenMatCode-main/ Neuroscience/ Placecell/ gridnessScore9_4.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Neuroscience/ Placecell/ mapstat.m - EEG Analysis/
Functions/ , MATLAB, 419 linesGenMatCode-main/ Neuroscience/ Placecell/ parameters.m - EEG Analysis/
Functions/ , MATLAB, 59 linesGenMatCode-main/ Neuroscience/ Placecell/ pointCorr.m - EEG Analysis/
Functions/ , MATLAB, 295 linesGenMatCode-main/ Neuroscience/ Placecell/ rateMap.m - EEG Analysis/
Functions/ , MATLAB, 230 linesGenMatCode-main/ Neuroscience/ Placecell/ ratemapAdaptiveSmoothing .m - EEG Analysis/
Functions/ , MATLAB, 5 linesGenMatCode-main/ Neuroscience/ Placecell/ rotatePath.m - EEG Analysis/
Functions/ , MATLAB, 633 linesGenMatCode-main/ Neuroscience/ Placecell/ smooth2005.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Neuroscience/ Placecell/ smooth2a.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Neuroscience/ Placecell/ spatialInformation.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Neuroscience/ Placecell/ spatialInformationRate.m - EEG Analysis/
Functions/ , MATLAB, 10 linesGenMatCode-main/ Neuroscience/ Placecell/ speed_cluster_script.m - EEG Analysis/
Functions/ , MATLAB, 65 linesGenMatCode-main/ Neuroscience/ Placecell/ spikePos.m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Neuroscience/ Placecell/ spikePosLu.m - EEG Analysis/
Functions/ , MATLAB, 157 linesGenMatCode-main/ Neuroscience/ Placecell/ stability.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Neuroscience/ Placecell/ testcorr.m - EEG Analysis/
Functions/ , MATLAB, 45 linesGenMatCode-main/ Neuroscience/ Placecell/ zeroLagCorrelation.m - EEG Analysis/
Functions/ , MATLAB, 51 linesGenMatCode-main/ Neuroscience/ Pos2SpaPeriod.m - EEG Analysis/
Functions/ , MATLAB, 281 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_MountainOutput.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_MountainResult.m - EEG Analysis/
Functions/ , MATLAB, 506 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_MountainView.m - EEG Analysis/
Functions/ , MATLAB, 635 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_RHD2Mat.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_TsMatch.m - EEG Analysis/
Functions/ , MATLAB, 327 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_rhd2mdaMultiWrite.m - EEG Analysis/
Functions/ , MATLAB, 213 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_rhd2mdaMultiWriteWron g.m - EEG Analysis/
Functions/ , MATLAB, 67 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_rhd2mda_HighPassFilte r.m - EEG Analysis/
Functions/ , MATLAB, 89 linesGenMatCode-main/ Neuroscience/ SpikeSort/ GT_wavePlot.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ Neuroscience/ SpikeSort/ Plx/ APextractPlot.m - EEG Analysis/
Functions/ , MATLAB, 91 linesGenMatCode-main/ Neuroscience/ SpikeSort/ Plx/ APextractPlot2.m - EEG Analysis/
Functions/ , MATLAB, 227 linesGenMatCode-main/ Neuroscience/ SpikeSort/ Plx/ mergePlxLag.m - EEG Analysis/
Functions/ , MATLAB, 45 linesGenMatCode-main/ Neuroscience/ SpikeSort/ Plx/ wavePlot.m - EEG Analysis/
Functions/ , MATLAB, 42 linesGenMatCode-main/ Neuroscience/ SpikeSort/ alignWaveForm.m - EEG Analysis/
Functions/ , MATLAB, 50 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_cooledit.m - EEG Analysis/
Functions/ , MATLAB, 6 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_duration.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_width1.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_width2.m - EEG Analysis/
Functions/ , MATLAB, 91 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_width2_plx0608.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_width_Peak2Trough.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wave_width_exp.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Neuroscience/ SpikeSort/ waveform_plot.m - EEG Analysis/
Functions/ , MATLAB, 120 linesGenMatCode-main/ Neuroscience/ SpikeSort/ waveform_read_plx_linlab .m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ Neuroscience/ SpikeSort/ wf_energy.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ Yeo_JNeurophysiol11_MNI1 52/ AAL2matchYeo2011.m - EEG Analysis/
Functions/ , MATLAB, 60 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ aal.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_clusters.m - EEG Analysis/
Functions/ , MATLAB, 584 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_clusters_plabels.m - EEG Analysis/
Functions/ , MATLAB, 121 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_det_dlabels.m - EEG Analysis/
Functions/ , MATLAB, 96 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_det_plabels.m - EEG Analysis/
Functions/ , MATLAB, 29 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_dlabels.m - EEG Analysis/
Functions/ , MATLAB, 613 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_list_dlabels.m - EEG Analysis/
Functions/ , MATLAB, 716 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_list_plabels.m - EEG Analysis/
Functions/ , MATLAB, 29 linesGenMatCode-main/ Neuroscience/ fMRI/ AAL/ aal2_for_SPM12/ aal/ gin_rclusters.m - EEG Analysis/
Functions/ , MATLAB, 71 linesGenMatCode-main/ Neuroscience/ fMRI/ AlteredEdgeInfo.m - EEG Analysis/
Functions/ , MATLAB, 123 linesGenMatCode-main/ Neuroscience/ fMRI/ CVAccBNLU.m - EEG Analysis/
Functions/ , MATLAB, 120 linesGenMatCode-main/ Neuroscience/ fMRI/ CVModelLearnLU.m - EEG Analysis/
Functions/ , MATLAB, 80 linesGenMatCode-main/ Neuroscience/ fMRI/ CVModelStructureLearnLU. m - EEG Analysis/
Functions/ , MATLAB, 412 linesGenMatCode-main/ Neuroscience/ fMRI/ CircosAALYeo.m - EEG Analysis/
Functions/ , MATLAB, 406 linesGenMatCode-main/ Neuroscience/ fMRI/ CircosAALYeoHist.m - EEG Analysis/
Functions/ , MATLAB, 82 linesGenMatCode-main/ Neuroscience/ fMRI/ Cluster2BrainNet.m - EEG Analysis/
Functions/ , MATLAB, 93 linesGenMatCode-main/ Neuroscience/ fMRI/ ClusterIndividual2BrainN et.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ Neuroscience/ fMRI/ CorrMat2Degree.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ Neuroscience/ fMRI/ CytoPrepare.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ Neuroscience/ fMRI/ Data2Corr.m - EEG Analysis/
Functions/ , MATLAB, 10 linesGenMatCode-main/ Neuroscience/ fMRI/ DemomanhattanPlot.m - EEG Analysis/
Functions/ , MATLAB, 192 linesGenMatCode-main/ Neuroscience/ fMRI/ LearnStructureLU.m - EEG Analysis/
Functions/ , MATLAB, 445 linesGenMatCode-main/ Neuroscience/ fMRI/ LoopsFind.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ Neuroscience/ fMRI/ LoopsFindAALData.m - EEG Analysis/
Functions/ , MATLAB, 84 linesGenMatCode-main/ Neuroscience/ fMRI/ LoopsFindAALMaxEdgeNum.m - EEG Analysis/
Functions/ , MATLAB, 121 linesGenMatCode-main/ Neuroscience/ fMRI/ Lu_3D2ROI.m - EEG Analysis/
Functions/ , MATLAB, 92 linesGenMatCode-main/ Neuroscience/ fMRI/ Lu_3D2Vox.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Neuroscience/ fMRI/ Lu_4D2ROI.m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Neuroscience/ fMRI/ Lu_4D2Vox.m - EEG Analysis/
Functions/ , MATLAB, 102 linesGenMatCode-main/ Neuroscience/ fMRI/ Mat2BrainNet.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Neuroscience/ fMRI/ MyWatershed.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ Neuroscience/ fMRI/ ParcorrfMRI.m - EEG Analysis/
Functions/ , MATLAB, 45 linesGenMatCode-main/ Neuroscience/ fMRI/ SigFC_Behavior_NS.m - EEG Analysis/
Functions/ , MATLAB, 34 linesGenMatCode-main/ Neuroscience/ fMRI/ corrValueRemove.m - EEG Analysis/
Functions/ , MATLAB, 28 linesGenMatCode-main/ Neuroscience/ fMRI/ corrfMRI.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Neuroscience/ fMRI/ demoAdj2Loop.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Neuroscience/ fMRI/ edge_list2net.m - EEG Analysis/
Functions/ , MATLAB, 51 linesGenMatCode-main/ Neuroscience/ fMRI/ extract_edges_all.m - EEG Analysis/
Functions/ , MATLAB, 59 linesGenMatCode-main/ Neuroscience/ fMRI/ heterogeneity_test_rando m.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Neuroscience/ fMRI/ linerrorbar.m - EEG Analysis/
Functions/ , MATLAB, 111 linesGenMatCode-main/ Neuroscience/ fMRI/ link_forestplot.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Neuroscience/ fMRI/ link_test_simple.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ Neuroscience/ fMRI/ mk_matrix2dag.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ Neuroscience/ fMRI/ mutli_site_analysis.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Neuroscience/ fMRI/ regress_wei.m - EEG Analysis/
Functions/ , MATLAB, 109 linesGenMatCode-main/ Neuroscience/ fMRI/ rose2.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Neuroscience/ fMRI/ voxel_ttest_remcov.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ Neuroscience/ fMRI/ voxel_ttest_remcov_fast. m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ Neuroscience/ fMRI/ voxel_ttest_remcov_fastL U.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Neuroscience/ generate_lfp.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ Neuroscience/ generate_wave_spike-.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ Neuroscience/ generate_wave_spike-new. m - EEG Analysis/
Functions/ , MATLAB, 138 linesGenMatCode-main/ Neuroscience/ selectindex2.m - EEG Analysis/
Functions/ , MATLAB, 81 linesGenMatCode-main/ Numeric/ Cicular data/ CircStats_1Way_LU.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Numeric/ Cicular data/ DirRate.m - EEG Analysis/
Functions/ , MATLAB, 108 linesGenMatCode-main/ Numeric/ Cicular data/ GT_CalPPC.m - EEG Analysis/
Functions/ , MATLAB, 141 linesGenMatCode-main/ Numeric/ Cicular data/ GT_CalPPCgpu.m - EEG Analysis/
Functions/ , MATLAB, 203 linesGenMatCode-main/ Numeric/ Cicular data/ GT_Spike2Phase.m - EEG Analysis/
Functions/ , MATLAB, 61 linesGenMatCode-main/ Numeric/ Cicular data/ GT_Spike2PhaseMorlet.m - EEG Analysis/
Functions/ , MATLAB, 52 linesGenMatCode-main/ Numeric/ Cicular data/ GT_cic_linear_regressBuz saki.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Numeric/ Cicular data/ HistPolarData.m - EEG Analysis/
Functions/ , MATLAB, 21 linesGenMatCode-main/ Numeric/ Cicular data/ Phase2Trough.m - EEG Analysis/
Functions/ , MATLAB, 29 linesGenMatCode-main/ Numeric/ Cicular data/ Untitled4.m - EEG Analysis/
Functions/ , MATLAB, 6 linesGenMatCode-main/ Numeric/ Cicular data/ bottom_climax_change.m - EEG Analysis/
Functions/ , MATLAB, 348 linesGenMatCode-main/ Numeric/ Cicular data/ cic_interface.m - EEG Analysis/
Functions/ , MATLAB, 13 linesGenMatCode-main/ Numeric/ Cicular data/ cic_linear_regress.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Numeric/ Cicular data/ cic_linear_regressBuzsak i.m - EEG Analysis/
Functions/ , MATLAB, 61 linesGenMatCode-main/ Numeric/ Cicular data/ cic_ripple_vs_time.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Numeric/ Cicular data/ cic_ripple_vs_time2.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Numeric/ Cicular data/ cic_ripple_vs_time3.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Numeric/ Cicular data/ cic_ripple_vs_time_demo. m - EEG Analysis/
Functions/ , MATLAB, 29 linesGenMatCode-main/ Numeric/ Cicular data/ cic_vs_time_demo.m - EEG Analysis/
Functions/ , MATLAB, 90 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_ADvsTheta.m - EEG Analysis/
Functions/ , MATLAB, 52 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_cic_vs_time.m - EEG Analysis/
Functions/ , MATLAB, 225 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common.m - EEG Analysis/
Functions/ , MATLAB, 208 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common_gamma.m - EEG Analysis/
Functions/ , MATLAB, 364 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common_gamma_dem o.m - EEG Analysis/
Functions/ , MATLAB, 135 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common_ghy.m - EEG Analysis/
Functions/ , MATLAB, 137 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common_ripple.m - EEG Analysis/
Functions/ , MATLAB, 265 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_common_ripple_de mo.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_cutoutside.m - EEG Analysis/
Functions/ , MATLAB, 161 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_filter.m - EEG Analysis/
Functions/ , MATLAB, 157 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_filter2.m - EEG Analysis/
Functions/ , MATLAB, 89 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_final.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_final_wave.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_hilbert.m - EEG Analysis/
Functions/ , MATLAB, 132 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_hilbert_ghy.m - EEG Analysis/
Functions/ , MATLAB, 396 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_human.m - EEG Analysis/
Functions/ , MATLAB, 186 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_nonfilter.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_num.m - EEG Analysis/
Functions/ , MATLAB, 91 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_num_gamma.m - EEG Analysis/
Functions/ , MATLAB, 86 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_num_ripple1.m - EEG Analysis/
Functions/ , MATLAB, 45 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_num_ripple2.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_plot.m - EEG Analysis/
Functions/ , MATLAB, 11 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_transfer.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ Cicular data/ cicular_write.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Numeric/ Cicular data/ circ_rLU.m - EEG Analysis/
Functions/ , MATLAB, 128 linesGenMatCode-main/ Numeric/ Cicular data/ circ_regress_buzsaki.m - EEG Analysis/
Functions/ , MATLAB, 522 linesGenMatCode-main/ Numeric/ Cicular data/ creat_gamma.m - EEG Analysis/
Functions/ , MATLAB, 7 linesGenMatCode-main/ Numeric/ Cicular data/ cut_data.m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Numeric/ Cicular data/ main_phase_interval.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ Cicular data/ mixall.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ Cicular data/ mixall_AD.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ Cicular data/ mixall_common.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ Numeric/ Cicular data/ mixall_ts.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ Numeric/ Cicular data/ mmgca.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ Numeric/ Cicular data/ mmgcf.m - EEG Analysis/
Functions/ , MATLAB, 515 linesGenMatCode-main/ Numeric/ Cicular data/ mmpolar.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Numeric/ Cicular data/ os_score_vs_time.m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Numeric/ Cicular data/ oscillation_score.m - EEG Analysis/
Functions/ , MATLAB, 9 linesGenMatCode-main/ Numeric/ Cicular data/ phase_fit.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ Numeric/ Cicular data/ phase_lock_ave.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ Numeric/ Cicular data/ phase_lock_comput.m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Numeric/ Cicular data/ sum_category_theta.m - EEG Analysis/
Functions/ , MATLAB, 18 linesGenMatCode-main/ Numeric/ Cicular data/ sum_category_theta_maxbi n.m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Numeric/ Cicular data/ thetadetect.m - EEG Analysis/
Functions/ , MATLAB, 130 linesGenMatCode-main/ Numeric/ Cicular data/ wave_timerange.m - EEG Analysis/
Functions/ , MATLAB, 26 linesGenMatCode-main/ Numeric/ CorrToCommunity.m - EEG Analysis/
Functions/ , MATLAB, 46 linesGenMatCode-main/ Numeric/ CrCoCAng.m - EEG Analysis/
Functions/ , MATLAB, 58 linesGenMatCode-main/ Numeric/ CrCoCC.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Numeric/ Data1InData2Bin.m - EEG Analysis/
Functions/ , MATLAB, 208 linesGenMatCode-main/ Numeric/ FastPeakFind.m - EEG Analysis/
Functions/ , MATLAB, 8 linesGenMatCode-main/ Numeric/ FieldName2Struct.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ MakeTrialLFP.m - EEG Analysis/
Functions/ , MATLAB, 21 linesGenMatCode-main/ Numeric/ MapFields1to2.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ Numeric/ MarkToPeriod.m - EEG Analysis/
Functions/ , MATLAB, 31 linesGenMatCode-main/ Numeric/ MergePeriod.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Numeric/ MetaAnalysis.m - EEG Analysis/
Functions/ , MATLAB, 315 linesGenMatCode-main/ Numeric/ NANcorrcoef.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ Numeric/ NonZeroRowAve.m - EEG Analysis/
Functions/ , MATLAB, 42 linesGenMatCode-main/ Numeric/ Period1InNonPeriod2.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Numeric/ Period1InPeriod2.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Numeric/ Period2LFPIndex.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ Numeric/ PeriodFrom01.m - EEG Analysis/
Functions/ , MATLAB, 75 linesGenMatCode-main/ Numeric/ RateHist.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ RowAve.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ RowMedian.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Numeric/ SignalProcessing/ COHwaveletTest.m - EEG Analysis/
Functions/ , MATLAB, 174 linesGenMatCode-main/ Numeric/ SignalProcessing/ DemowcoherLU.m - EEG Analysis/
Functions/ , MATLAB, 341 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_CrossFre.m - EEG Analysis/
Functions/ , MATLAB, 671 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_GammaEventsThetaPhase .m - EEG Analysis/
Functions/ , MATLAB, 123 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_LFPCoh_WL.m - EEG Analysis/
Functions/ , MATLAB, 255 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_MultiTsTriSpectrum.m - EEG Analysis/
Functions/ , MATLAB, 252 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_PSD_Period.m - EEG Analysis/
Functions/ , MATLAB, 214 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_PSDthetaOld.m - EEG Analysis/
Functions/ , MATLAB, 90 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_RippleParam.m - EEG Analysis/
Functions/ , MATLAB, 651 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_SpecThetaAlign.m - EEG Analysis/
Functions/ , MATLAB, 620 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_SpecThetaAlignOld.m - EEG Analysis/
Functions/ , MATLAB, 285 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_SpecThetaExtract.m - EEG Analysis/
Functions/ , MATLAB, 224 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_TsTriggerSpectrum.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_gammaThetaField.m - EEG Analysis/
Functions/ , MATLAB, 147 lines, 1 matchGenMatCode-main/ Numeric/ SignalProcessing/ GT_welchPsdTrial.m - EEG Analysis/
Functions/ , MATLAB, 145 linesGenMatCode-main/ Numeric/ SignalProcessing/ GT_welchSpecTrial.m - EEG Analysis/
Functions/ , MATLAB, 116 linesGenMatCode-main/ Numeric/ SignalProcessing/ LuMOSEwavCFandSD.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Numeric/ SignalProcessing/ PeakPeriodFindCont.m - EEG Analysis/
Functions/ , MATLAB, 107 linesGenMatCode-main/ Numeric/ SignalProcessing/ PowerRep.m - EEG Analysis/
Functions/ , MATLAB, 76 linesGenMatCode-main/ Numeric/ SignalProcessing/ SpectrumField2D.m - EEG Analysis/
Functions/ , MATLAB, 189 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspecMorse_EqualTriL .m - EEG Analysis/
Functions/ , MATLAB, 189 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspecMorse_NonEqualT riL.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspecMorse_NonEqualT riL_TrialIndex.m - EEG Analysis/
Functions/ , MATLAB, 65 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspecMorse_Trial.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspec_EqualTriL.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspec_NonEqualTriL.m - EEG Analysis/
Functions/ , MATLAB, 135 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspec_NonEqualTriL_T rialIndex.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspec_Trial.m - EEG Analysis/
Functions/ , MATLAB, 98 linesGenMatCode-main/ Numeric/ SignalProcessing/ crossspec_TrialIndex.m - EEG Analysis/
Functions/ , MATLAB, 197 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ ArtifactRemoveTest/ ArtifactRemove.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ FilterBeta.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ FilterDelta.m - EEG Analysis/
Functions/ , MATLAB, 96 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ FilterGamma.m - EEG Analysis/
Functions/ , MATLAB, 183 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ FilterRipple.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ FilterTheta.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ Noise50HzRemove.m - EEG Analysis/
Functions/ , MATLAB, 191 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ ThetaNormalize.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ demo.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ demoEEGLABfilter.m - EEG Analysis/
Functions/ , MATLAB, 89 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ demolyx.m - EEG Analysis/
Functions/ , MATLAB, 627 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ filter_SMR.m - EEG Analysis/
Functions/ , MATLAB, 804 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ filter_SMR_ArtReMove.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter/ test/ demo.m - EEG Analysis/
Functions/ , MATLAB, 197 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ ArtifactRemoveTest/ ArtifactRemove.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ FilterBeta.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ FilterDelta.m - EEG Analysis/
Functions/ , MATLAB, 96 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ FilterGamma.m - EEG Analysis/
Functions/ , MATLAB, 183 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ FilterRipple.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ FilterTheta.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ Noise50HzRemove.m - EEG Analysis/
Functions/ , MATLAB, 191 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ ThetaNormalize.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ demo.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ demoEEGLABfilter.m - EEG Analysis/
Functions/ , MATLAB, 89 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ demolyx.m - EEG Analysis/
Functions/ , MATLAB, 627 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ filter_SMR.m - EEG Analysis/
Functions/ , MATLAB, 804 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ filter_SMR_ArtReMove.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ SignalProcessing/ filter1/ test/ demo.m - EEG Analysis/
Functions/ , MATLAB, 152 linesGenMatCode-main/ Numeric/ SignalProcessing/ pmtmLu.m - EEG Analysis/
Functions/ , MATLAB, 105 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ BK_ThetaPeriodDect.m - EEG Analysis/
Functions/ , MATLAB, 120 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ BK_ThetaPeriodDect2.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Coh_TrialIndex.m - EEG Analysis/
Functions/ , MATLAB, 230 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_CohThetaExtract.m - EEG Analysis/
Functions/ , MATLAB, 240 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_MorseCoh.m - EEG Analysis/
Functions/ , MATLAB, 205 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_MorseSpec.m - EEG Analysis/
Functions/ , MATLAB, 325 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SWMCMorSpec.m - EEG Analysis/
Functions/ , MATLAB, 284 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SWMFreTimeExtract.m - EEG Analysis/
Functions/ , MATLAB, 360 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SWMMorseSpec.m - EEG Analysis/
Functions/ , MATLAB, 277 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SWMSpecExtract.m - EEG Analysis/
Functions/ , MATLAB, 290 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SWMcspecExtract.m - EEG Analysis/
Functions/ , MATLAB, 229 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_SpecThetaExtract.m - EEG Analysis/
Functions/ , MATLAB, 293 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_TSTriggerSpec.m - EEG Analysis/
Functions/ , MATLAB, 293 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ LU_WCSThetaExtract.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Lag_power_eeglab.m - EEG Analysis/
Functions/ , MATLAB, 85 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Lag_power_time_SF2paper. m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Lag_power_time_SF2paper1 .m - EEG Analysis/
Functions/ , MATLAB, 135 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Lag_power_time_SF2paper2 .m - EEG Analysis/
Functions/ , MATLAB, 60 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ OrderUC_kal.m - EEG Analysis/
Functions/ , MATLAB, 142 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ PSDwavelet.m - EEG Analysis/
Functions/ , MATLAB, 100 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ PeakTrough_PhaseCal.m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ PowerAmp_time.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ PowerAmp_time_eeglab.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ PowerAmp_time_spec.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Spec_theta.m - EEG Analysis/
Functions/ , MATLAB, 132 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ Spec_theta_demo.m - EEG Analysis/
Functions/ , MATLAB, 95 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ XCF_power.m - EEG Analysis/
Functions/ , MATLAB, 126 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ causality_NaviSmr.m - EEG Analysis/
Functions/ , MATLAB, 197 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ cfc_measure_morse.m - EEG Analysis/
Functions/ , MATLAB, 140 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ cmtmLu.m - EEG Analysis/
Functions/ , MATLAB, 90 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ coh_NaviSmr.m - EEG Analysis/
Functions/ , MATLAB, 100 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ coh_NexTrialData.m - EEG Analysis/
Functions/ , MATLAB, 100 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ coh_TrialData.m - EEG Analysis/
Functions/ , MATLAB, 111 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ computeDFT.m - EEG Analysis/
Functions/ , MATLAB, 115 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ computeperiodogram.m - EEG Analysis/
Functions/ , MATLAB, 52 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ corr_spec.m - EEG Analysis/
Functions/ , MATLAB, 666 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ cwtft_LU.m - EEG Analysis/
Functions/ , MATLAB, 58 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ kal2spec.m - EEG Analysis/
Functions/ , MATLAB, 92 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ kal_demo.m - EEG Analysis/
Functions/ , MATLAB, 50 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ kal_spec_perievent.m - EEG Analysis/
Functions/ , MATLAB, 252 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ mvfreqz_ar.m - EEG Analysis/
Functions/ , MATLAB, 85 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ psd_NaviSmr.m - EEG Analysis/
Functions/ , MATLAB, 133 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ psd_TrialData.m - EEG Analysis/
Functions/ , MATLAB, 82 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ pwelchTrial.m - EEG Analysis/
Functions/ , MATLAB, 13 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ smoothCFSLu.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ smoothCFSMorletMatlab.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spec_kal.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms.m - EEG Analysis/
Functions/ , MATLAB, 93 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms_spike.m - EEG Analysis/
Functions/ , MATLAB, 143 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms_spike_write .m - EEG Analysis/
Functions/ , MATLAB, 256 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms_spike_write 1.m - EEG Analysis/
Functions/ , MATLAB, 154 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms_spike_write 2.m - EEG Analysis/
Functions/ , MATLAB, 227 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ spectrograms_wave_write. m - EEG Analysis/
Functions/ , MATLAB, 381 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ waveletLU.m - EEG Analysis/
Functions/ , MATLAB, 381 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ wcoherLU.m - EEG Analysis/
Functions/ , MATLAB, 406 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ wcoher_newVersion.m - EEG Analysis/
Functions/ , MATLAB, 437 linesGenMatCode-main/ Numeric/ SignalProcessing/ power/ wcoher_newVersion2.m - EEG Analysis/
Functions/ , MATLAB, 140 lines, 1 matchGenMatCode-main/ Numeric/ SignalProcessing/ power/ welchSpecLuTrial.m - EEG Analysis/
Functions/ , MATLAB, 172 linesGenMatCode-main/ Numeric/ SignalProcessing/ psdMTM_NaviSmr.m - EEG Analysis/
Functions/ , MATLAB, 127 linesGenMatCode-main/ Numeric/ SignalProcessing/ psd_TrialDataCovTh.m - EEG Analysis/
Functions/ , MATLAB, 131 linesGenMatCode-main/ Numeric/ SignalProcessing/ psd_TrialDataVsCov.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Numeric/ SignalProcessing/ rippleNegPeakDetects.m - EEG Analysis/
Functions/ , MATLAB, 50 linesGenMatCode-main/ Numeric/ SignalProcessing/ rowAddingPower.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ sowastest.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ sowastest2.m - EEG Analysis/
Functions/ , MATLAB, 121 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ test.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ try.m - EEG Analysis/
Functions/ , MATLAB, 151 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ waveletLu.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavelet/ wtcr16.m - EEG Analysis/
Functions/ , MATLAB, 69 linesGenMatCode-main/ Numeric/ SignalProcessing/ wavesigfLU.m - EEG Analysis/
Functions/ , MATLAB, 132 linesGenMatCode-main/ Numeric/ SignalProcessing/ wcoherSigfLU.m - EEG Analysis/
Functions/ , MATLAB, 181 linesGenMatCode-main/ Numeric/ SignalProcessing/ welch.m - EEG Analysis/
Functions/ , MATLAB, 158 linesGenMatCode-main/ Numeric/ SignalProcessing/ welchCohLu.m - EEG Analysis/
Functions/ , MATLAB, 141 linesGenMatCode-main/ Numeric/ SignalProcessing/ welchCohLuTrial.m - EEG Analysis/
Functions/ , MATLAB, 242 linesGenMatCode-main/ Numeric/ SignalProcessing/ welchLu.m - EEG Analysis/
Functions/ , MATLAB, 223 linesGenMatCode-main/ Numeric/ SignalProcessing/ welchparse.m - EEG Analysis/
Functions/ , MATLAB, 59 lines, 2 matchesGenMatCode-main/ Numeric/ SignalProcessing/ wpli_TrialIndex.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Numeric/ SingleStructFiledMerge.m - EEG Analysis/
Functions/ , MATLAB, 78 linesGenMatCode-main/ Numeric/ SmoothPos1D.m - EEG Analysis/
Functions/ , MATLAB, 9 linesGenMatCode-main/ Numeric/ TsInTimerange.m - EEG Analysis/
Functions/ , MATLAB, 12 linesGenMatCode-main/ Numeric/ TsOutTimerange.m - EEG Analysis/
Functions/ , MATLAB, 23 linesGenMatCode-main/ Numeric/ autoCorrF_TS.m - EEG Analysis/
Functions/ , MATLAB, 73 linesGenMatCode-main/ Numeric/ causality/ AIC_m.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Numeric/ causality/ CauAnalysisTrialNex.m - EEG Analysis/
Functions/ , MATLAB, 87 linesGenMatCode-main/ Numeric/ causality/ CauCoh_Timelag.m - EEG Analysis/
Functions/ , MATLAB, 93 linesGenMatCode-main/ Numeric/ causality/ CauCoh_Timelag_try.m - EEG Analysis/
Functions/ , MATLAB, 288 linesGenMatCode-main/ Numeric/ causality/ CauCoh_one2one_shuffle.m - EEG Analysis/
Functions/ , MATLAB, 171 linesGenMatCode-main/ Numeric/ causality/ CauCoh_one2one_shuffleIS I.m - EEG Analysis/
Functions/ , MATLAB, 286 linesGenMatCode-main/ Numeric/ causality/ CauCoh_one2one_shuffle_m ix.m - EEG Analysis/
Functions/ , MATLAB, 240 linesGenMatCode-main/ Numeric/ causality/ CauMouseTrialNex.m - EEG Analysis/
Functions/ , MATLAB, 245 linesGenMatCode-main/ Numeric/ causality/ CauMouseTrialNexTraining .m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Numeric/ causality/ CauRep.m - EEG Analysis/
Functions/ , MATLAB, 108 linesGenMatCode-main/ Numeric/ causality/ CauTrialOrderAveAR.m - EEG Analysis/
Functions/ , MATLAB, 292 linesGenMatCode-main/ Numeric/ causality/ Causality_Condition_one2 one.m - EEG Analysis/
Functions/ , MATLAB, 304 linesGenMatCode-main/ Numeric/ causality/ Causality_Condition_one2 one_new.m - EEG Analysis/
Functions/ , MATLAB, 285 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one.m - EEG Analysis/
Functions/ , MATLAB, 294 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_del_ts .m - EEG Analysis/
Functions/ , MATLAB, 262 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_pyr.m - EEG Analysis/
Functions/ , MATLAB, 273 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_ripple .m - EEG Analysis/
Functions/ , MATLAB, 233 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_ripple _shuffle.m - EEG Analysis/
Functions/ , MATLAB, 266 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_shuffl e.m - EEG Analysis/
Functions/ , MATLAB, 268 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_shuffl e1.m - EEG Analysis/
Functions/ , MATLAB, 268 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_shuffl e2.m - EEG Analysis/
Functions/ , MATLAB, 265 linesGenMatCode-main/ Numeric/ causality/ Causality_one2one_shuffl e_pace.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Numeric/ causality/ Causality_vs_time.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ Numeric/ causality/ Causality_vs_time_demo.m - EEG Analysis/
Functions/ , MATLAB, 104 linesGenMatCode-main/ Numeric/ causality/ Coherence_one2one.m - EEG Analysis/
Functions/ , MATLAB, 287 linesGenMatCode-main/ Numeric/ causality/ Condition_try.m - EEG Analysis/
Functions/ , MATLAB, 427 linesGenMatCode-main/ Numeric/ causality/ Condition_try2.m - EEG Analysis/
Functions/ , MATLAB, 86 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ AIC_DiTrial.m - EEG Analysis/
Functions/ , MATLAB, 191 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ CauCoh_Pair_shuffleISI.m - EEG Analysis/
Functions/ , MATLAB, 194 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ CauCoh_Pair_shuffleTrial .m - EEG Analysis/
Functions/ , MATLAB, 157 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ CauCoh_Timelag_Pair.m - EEG Analysis/
Functions/ , MATLAB, 35 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ CauCoh_Timelag_Pair_demo .m - EEG Analysis/
Functions/ , MATLAB, 135 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ CauTrialAveAR.m - EEG Analysis/
Functions/ , MATLAB, 74 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Cau_shuffle_demo.m - EEG Analysis/
Functions/ , MATLAB, 238 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_Condition.m - EEG Analysis/
Functions/ , MATLAB, 176 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_Pair.m - EEG Analysis/
Functions/ , MATLAB, 246 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_Pair_ripple.m - EEG Analysis/
Functions/ , MATLAB, 214 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_Pair_ripple_sh uffle.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_vs_time_Pair.m - EEG Analysis/
Functions/ , MATLAB, 28 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Causality_vs_time_demo.m - EEG Analysis/
Functions/ , MATLAB, 90 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ Condition_demo.m - EEG Analysis/
Functions/ , MATLAB, 163 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ aicbic.m - EEG Analysis/
Functions/ , MATLAB, 105 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ armorfTest.m - EEG Analysis/
Functions/ , MATLAB, 121 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ armorf_DiTrial.m - EEG Analysis/
Functions/ , MATLAB, 126 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ causality_1to1.m - EEG Analysis/
Functions/ , MATLAB, 155 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ causality_DiTrial.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ causality_pair_demo.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ causality_pair_demo_thet a.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ resamp.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Numeric/ causality/ Kernel& Downsample/ shuffle.m - EEG Analysis/
Functions/ , MATLAB, 46 linesGenMatCode-main/ Numeric/ causality/ NSPL/ MARSpec.m - EEG Analysis/
Functions/ , MATLAB, 105 linesGenMatCode-main/ Numeric/ causality/ NSPL/ armorf.m - EEG Analysis/
Functions/ , MATLAB, 118 linesGenMatCode-main/ Numeric/ causality/ NSPL/ armorfNoAR.M - EEG Analysis/
Functions/ , MATLAB, 147 linesGenMatCode-main/ Numeric/ causality/ NSPL/ avesti.m - EEG Analysis/
Functions/ , MATLAB, 137 linesGenMatCode-main/ Numeric/ causality/ NSPL/ basdescp.m - EEG Analysis/
Functions/ , MATLAB, 78 linesGenMatCode-main/ Numeric/ causality/ NSPL/ chninfo.m - EEG Analysis/
Functions/ , MATLAB, 11 linesGenMatCode-main/ Numeric/ causality/ NSPL/ getliststr.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Numeric/ causality/ NSPL/ getstr.m - EEG Analysis/
Functions/ , MATLAB, 13 linesGenMatCode-main/ Numeric/ causality/ NSPL/ initdraw.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Numeric/ causality/ NSPL/ keepback-DWT xorr.m - EEG Analysis/
Functions/ , MATLAB, 1,565 linesGenMatCode-main/ Numeric/ causality/ NSPL/ keepfftcoher.m - EEG Analysis/
Functions/ , MATLAB, 1,516 linesGenMatCode-main/ Numeric/ causality/ NSPL/ keepmsdwt.m - EEG Analysis/
Functions/ , MATLAB, 3,375 linesGenMatCode-main/ Numeric/ causality/ NSPL/ msMARCau.m - EEG Analysis/
Functions/ , MATLAB, 812 linesGenMatCode-main/ Numeric/ causality/ NSPL/ msdrawraw.m - EEG Analysis/
Functions/ , MATLAB, 1,541 linesGenMatCode-main/ Numeric/ causality/ NSPL/ msfilter.m - EEG Analysis/
Functions/ , MATLAB, 2,801 linesGenMatCode-main/ Numeric/ causality/ NSPL/ nspl.m - EEG Analysis/
Functions/ , MATLAB, 95 linesGenMatCode-main/ Numeric/ causality/ NSPL/ plotraw.m - EEG Analysis/
Functions/ , MATLAB, 50 linesGenMatCode-main/ Numeric/ causality/ NSPL/ pwcausal.m - EEG Analysis/
Functions/ , MATLAB, 944 linesGenMatCode-main/ Numeric/ causality/ NSPL/ template.m - EEG Analysis/
Functions/ , MATLAB, 65 linesGenMatCode-main/ Numeric/ causality/ NSPL/ whitenv.m - EEG Analysis/
Functions/ , MATLAB, 39 linesGenMatCode-main/ Numeric/ causality/ Power_cross_spectra.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Numeric/ causality/ Q_m_basic.m - EEG Analysis/
Functions/ , MATLAB, 109 linesGenMatCode-main/ Numeric/ causality/ cauOrder_DiTrial.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ Numeric/ causality/ cau_NexTrialData.m - EEG Analysis/
Functions/ , MATLAB, 107 linesGenMatCode-main/ Numeric/ causality/ caubekkOrder_DiTrial.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Numeric/ causality/ causality threhold/ Cau.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Numeric/ causality/ causality threhold/ Cau_kernel.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Numeric/ causality/ causality threhold/ Cau_mix.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Numeric/ causality/ causality threhold/ Cau_ripple.m - EEG Analysis/
Functions/ , MATLAB, 7 linesGenMatCode-main/ Numeric/ causality/ causality_MORDER_range.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ causality/ causality_compute.m - EEG Analysis/
Functions/ , MATLAB, 76 linesGenMatCode-main/ Numeric/ causality/ causality_file.m - EEG Analysis/
Functions/ , MATLAB, 91 linesGenMatCode-main/ Numeric/ causality/ causality_fre.m - EEG Analysis/
Functions/ , MATLAB, 235 linesGenMatCode-main/ Numeric/ causality/ causality_fre_demo.m - EEG Analysis/
Functions/ , MATLAB, 158 linesGenMatCode-main/ Numeric/ causality/ cohere_vs_time.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Numeric/ causality/ cohere_vs_time2.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ causality/ coherence.m - EEG Analysis/
Functions/ , MATLAB, 199 linesGenMatCode-main/ Numeric/ causality/ coherence_data_read.m - EEG Analysis/
Functions/ , MATLAB, 73 linesGenMatCode-main/ Numeric/ causality/ coherence_demo.m - EEG Analysis/
Functions/ , MATLAB, 182 linesGenMatCode-main/ Numeric/ causality/ creat.m - EEG Analysis/
Functions/ , MATLAB, 52 linesGenMatCode-main/ Numeric/ causality/ cross_spectral.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Numeric/ causality/ fix_order.m - EEG Analysis/
Functions/ , MATLAB, 29 linesGenMatCode-main/ Numeric/ causality/ power_spectral.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Numeric/ causality/ try/ PatialCau_try_condition. m - EEG Analysis/
Functions/ , MATLAB, 102 linesGenMatCode-main/ Numeric/ causality/ try/ causality_try1to1.m - EEG Analysis/
Functions/ , MATLAB, 163 linesGenMatCode-main/ Numeric/ causality/ try/ causality_try_condition. m - EEG Analysis/
Functions/ , MATLAB, 149 linesGenMatCode-main/ Numeric/ causality/ try/ condition_causality.m - EEG Analysis/
Functions/ , MATLAB, 52 linesGenMatCode-main/ Numeric/ causality/ try/ try1.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Numeric/ causality/ try/ try2.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Numeric/ causality/ try/ try3.m - EEG Analysis/
Functions/ , MATLAB, 163 linesGenMatCode-main/ Numeric/ causality/ try/ try4.m - EEG Analysis/
Functions/ , MATLAB, 28 linesGenMatCode-main/ Numeric/ corr_NanMat.m - EEG Analysis/
Functions/ , MATLAB, 15 linesGenMatCode-main/ Numeric/ crossCorrF_TS.m - EEG Analysis/
Functions/ , MATLAB, 36 linesGenMatCode-main/ Numeric/ cssm.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ Numeric/ csum.m - EEG Analysis/
Functions/ , MATLAB, 60 linesGenMatCode-main/ Numeric/ fast_corr.m - EEG Analysis/
Functions/ , MATLAB, 46 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark.m - EEG Analysis/
Functions/ , MATLAB, 205 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark1.m - EEG Analysis/
Functions/ , MATLAB, 205 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark2.m - EEG Analysis/
Functions/ , MATLAB, 210 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark3.m - EEG Analysis/
Functions/ , MATLAB, 202 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark_nexfile.m - EEG Analysis/
Functions/ , MATLAB, 196 linesGenMatCode-main/ Numeric/ heartbeat/ wave_read_mark_wavefile. m - EEG Analysis/
Functions/ , MATLAB, 33 linesGenMatCode-main/ Numeric/ infmean.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ isEven.m - EEG Analysis/
Functions/ , MATLAB, 203 linesGenMatCode-main/ Numeric/ makeKernel.m - EEG Analysis/
Functions/ , MATLAB, 203 linesGenMatCode-main/ Numeric/ makeKernel65.m - EEG Analysis/
Functions/ , MATLAB, 818 linesGenMatCode-main/ Numeric/ mdscaleLU.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Numeric/ meta_correlation.m - EEG Analysis/
Functions/ , MATLAB, 132 linesGenMatCode-main/ Numeric/ meta_net_analysis.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ Numeric/ meta_pval.m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Numeric/ mygaussfit.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ Numeric/ nanzscore.m - EEG Analysis/
Functions/ , MATLAB, 386 linesGenMatCode-main/ Numeric/ optimalleaforderLU.m - EEG Analysis/
Functions/ , MATLAB, 8 linesGenMatCode-main/ Numeric/ partial_canoncorrLU.m - EEG Analysis/
Functions/ , MATLAB, 390 linesGenMatCode-main/ Numeric/ partialcorrLU.m - EEG Analysis/
Functions/ , MATLAB, 138 linesGenMatCode-main/ Numeric/ rate_histogram.m - EEG Analysis/
Functions/ , MATLAB, 33 linesGenMatCode-main/ Numeric/ rate_histogram_kernel.m - EEG Analysis/
Functions/ , MATLAB, 32 linesGenMatCode-main/ Numeric/ ratehistogram_TS.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ Numeric/ ratehistogram_TS_Str.m - EEG Analysis/
Functions/ , MATLAB, 11 linesGenMatCode-main/ Numeric/ ste.m - EEG Analysis/
Functions/ , MATLAB, 96 linesGenMatCode-main/ Numeric/ sumskipnan.m - EEG Analysis/
Functions/ , MATLAB, 26 linesGenMatCode-main/ Numeric/ tridisolve.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Numeric/ uniqueStrCell.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ Plotfun/ AdjComImagesc.m - EEG Analysis/
Functions/ , MATLAB, 72 linesGenMatCode-main/ Plotfun/ Dyn/ MarkovState_HeatStrPlot. m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Plotfun/ Dyn/ MarkovState_Plot.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Plotfun/ Dyn/ stateSeqPlot.m - EEG Analysis/
Functions/ , MATLAB, 36 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ DNAPlot.m - EEG Analysis/
Functions/ , MATLAB, 51 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ EdgeBrainEEGLu.m - EEG Analysis/
Functions/ , MATLAB, 31 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ EdgeBrainLu.m - EEG Analysis/
Functions/ , MATLAB, 45 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ EdgeBrainLuML.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ FC_BrainEEGLu.m - EEG Analysis/
Functions/ , MATLAB, 34 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ LeftBrainAdj.m - EEG Analysis/
Functions/ , MATLAB, 59 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ LuAAL120Test.m - EEG Analysis/
Functions/ , MATLAB, 128 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ MultiSliceGraph.m - EEG Analysis/
Functions/ , MATLAB, 128 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ MultiSliceGraphEdgeWeigh t.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ NodeBrainEEGLu.m - EEG Analysis/
Functions/ , MATLAB, 33 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ NodeBrainLu.m - EEG Analysis/
Functions/ , MATLAB, 100 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ NodeBrainLuML.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ SurfaceBrainLu.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ test.m - EEG Analysis/
Functions/ , MATLAB, 81 linesGenMatCode-main/ Plotfun/ LuBrainPlot/ test1.m - EEG Analysis/
Functions/ , MATLAB, 64 linesGenMatCode-main/ Plotfun/ LuPairPartialRegressPlot .m - EEG Analysis/
Functions/ , MATLAB, 60 linesGenMatCode-main/ Plotfun/ LuPairRegressPlot.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Plotfun/ Multi2DDensity.m - EEG Analysis/
Functions/ , MATLAB, 80 linesGenMatCode-main/ Plotfun/ MultiHist_GroupPlot.m - EEG Analysis/
Functions/ , MATLAB, 146 linesGenMatCode-main/ Plotfun/ MultiMatPlot/ MultiMatrix2DMatPlot.m - EEG Analysis/
Functions/ , MATLAB, 103 linesGenMatCode-main/ Plotfun/ MultiMatPlot/ MultiMatrix2DPlot.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Plotfun/ MultiMatPlot/ MultiMatrix2DPlotVerti.m - EEG Analysis/
Functions/ , MATLAB, 26 linesGenMatCode-main/ Plotfun/ MultiMatPlot/ MultiMatrix3DPlot.m - EEG Analysis/
Functions/ , MATLAB, 85 linesGenMatCode-main/ Plotfun/ MultiPolarDensity.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ Plotfun/ MultiTrace1DPlot.m - EEG Analysis/
Functions/ , MATLAB, 5 linesGenMatCode-main/ Plotfun/ MultibarPlot.m - EEG Analysis/
Functions/ , MATLAB, 317 linesGenMatCode-main/ Plotfun/ PairMixLinearSubjRF.m - EEG Analysis/
Functions/ , MATLAB, 9 linesGenMatCode-main/ Plotfun/ PeriodMarkPlot.m - EEG Analysis/
Functions/ , MATLAB, 104 linesGenMatCode-main/ Plotfun/ PhaseHistPolar.m - EEG Analysis/
Functions/ , MATLAB, 100 linesGenMatCode-main/ Plotfun/ Placecell/ InFieldPhasePrecessionPl ot.m - EEG Analysis/
Functions/ , MATLAB, 171 linesGenMatCode-main/ Plotfun/ Placecell/ PhasePrecessionPlot.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Plotfun/ Placecell/ PhasePrecessionPlot_Merg eTrial.m - EEG Analysis/
Functions/ , MATLAB, 81 linesGenMatCode-main/ Plotfun/ PlotFormat/ LuFontStandard.m - EEG Analysis/
Functions/ , MATLAB, 35 linesGenMatCode-main/ Plotfun/ PlotFormat/ LuLegend.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Plotfun/ PlotFormat/ MyWatershed.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ Plotfun/ PlotFormat/ SpherePlot.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Plotfun/ PlotFormat/ arcPlot.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Plotfun/ PlotFormat/ barplot.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Plotfun/ PlotFormat/ error_area.m - EEG Analysis/
Functions/ , MATLAB, 69 linesGenMatCode-main/ Plotfun/ PlotFormat/ showNum.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Plotfun/ PlotFormat/ showPerc.m - EEG Analysis/
Functions/ , MATLAB, 44 linesGenMatCode-main/ Plotfun/ PlotFormat/ showPvalue.m - EEG Analysis/
Functions/ , MATLAB, 46 linesGenMatCode-main/ Plotfun/ PlotFormat/ subplotLU.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ Plotfun/ PlotFormat/ subplotLUpage.m - EEG Analysis/
Functions/ , MATLAB, 44 linesGenMatCode-main/ Plotfun/ PlotFormat/ subplotPosLu.m - EEG Analysis/
Functions/ , MATLAB, 31 linesGenMatCode-main/ Plotfun/ SpherePlot.m - EEG Analysis/
Functions/ , MATLAB, 33 linesGenMatCode-main/ Plotfun/ arcPlotDemo.m - EEG Analysis/
Functions/ , MATLAB, 56 linesGenMatCode-main/ Plotfun/ aveY_discretizeX.m - EEG Analysis/
Functions/ , MATLAB, 81 linesGenMatCode-main/ Plotfun/ distributionPlot/ DensityDisGroup.m - EEG Analysis/
Functions/ , MATLAB, 79 linesGenMatCode-main/ Plotfun/ distributionPlot/ DensityDisGroup_WithHart igansTest.m - EEG Analysis/
Functions/ , MATLAB, 414 linesGenMatCode-main/ Plotfun/ distributionPlot/ ErrorBarHierarchy.m - EEG Analysis/
Functions/ , MATLAB, 512 linesGenMatCode-main/ Plotfun/ distributionPlot/ ErrorBarPlotLU.m - EEG Analysis/
Functions/ , MATLAB, 259 linesGenMatCode-main/ Plotfun/ distributionPlot/ ErrorBarPlotSimplePlot.m - EEG Analysis/
Functions/ , MATLAB, 415 linesGenMatCode-main/ Plotfun/ distributionPlot/ ErrorBoxPlotLU.m - EEG Analysis/
Functions/ , MATLAB, 755 linesGenMatCode-main/ Plotfun/ distributionPlot/ ErrorViolinHalf.m - EEG Analysis/
Functions/ , MATLAB, 16 linesGenMatCode-main/ Plotfun/ distributionPlot/ MultiViolinLu.m - EEG Analysis/
Functions/ , MATLAB, 106 linesGenMatCode-main/ Plotfun/ distributionPlot/ PhaseHistPolar_Bin.m - EEG Analysis/
Functions/ , MATLAB, 81 linesGenMatCode-main/ Plotfun/ distributionPlot/ PolarDensity.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Plotfun/ distributionPlot/ PthReport.m - EEG Analysis/
Functions/ , MATLAB, 578 linesGenMatCode-main/ Plotfun/ distributionPlot/ RateHist_GroupPlot.m - EEG Analysis/
Functions/ , MATLAB, 396 linesGenMatCode-main/ Plotfun/ distributionPlot/ RateHist_Stats.m - EEG Analysis/
Functions/ , MATLAB, 346 linesGenMatCode-main/ Plotfun/ distributionPlot/ Violin.m - EEG Analysis/
Functions/ , MATLAB, 376 linesGenMatCode-main/ Plotfun/ distributionPlot/ Violin_half.m - EEG Analysis/
Functions/ , MATLAB, 376 linesGenMatCode-main/ Plotfun/ distributionPlot/ Violin_halfLeft.m - EEG Analysis/
Functions/ , MATLAB, 376 linesGenMatCode-main/ Plotfun/ distributionPlot/ Violin_halfRight.m - EEG Analysis/
Functions/ , MATLAB, 4,055 linesGenMatCode-main/ Plotfun/ distributionPlot/ boxplot_Lu.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Plotfun/ distributionPlot/ circ_ErrorBarPlotLU.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Plotfun/ distributionPlot/ colorCode2rgb.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Plotfun/ distributionPlot/ countEntries.m - EEG Analysis/
Functions/ , MATLAB, 152 linesGenMatCode-main/ Plotfun/ distributionPlot/ distinguishable_colors.m - EEG Analysis/
Functions/ , MATLAB, 967 linesGenMatCode-main/ Plotfun/ distributionPlot/ distributionPlot.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Plotfun/ distributionPlot/ gscatterLU.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ Plotfun/ distributionPlot/ hist2dLU.m - EEG Analysis/
Functions/ , MATLAB, 31 linesGenMatCode-main/ Plotfun/ distributionPlot/ histPlotLU.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Plotfun/ distributionPlot/ histPlotLUData.m - EEG Analysis/
Functions/ , MATLAB, 34 linesGenMatCode-main/ Plotfun/ distributionPlot/ histPlotLUPerc.m - EEG Analysis/
Functions/ , MATLAB, 319 linesGenMatCode-main/ Plotfun/ distributionPlot/ hrgplot.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Plotfun/ distributionPlot/ manhattanPlot.m - EEG Analysis/
Functions/ , MATLAB, 818 linesGenMatCode-main/ Plotfun/ distributionPlot/ mdscaleLU.m - EEG Analysis/
Functions/ , MATLAB, 264 linesGenMatCode-main/ Plotfun/ distributionPlot/ myErrorbar.m - EEG Analysis/
Functions/ , MATLAB, 212 linesGenMatCode-main/ Plotfun/ distributionPlot/ myHistogram.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Plotfun/ distributionPlot/ perlLU.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ Plotfun/ distributionPlot/ pie3LU.m - EEG Analysis/
Functions/ , MATLAB, 370 linesGenMatCode-main/ Plotfun/ distributionPlot/ pie3s.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Plotfun/ distributionPlot/ pieLU.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Plotfun/ distributionPlot/ pieLUPerc.m - EEG Analysis/
Functions/ , MATLAB, 632 linesGenMatCode-main/ Plotfun/ distributionPlot/ plotSpread.m - EEG Analysis/
Functions/ , MATLAB, 111 linesGenMatCode-main/ Plotfun/ distributionPlot/ polar_errorArea.m - EEG Analysis/
Functions/ , MATLAB, 178 linesGenMatCode-main/ Plotfun/ distributionPlot/ polarmy.m - EEG Analysis/
Functions/ , MATLAB, 180 linesGenMatCode-main/ Plotfun/ distributionPlot/ polarmy_new.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Plotfun/ distributionPlot/ regress_Lu.m - EEG Analysis/
Functions/ , MATLAB, 140 linesGenMatCode-main/ Plotfun/ distributionPlot/ repeatEntries.m - EEG Analysis/
Functions/ , MATLAB, 38 linesGenMatCode-main/ Plotfun/ distributionPlot/ rose_bar.m - EEG Analysis/
Functions/ , MATLAB, 266 linesGenMatCode-main/ Plotfun/ distributionPlot/ violin1.m - EEG Analysis/
Functions/ , MATLAB, 127 linesGenMatCode-main/ Plotfun/ distributionPlot/ violinplot.m - EEG Analysis/
Functions/ , MATLAB, 217 linesGenMatCode-main/ Plotfun/ distributionPlot/ violinplot_half.m - EEG Analysis/
Functions/ , MATLAB, 154 linesGenMatCode-main/ Plotfun/ distributionPlot/ weightedStats.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Plotfun/ imagescGrid.m - EEG Analysis/
Functions/ , MATLAB, 134 linesGenMatCode-main/ Plotfun/ linerrorbar.m - EEG Analysis/
Functions/ , MATLAB, 375 linesGenMatCode-main/ Plotfun/ multiCorr2GroupSubplot.m - EEG Analysis/
Functions/ , MATLAB, 343 linesGenMatCode-main/ Plotfun/ multiCorrVis.m - EEG Analysis/
Functions/ , MATLAB, 47 linesGenMatCode-main/ Plotfun/ mygaussfit.m - EEG Analysis/
Functions/ , MATLAB, 1,065 linesGenMatCode-main/ Plotfun/ ndhist.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Plotfun/ plotColormap.m - EEG Analysis/
Functions/ , MATLAB, 109 linesGenMatCode-main/ Plotfun/ rose2.m - EEG Analysis/
Functions/ , MATLAB, 27 linesGenMatCode-main/ Plotfun/ tryWatershed.m - EEG Analysis/
Functions/ , MATLAB, 26 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ CompareSPSS/ LuTest1.m - EEG Analysis/
Functions/ , R, 19 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ CompareSPSS/ LuTest2.R - EEG Analysis/
Functions/ , R, 102 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ CompareSPSS/ LuTest4.R - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova2F1W1B_withR.m - EEG Analysis/
Functions/ , MATLAB, 13 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova3F2W1B_withR.m - EEG Analysis/
Functions/ , MATLAB, 19 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova3WF2W1B_withR.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova3_withR.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova4_withR.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ MixAnova5_withR.m - EEG Analysis/
Functions/ , R, 12 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ MixAnova2F1W1B.R - EEG Analysis/
Functions/ , R, 13 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ MixAnova3F2W1B.R - EEG Analysis/
Functions/ , R, 12 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ MixAnova3RNonF1.R - EEG Analysis/
Functions/ , R, 13 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ MixAnova4R.R - EEG Analysis/
Functions/ , R, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ MixAnova5R.R - EEG Analysis/
Functions/ , R, 11 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ RepAnova1.R - EEG Analysis/
Functions/ , R, 10 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ RepAnova2.R - EEG Analysis/
Functions/ , R, 11 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ RepAnova3.R - EEG Analysis/
Functions/ , R, 10 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ R/ anovaR.R - EEG Analysis/
Functions/ , MATLAB, 222 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ RMAOV1.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ RepAnova2_withR.m - EEG Analysis/
Functions/ , MATLAB, 14 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ RepAnova3_withR.m - EEG Analysis/
Functions/ , MATLAB, 216 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ anova_rm.m - EEG Analysis/
Functions/ , MATLAB, 75 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mC2X.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mCC2X.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mDemoA.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mDispModels.m - EEG Analysis/
Functions/ , MATLAB, 63 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mF.m - EEG Analysis/
Functions/ , MATLAB, 44 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mFCDF.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mFindInteractionTerms.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mFindMainTerms.m - EEG Analysis/
Functions/ , MATLAB, 49 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mFindTerms.m - EEG Analysis/
Functions/ , MATLAB, 125 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mG2X.m - EEG Analysis/
Functions/ , MATLAB, 108 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mGC2X.m - EEG Analysis/
Functions/ , MATLAB, 99 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mGG2X.m - EEG Analysis/
Functions/ , MATLAB, 42 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mIsInteractionTerm.m - EEG Analysis/
Functions/ , MATLAB, 42 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mIsMainTerm.m - EEG Analysis/
Functions/ , MATLAB, 57 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mIsMember.m - EEG Analysis/
Functions/ , MATLAB, 86 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mLHT.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mNC2.m - EEG Analysis/
Functions/ , MATLAB, 86 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mSVD.m - EEG Analysis/
Functions/ , MATLAB, 288 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mStepwise.m - EEG Analysis/
Functions/ , MATLAB, 505 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mT.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mTCDF.m - EEG Analysis/
Functions/ , MATLAB, 53 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mTerms.m - EEG Analysis/
Functions/ , MATLAB, 55 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mUnique.m - EEG Analysis/
Functions/ , MATLAB, 88 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mX.m - EEG Analysis/
Functions/ , MATLAB, 426 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mancovan_496/ mancovan.m - EEG Analysis/
Functions/ , MATLAB, 185 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mixed_between_within_ano va.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ mixed_design_anova.m - EEG Analysis/
Functions/ , MATLAB, 219 lines, 2 matchesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ myfriedman.m - EEG Analysis/
Functions/ , MATLAB, 145 linesGenMatCode-main/ Statistics/ ANOVAandMixEffect/ rm_anova2.m - EEG Analysis/
Functions/ , MATLAB, 269 linesGenMatCode-main/ Statistics/ BWAOV2.m - EEG Analysis/
Functions/ , MATLAB, 24 linesGenMatCode-main/ Statistics/ FDR.m - EEG Analysis/
Functions/ , MATLAB, 30 linesGenMatCode-main/ Statistics/ HartigansDipSignifTest.m - EEG Analysis/
Functions/ , MATLAB, 305 linesGenMatCode-main/ Statistics/ HartigansDipTest.m - EEG Analysis/
Functions/ , MATLAB, 21 linesGenMatCode-main/ Statistics/ LUbioinfochecknargin.m - EEG Analysis/
Functions/ , MATLAB, 392 linesGenMatCode-main/ Statistics/ LUmafdr.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Statistics/ LUoptPartialMatch.m - EEG Analysis/
Functions/ , MATLAB, 43 linesGenMatCode-main/ Statistics/ LUopttf.m - EEG Analysis/
Functions/ , MATLAB, 83 linesGenMatCode-main/ Statistics/ Meta/ MetaAnalysis.m - EEG Analysis/
Functions/ , MATLAB, 68 linesGenMatCode-main/ Statistics/ Meta/ meta_correlation.m - EEG Analysis/
Functions/ , MATLAB, 132 linesGenMatCode-main/ Statistics/ Meta/ meta_net_analysis.m - EEG Analysis/
Functions/ , MATLAB, 41 linesGenMatCode-main/ Statistics/ Meta/ meta_pval.m - EEG Analysis/
Functions/ , MATLAB, 48 linesGenMatCode-main/ Statistics/ PthReport.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Statistics/ Thfdr_Pmatrix.m - EEG Analysis/
Functions/ , MATLAB, 117 linesGenMatCode-main/ Statistics/ bonf_holm.m - EEG Analysis/
Functions/ , MATLAB, 398 linesGenMatCode-main/ Statistics/ consensusplot.m - EEG Analysis/
Functions/ , MATLAB, 17 linesGenMatCode-main/ Statistics/ demo_hartigans_isi.m - EEG Analysis/
Functions/ , MATLAB, 10 linesGenMatCode-main/ Statistics/ fanofactor.m - EEG Analysis/
Functions/ , MATLAB, 25 linesGenMatCode-main/ Statistics/ fanofactor_ex.m - EEG Analysis/
Functions/ , MATLAB, 180 linesGenMatCode-main/ Statistics/ fdr_bh.m - EEG Analysis/
Functions/ , MATLAB, 237 linesGenMatCode-main/ Statistics/ fdr_bky.m - EEG Analysis/
Functions/ , MATLAB, 409 linesGenMatCode-main/ Statistics/ fexact.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Statistics/ fishertest.m - EEG Analysis/
Functions/ , MATLAB, 77 linesGenMatCode-main/ Statistics/ forest.m - EEG Analysis/
Functions/ , MATLAB, 37 linesGenMatCode-main/ Statistics/ gretna_FDR.m - EEG Analysis/
Functions/ , MATLAB, 22 linesGenMatCode-main/ Statistics/ gretna_fishertrans.m - EEG Analysis/
Functions/ , MATLAB, 351 linesGenMatCode-main/ Statistics/ mackskill.m - EEG Analysis/
Functions/ , MATLAB, 425 linesGenMatCode-main/ Statistics/ mafdr1.m - EEG Analysis/
Functions/ , MATLAB, 66 linesGenMatCode-main/ Statistics/ multFDR.m - EEG Analysis/
Functions/ , MATLAB, 237 linesGenMatCode-main/ Statistics/ myBinomTest.m - EEG Analysis/
Functions/ , MATLAB, 306 linesGenMatCode-main/ Statistics/ mybarnard.m - EEG Analysis/
Functions/ , MATLAB, 62 linesGenMatCode-main/ Statistics/ prop_test.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Statistics/ regress_Lu.m - EEG Analysis/
Functions/ , MATLAB, 20 linesGenMatCode-main/ Statistics/ regress_wei.m - EEG Analysis/
Functions/ , MATLAB, 40 linesGenMatCode-main/ Statistics/ ttest2_cov.m - EEG Analysis/
Functions/ , MATLAB, 21 linesMapFields1to2.m - EEG Analysis/
Functions/ , MATLAB, 39 linesSubfun/ RateHist_LME1.m - EEG Analysis/
Functions/ , MATLAB, 4 linesappendingfiles_SM.m - EEG Analysis/
Functions/ , MATLAB, 40 linescalculateWPLI.m - EEG Analysis/
Functions/ , MATLAB, 30 linesfooof_mat-main/ examples/ fooof_example_multi_spec tra.m - EEG Analysis/
Functions/ , MATLAB, 27 linesfooof_mat-main/ examples/ fooof_example_one_spectr um.m - EEG Analysis/
Functions/ , MATLAB, 27 linesfooof_mat-main/ examples/ fooof_example_plot_model .m - EEG Analysis/
Functions/ , MATLAB, 84 linesfooof_mat-main/ fooof_mat/ fooof.m - EEG Analysis/
Functions/ , MATLAB, 46 linesfooof_mat-main/ fooof_mat/ fooof_check_settings.m - EEG Analysis/
Functions/ , MATLAB, 27 linesfooof_mat-main/ fooof_mat/ fooof_get_model.m - EEG Analysis/
Functions/ , MATLAB, 45 linesfooof_mat-main/ fooof_mat/ fooof_group.m - EEG Analysis/
Functions/ , MATLAB, 61 linesfooof_mat-main/ fooof_mat/ fooof_plot.m - EEG Analysis/
Functions/ , MATLAB, 44 linesfooof_mat-main/ fooof_mat/ fooof_unpack_results.m - EEG Analysis/
Functions/ , MATLAB, 23 linesfooof_mat-main/ fooof_mat/ fooof_version.m - EEG Analysis/
Functions/ , MATLAB, 9 linesgetMaxFrequency.m - EEG Analysis/
Functions/ , MATLAB, 9 linesgetNewestFile.m - EEG Analysis/
Functions/ , MATLAB, 9 linesgetNewestFolder.m - EEG Analysis/
Functions/ , MATLAB, 13 linesmergingEEGSets.m - EEG Analysis/
Functions/ , MATLAB, 56 linesplotSubsetChPSD.m - EEG Analysis/
Functions/ , MATLAB, 48 linesplotfooof.m - EEG Analysis/
Functions/ , MATLAB, 339 linessync_EEG_to_attention_ba ckup.m - EEG Analysis/
S0_ConvertBDFtoSet_and_P , MATLAB, 862 lines, 1 matchreprocess_for_Syncing.m - EEG Analysis/
S1_Sync_EEGSet_to_Attent , MATLAB, 426 linesionCsv.m - EEG Analysis/
S2_LoadEEG_CheckSync.m , MATLAB, 414 lines - EEG Analysis/
S3_CompletePreprocessing , MATLAB, 862 lines, 1 match.m - EEG Analysis/
S4_ALLSubjects_NoCut_NoN , MATLAB, 4,365 lines, 5 matchesotch_2_100hz.m - EEG Analysis/
Subfun/ , MATLAB, 39 linesRateHist_LME1.m - README.md, Text, 18 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 868 scripts, each with its path and the digest of its content;
- 13 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- doi:10.18112/
openneuro.ds006222.v1.0. , at OpenNeuro; found in “Data and Code Availability”0
Data and Code Availability
Data from this study is available on OpenNeuro https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 4 authors, 6 keywords, 5 funders, 60 references.
Cite
This paper
Attokaren, M. K., Zhang, L., Mettupalli, S., & Singer, A. C. (2026). 40 Hz audiovisual stimulation improves sustained attention and related brain oscillations. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1229. https://
BibTeX
@article{attokaren202640
author = {Attokaren, Matthew K. and Zhang, Lu and Mettupalli, Sindhura and Singer, Annabelle C.},
title = {{40 Hz audiovisual stimulation improves sustained attention and related brain oscillations}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = may,
volume = {4},
pages = {IMAG.a.1229},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/
url = {https://
pmid = {42146314},
pmcid = {PMC13175507}
}
RIS
TY - JOUR
AU - Attokaren, Matthew K.
AU - Zhang, Lu
AU - Mettupalli, Sindhura
AU - Singer, Annabelle C.
TI - 40 Hz audiovisual stimulation improves sustained attention and related brain oscillations
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/
VL - 4
SP - IMAG.a.1229
SN - 2837-6056
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "40 Hz audiovisual stimulation improves sustained attention and related brain oscillations",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Attokaren",
"given": "Matthew K."
},
{
"family": "Zhang",
"given": "Lu"
},
{
"family": "Mettupalli",
"given": "Sindhura"
},
{
"family": "Singer",
"given": "Annabelle C."
}
],
"container-title-short":
"volume": "4",
"page": "IMAG.a.1229",
"DOI": "10.1162/
"PMID": "42146314",
"PMCID": "PMC13175507",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
13
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41598-026-49900-6 [code]
- Global neural oscillations underlie performance variability and attentional state fluctuations in humans.Journal: Scientific reportsIn common: ERPLAB, Chronux, Wavelet Toolbox, 7 other tools, 1 reference
- [2] doi:10.1038/s41593-026-02357-2 [code]
- Experience reorganizes content-specific memory traces in macaques.Journal: Nature neuroscienceIn common: Chronux, fdr_bh (Benjamini-Hochberg FDR), CircStat, 11 other tools
- [3] doi:10.64898/2026.03.12.710517 [code]
- Cortical excitability inversely modulates fMRI connectivity via low-frequency neuronal couplingJournal: bioRxiv (preprint)In common: ERPLAB, Chronux, CircStat, 10 other tools, 1 reference
- [4] doi:10.1038/s41467-026-71151-2 [code]
- Common and distinct neural correlates of social interaction processing and theory of mind in narratives.Journal: Nature communicationsIn common: Violinplot-Matlab, fdr_bh (Benjamini-Hochberg FDR), FieldTrip, 10 other tools
- [5] doi:10.1038/s41467-026-75347-4 [code]
- Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.Journal: Nature communicationsIn common: Chronux, CircStat, EEGLAB, 9 other tools
- [6] doi:10.1016/j.celrep.2026.117646 [code]
- Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.Journal: Cell reportsIn common: Chronux, CircStat, EEGLAB, 9 other tools
- [7] doi:10.1038/s41467-026-73106-z [code]
- Respiratory pauses highlight sleep architecture in mice.Journal: Nature communicationsIn common: Chronux, CircStat, EEGLAB, 8 other tools, EEG
- [8] doi:10.1016/j.neuron.2026.03.034 [code]
- Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.Journal: NeuronIn common: Chronux, CircStat, EEGLAB, 9 other tools
- [9] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: Violinplot-Matlab, fdr_bh (Benjamini-Hochberg FDR), FieldTrip, 8 other tools
- [10] doi:10.1002/hbm.70577 [code]
- Disgust Propensity, Not Disgust Sensitivity, Shapes the Reactivity of a Subjective Disgust Circuit in Humans.Journal: Human brain mappingIn common: Violinplot-Matlab, fdr_bh (Benjamini-Hochberg FDR), FieldTrip, 8 other tools
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 868 scripts, and 13 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:377478ab58e8336a…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
