Hello,
In script, I have a for loop for each subject as follows:
I split continuous recording into same length epochs. When I create those epochs, I cut off beginning and end to not include filter oscillations at the edges. Now, I have epochs and I want to compute PSD and connectivity metrics from them.
Whats the right way to write timewindow input for it to be general for each epoch? In one example (PLV) below timewindow is [ ], and in the other, that's generated by BS itself (correlation), there is timespan of first epoch, but I wonder if it is general for each epoch if it is in for loop. And, if I set timewindow [ ], won't it include the edges that I cut off from the continuous file?
Thank you for response.
for iSubject = 1:length(SubjectNames)
subject_folder_name = SubjectNames{iSubject};
current_file = sFiles{iSubject}
% Process: Import MEG/EEG: Time
sEpochs = bst_process('CallProcess', 'process_import_data_time', sFiles{iSubject}, [], ...
'subjectname', SubjectNames{iSubject}, ...
'condition', '', ...
'timewindow', [8, 288], ...
'split', 40, ...
'ignoreshort', 0, ...
'usectfcomp', 1, ...
'usessp', 1, ...
'freq', [], ...
'baseline', [0, 299.998], ...
'blsensortypes', '');
% Process: Uniform epoch time
sEpochsUniform = bst_process('CallProcess', 'process_stdtime', sEpochs, [], ...
'method', 'spline', ... % spline
'overwrite', 1);
sEpochsUniform = [sEpochs(1), sEpochsUniform];
%process PLV
sPLVfiles = bst_process('CallProcess', 'process_plv1n', sEpochsUniform, [], ...
'timewindow', [], ...
'dest_sensors', 'EEG', ...
'includebad', 1, ...
'plvmethod', 'plv', ... % Phase locking value
'plvmeasure', 2, ... % Magnitude
'tfmeasure', 'hilbert', ... % Hilbert transform
'tfedit', struct(...
'Comment', 'Complex', ...
'TimeBands', [], ...
'Freqs', {{'delta', '0.5, 4', 'mean'; 'theta', '4, 8', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '12, 30', 'mean'; 'gamma1', '30, 50', 'mean'; 'gamma2', '50, 70', 'mean'; 'gamma3', '70, 90', 'mean'}}, ...
'ClusterFuncTime', 'none', ...
'Measure', 'none', ...
'Output', 'all', ...
'SaveKernel', 0), ...
'timeres', 'none', ... % None
'avgwinlength', 1, ...
'avgwinoverlap', 50, ...
'outputmode', 'input'); % separately for each file
% Process: Correlation NxN
scorrFiles = bst_process('CallProcess', 'process_corr1n', sEpochsUniform, [], ...
'timewindow', [8, 47.998], ...
'dest_sensors', 'EEG', ...
'includebad', 1, ...
'timeres', 'none', ... % None
'avgwinlength', 1, ...
'avgwinoverlap', 50, ...
'scalarprod', 0, ...
'outputmode', 'input'); % separately for each file