Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CALProjectImageSet: Make portable to non-Windows, minor robustness im… #3

Merged
merged 1 commit into from Mar 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 19 additions & 16 deletions src/CALProjectImageSet.m
Expand Up @@ -26,6 +26,20 @@

obj.blank_image = uint8(zeros(obj.image_set_obj.image_params_used.image_height,...
obj.image_set_obj.image_params_used.image_width));

try
ver_str = PsychtoolboxVersion;
catch
error('Pyschtoolbox is not installed or is improperly installed');
end

if str2num(ver_str(1)) < 3
error('Pyschtoolbox version 3 is required. The installed version is %s.',ver_str);
end

AssertOpenGL; % Assure Screen() visual stimulation is working.
KbName ('UnifyKeyNames'); % Use same key names on all operating systems.

if nargin == 3
obj.monitor_id = varargin{1};
else
Expand All @@ -39,17 +53,6 @@
obj.blank_when_paused = 1;
end


try
ver_str = PsychtoolboxVersion;
catch
error('Pyschtoolbox is not installed or is improperly installed');
end

if str2num(ver_str(1)) < 3
error('Pyschtoolbox version 3 is required. The installed version is %s.',ver_str);
end

sca % clear possible third screen window == screen('CloseAll')
close all

Expand Down Expand Up @@ -83,7 +86,7 @@

if wait_to_start
fprintf('\n\n---------Press spacebar to start image projection--------\n\n');
obj.pauseUntilKey(32); % 32 is spacebar
obj.pauseUntilKey(KbName('space')); % 32 is spacebar
fprintf('\nStarted...\n');
end

Expand All @@ -104,17 +107,17 @@


pressed_key = obj.checkKey();
if pressed_key == 9 % if pressed key is tab, pause until spacebar is pressed again
if pressed_key == KbName('tab') % if pressed key is tab, pause until spacebar is pressed again
obj.printPaused(i,toc(global_time));
if obj.blank_when_paused
obj.flipBlankImage();
end
pressed_key = obj.pauseUntilKey([32,27]);
if pressed_key == 32
pressed_key = obj.pauseUntilKey([KbName('space'), KbName('ESCAPE')]);
if pressed_key == KbName('space')
obj.printResumed();
end
end
if pressed_key == 27 % if pressed key is esc, exit loop
if pressed_key == KbName('ESCAPE') % if pressed key is esc, exit loop
total_run_time = toc(global_time);
obj.printStopped(i,total_run_time);
run_flag = 0;
Expand Down