[Eeglablist] Increase running speed
m za
ma.zamani.20 at gmail.com
Wed Jan 8 02:17:17 PST 2025
Hello,
I want to obtain connectivity using MATLAB eeglab codes and the problem I
had was that I was getting model order error, and with the help of the
guidance I found in this link (
https://sccn.ucsd.edu/pipermail/eeglablist/2018/013225.html), my problem
was solved. And the problem I have now is that it takes a long time to run
for a subject, it took a day and it's still running, and I want to know if
you have any suggestions or solutions to help me increase my running speed?
And whether the code I'm using is correct or needs changes?
Thank you in advance for any help you can provide.
Marjan
%myfilename1=['E:\FinalCode\Thises\eeglaboutput\dir\dir_sub',num2str(q),'.set'];
%EEG=load(myfilename1,'-mat');
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
EEG=pop_chanedit(EEG, 'setref',{'1:19','A1,A2'},'eval','chans =
pop_chancenter( chans, [],[]);');
EEG = pop_resample(EEG,250);
%EEG = pop_epoch( EEG, { 'square' }, [0 5], 'epochinfo', 'yes')
% prepare data
EEG = pop_pre_prepData(EEG, 'nogui', 'SignalType',{'Channels'},
'NormalizeData', {'Method' {'time' 'ensemble'} }, 'verb', 1);
%Remove Baseline
EEG = pop_rmbase(EEG,1:19);
% Model Order
EEG.CAT.configs.est_selModelOrder = arg_tovals( arg_report( 'rich',
@est_selModelOrder));
EEG.CAT.configs.est_selModelOrder.modelingApproach.winlen =5;
EEG = pop_est_selModelOrder(EEG, 'nogui', 'verb', 1,'prctWinToSample', 100);
%EEG = pop_est_selModelOrder(EEG,
'nogui','ModelingApproach','SegmentationVAR','Algorithm',
'Vieira-Morf','WindowLength', 0.5, 'WindowStepSize',
0.032,'TaperFunction','rectwin','NormalizeData','True','DetrendingMethod','constant','ModelOrderRange',[1
30],'InformationCriteria',{'sbc' 'aic' 'fpe' 'hq'}, 'verb', 1);
% fit AR model
EEG = pop_est_fitMVAR(EEG, 'nogui', 'Algorithm', 'Vieira-Morf', 'ModelOrder',
30, 'WindowLength', 5, 'WindowStepSize', 0.032, 'verb', 1);
%Validate Model
%EEG = pop_est_validateMVAR(EEG,'nogui','whitenessCriteria',{'Ljung-Box'
'ACF' 'Box-Pierce'
'Li-McLeod'},'CheckResidualsWhiteness','True','SignificanceLevel',0.05,'CheckConsistency','True','CheckStability','True',
'verb', 1);
EEG.CAT.configs.est_selModelOrder.CheckResidualsWhiteness='True';
EEG = pop_est_validateMVAR(EEG,'nogui', 'verb', 1);
% Compute connectivity
EEG = pop_est_mvarConnectivity(EEG, 'nogui', 'ConnectivityMeasures', {'dDTF'
'GPDC' 'GGC'}, 'freqs', 0.5:45, 'verb', 1);
% Compute surrogate
%EEG.CAT.configs.est_selModelOrder.Mode={'PhaseRand'};
EEG.CAT.configs.est_selModelOrder.NumPermutaions= 200;
%EEG =
pop_stat_surrogateGen(EEG,'nogui','ModelingApproach','SegmentationVAR','NormalizeData','True','Mode',{'PhaseRand'},'NumPermutaions'
, 200 , 'verb', 1);
%EEG = pop_stat_surrogateGen(EEG,'nogui','verb', 1);
EEG = pop_stat_surrogateGen(EEG,'nogui','Mode',{'PhaseRand'},'verb', 1);
EEG.CAT.configs.est_selModelOrder.StatisticalTest='Hnull';
EEG.CAT.configs.est_selModelOrder.MultipleComparisonCorrection='fdr';
%EEG =
pop_stat_surrogateStats(EEG,'nogui','StatisticalTest','Hnull','MultipleComparisonCorrection','fdr',
'verb', 1);
EEG = pop_stat_surrogateStats(EEG,'nogui','verb', 1);
%pop_vis_TimeFreqGrid(EEG);
%vis_TimeFreqGrid('EEG', EEG(1), 'Conn', EEG(1).CAT.Conn, 'MatrixLayout',
...
%{'Partial', 'UpperTriangle', 'dDTF' 'LowerTriangle', 'dDTF' 'Diagonal'
'None' 'AllColorLimits' 99.9 }, ...
%'baseline', [-1 -0.25], 'Thresholding', {'Simple', 'PercentileThreshold',
[97.5 3]});
More information about the eeglablist
mailing list