Skip to content

Commit

Permalink
update model review plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Bach committed Dec 10, 2024
1 parent b1b5e8c commit 93f44bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 75 deletions.
16 changes: 12 additions & 4 deletions src/pspm_extract_segments.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,18 @@
set(p(2), 'Color', color);
set(p(3), 'Color', color);

legend_lb{(c-1)*3 + 1} = [names{c} ' AVG'];
legend_lb{(c-1)*3 + 2} = [names{c} ' SEM+'];
legend_lb{(c-1)*3 + 3} = [names{c} ' SEM-'];
legend_lb{(c-1)*3 + 1} = [names{c} ' condition mean'];
legend_lb{(c-1)*3 + 2} = [names{c} ' mean+SEM'];
legend_lb{(c-1)*3 + 3} = [names{c} ' mean-SEM'];

f.lg = legend('String', legend_lb, 'Interpreter', 'none', 'Location', 'best');
legend boxoff

set(ax, 'FontSize', 12, 'FontWeight', 'Bold');
set(get(ax, 'xlabel'), 'String', 'Time (seconds)', 'FontSize', 15, 'FontWeight', 'Bold');
set(get(ax, 'ylabel'), 'String', 'Mean Response (data units)', 'FontSize', 15, 'FontWeight', 'Bold');
set(get(ax, 'title'), 'String', 'Mean Responses for All Segments', 'FontSize', 18, 'FontWeight', 'Bold');

end
end

Expand Down Expand Up @@ -360,7 +369,6 @@
if options.plot
% show plot
set(fg, 'Visible', 'on');
legend(legend_lb);
end

%% Return values
Expand Down
38 changes: 1 addition & 37 deletions src/pspm_rev_dcm.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,45 +129,9 @@
fprintf('---------------------------------------\n');
case 'seg'

options = struct();
options = struct('plot', 1);
[ssts, segments] = pspm_extract_segments('model', dcm, options);

if ssts == -1
uiwait(msgbox('Error extracting segments from the model.', 'Error'))
else


sr = dcm.input.sr;
cmap = lines(numel(segments.segments));
f.h = figure;
f.a.h = axes(f.h);
hold on;

legendNames = cell(1, numel(segments.segments));

for x = 1:numel(segments.segments)

plotdata = segments.segments{x}.mean;
t = (1:length(plotdata)) / sr;
f.a.p = plot(f.a.h, t, plotdata, 'Color', cmap(x, :), 'LineWidth', 1);
legendNames{x} = segments.segments{x}.name;

end

f.a.l = legend(legendNames, 'Interpreter', 'none', 'Location', 'best');
legend boxoff

set(get(f.a.h, 'xlabel'), 'String', 'Time (seconds)');
set(get(f.a.h, 'ylabel'), 'String', 'Mean Response (data units)');
set(get(f.a.h, 'title'), 'String', 'Mean Responses for All Segments');

hold off;
end





end;

sts = 1;
Expand Down
36 changes: 2 additions & 34 deletions src/pspm_rev_glm.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,41 +230,9 @@
set(fig(5).title, 'String', sprintf('Estimated responses per condition: %s', filename), 'FontWeight', 'Bold', 'FontSize', 14, 'Interpreter', 'none');
case 6

options = struct();
options = struct('plot', 1);
[ssts, segments] = pspm_extract_segments('model', glm, options);
if ssts == -1
uiwait(msgbox('Error extracting segments from the model.', 'Error'))
else
sr = glm.input.sr;
cmap = lines(numel(segments.segments));
f.h = figure;
f.a.h = axes(f.h);
hold on;

legendNames = cell(1, numel(segments.segments));

for x = 1:numel(segments.segments)

plotdata = segments.segments{x}.mean;
t = (1:length(plotdata)) / sr;
f.a.p = plot(f.a.h, t, plotdata, 'Color', cmap(x, :), 'LineWidth', 1);
legendNames{x} = segments.segments{x}.name;

end

f.a.l = legend(legendNames, 'Interpreter', 'none', 'Location', 'best');
legend boxoff

set(get(f.a.h, 'xlabel'), 'String', 'Time (seconds)');
set(get(f.a.h, 'ylabel'), 'String', 'Mean Response (data units)');
set(get(f.a.h, 'title'), 'String', 'Mean Responses for All Segments');

hold off;
end



end
end
end
end
sts = 1;
Expand Down

0 comments on commit 93f44bf

Please sign in to comment.