Skip to content

Commit

Permalink
Bugfix: process box count of PSDs when a search is active
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Cousineau committed Nov 26, 2020
1 parent 0f6ad98 commit 8a965c6
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions toolbox/tree/tree_dependencies.m
Expand Up @@ -203,12 +203,15 @@
[sStudy, tmp_, iFoundTf] = bst_get('TimefreqForFile', nodeFileNames{iNode}, iStudy);
if ~isempty(iFoundTf) && ~isempty(sStudy.Timefreq(iFoundTf))
TimefreqFiles = {sStudy.Timefreq(iFoundTf).FileName};
TimefreqComments = {sStudy.Timefreq(iFoundTf).Comment};
TimefreqComments = {sStudy.Timefreq(iFoundTf).Comment};
TimefreqTypes = {'timefreq', 'spectrum'};
isSpectrum = cellfun(@(c)~isempty(strfind(c, '_psd')), TimefreqFiles);
TimefreqTypes = TimefreqTypes(1 + isSpectrum);
% The files that were found
if ~isempty(iFoundTf)
% === Check file filters ===
if ~isempty(NodelistOptions)
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, targetNodeType));
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, TimefreqTypes));
end
iDepStudies = [iDepStudies, repmat(iStudy, size(iFoundTf))];
iDepItems = [iDepItems iFoundTf];
Expand Down Expand Up @@ -293,11 +296,14 @@
[tmp_, tmp_, iFoundTf] = bst_get('TimefreqForFile', sStudy.Data(iData).FileName, iStudy);
TimefreqFiles = {sStudy.Timefreq(iFoundTf).FileName};
TimefreqComments = {sStudy.Timefreq(iFoundTf).Comment};
TimefreqTypes = {'timefreq', 'spectrum'};
isSpectrum = cellfun(@(c)~isempty(strfind(c, '_psd')), TimefreqFiles);
TimefreqTypes = TimefreqTypes(1 + isSpectrum);
% The files that were found
if ~isempty(iFoundTf)
% === Check file filters ===
if ~isempty(NodelistOptions)
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, targetNodeType));
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, TimefreqTypes));
end
iDepStudies = [iDepStudies, repmat(iStudy, size(iFoundTf))];
iDepItems = [iDepItems iFoundTf];
Expand Down Expand Up @@ -355,11 +361,14 @@
if ~isempty(iFoundTf) && ~isempty(sStudy.Timefreq(iFoundTf))
TimefreqFiles = {sStudy.Timefreq(iFoundTf).FileName};
TimefreqComments = {sStudy.Timefreq(iFoundTf).Comment};
TimefreqTypes = {'timefreq', 'spectrum'};
isSpectrum = cellfun(@(c)~isempty(strfind(c, '_psd')), TimefreqFiles);
TimefreqTypes = TimefreqTypes(1 + isSpectrum);
% The files that were found
if ~isempty(iFoundTf)
% === Check file filters ===
if ~isempty(NodelistOptions)
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, targetNodeType));
iFoundTf = iFoundTf(isFileSelected(TimefreqFiles, TimefreqComments, NodelistOptions, TimefreqTypes));
end
iDepStudies = [iDepStudies, repmat(iStudy, size(iFoundTf))];
iDepItems = [iDepItems iFoundTf];
Expand Down Expand Up @@ -389,7 +398,7 @@
% Get file
if strcmpi(targetNodeType, 'timefreq')
% Check search options
if ~isempty(NodelistOptions) && ~isFileSelected(nodeFileNames{iNode}, nodeComments{iNode}, NodelistOptions, targetNodeType)
if ~isempty(NodelistOptions) && ~isFileSelected(nodeFileNames{iNode}, nodeComments{iNode}, NodelistOptions, lower(nodeTypes{iNode}))
continue;
end
iDepStudies = [iDepStudies nodeStudies(iNode)];
Expand Down Expand Up @@ -583,7 +592,10 @@
if ~isempty(NodelistOptions)
PossibleFiles = {sStudies(i).Timefreq.FileName};
PossibleComments = {sStudies(i).Timefreq.Comment};
iFoundTf = find(isFileSelected(PossibleFiles, PossibleComments, NodelistOptions, targetNodeType));
TimefreqTypes = {'timefreq', 'spectrum'};
isSpectrum = cellfun(@(c)~isempty(strfind(c, '_psd')), PossibleFiles);
TimefreqTypes = TimefreqTypes(1 + isSpectrum);
iFoundTf = find(isFileSelected(PossibleFiles, PossibleComments, NodelistOptions, TimefreqTypes));
else
iFoundTf = 1:length(sStudies(i).Timefreq);
end
Expand Down

0 comments on commit 8a965c6

Please sign in to comment.