Skip to content

Commit

Permalink
Merge pull request #50 from nguyen-td/feature
Browse files Browse the repository at this point in the history
bugfix in snippet analysis
  • Loading branch information
nguyen-td authored Jul 5, 2023
2 parents abf639a + 10b48f3 commit 522d849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pop_roi_connect.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
end

% compute connectivity over snippets
n_conn_metrics = length(options{2}); % number of connectivity metrics
n_conn_metrics = length(g.methods); % number of connectivity metrics
conn_matrices_snips = {};
if strcmpi(g.snippet, 'on') && isempty(intersect(g.methods, {'PAC'})) && strcmpi(g.conn_stats, 'off')

Expand All @@ -250,15 +250,15 @@
EEG.roi.source_roi_data = single(roi_snip);
EEG = roi_connect(EEG, 'morder', g.morder, 'naccu', g.naccu, 'methods', g.methods,'freqresolution', g.freqresolution, 'roi_selection', g.roi_selection); % compute connectivity over one snippet
for fc = 1:n_conn_metrics
fc_name = options{2}{fc};
fc_name = g.methods{fc};
fc_matrix = EEG.roi.(fc_name);
conn_matrices_snips{isnip,fc} = fc_matrix; % store each connectivity metric for each snippet in separate structure
end
end

% compute mean over connectivity of each snippet
for fc = 1:n_conn_metrics
fc_name = options{2}{fc};
fc_name = g.methods{fc};
[first_dim, second_dim, third_dim] = size(conn_matrices_snips{1,fc});

conn_cell = conn_matrices_snips(:,fc); % store all matrices of one metric in a cell
Expand Down
3 changes: 2 additions & 1 deletion test_pipes/test_snippets_connectivity.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
EEG = pop_roi_activity(EEG, 'leadfield',EEG.dipfit.sourcemodel,'model','LCMV','modelparams',{0.05},'atlas','LORETA-Talairach-BAs','nPCA',3);

% snippet analysis, individual snippets are stored
EEG = pop_roi_connect(EEG, 'methods', { 'MIM' }, 'snippet', 'on', 'snip_length', 20, 'fcsave_format', 'all_snips');
% EEG = pop_roi_connect(EEG, 'methods', { 'MIM' }, 'snippet', 'on', 'snip_length', 20, 'fcsave_format', 'all_snips');
EEG = pop_roi_connect(EEG, 'morder',20,'naccu',[],'methods', {'CS', 'MIM'}, 'roi_selection', {}, 'snippet', 'on', 'snip_length', 20, 'fcsave_format', 'all_snips');
disp(size(EEG.roi.MIM)) % n_snips, frequency, roi, roi

0 comments on commit 522d849

Please sign in to comment.