Skip to content

Commit

Permalink
minor fixes and updates for 2014b
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian authored and Ian committed Oct 16, 2014
1 parent f99e454 commit e12089e
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion opticka.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

properties (SetAccess = protected, GetAccess = public)
%> version number
optickaVersion@char = '1.002'
optickaVersion@char = '1.100'
%> history of display objects
history
%> is this a remote instance?
Expand Down
18 changes: 9 additions & 9 deletions optickatest.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
%% Initial clear up of previous runs
% Make sure we start in a clean environment, not essential
clear myStim myTask myScreen rExp
sca
sca %PTB screen clear all

%% Stimulus Initialisation
% These set up the 10 different stimuli. Please note that values are in
Expand Down Expand Up @@ -145,25 +145,25 @@
% blending etc. hideFlash uses a trick from Mario to set the CLUT to the
% task background colour so you don't see the black flash on PTB screen
% initialisation.
myScreen = screenManager('distance', 57.3,...
'pixelsPerCm', 44,...
myScreen = screenManager('distance', 57.3,... %display distance from observer
'pixelsPerCm', 44,... %calibration value for screen size/pixel density
'blend', true,... %enable OpenGL blending, you can also set blend modes when needed
'windowed', 0,... %set to a widthxheight for debugging i.e. [800 600]; set to 0 for fullscreen
'antiAlias', 0,... %can be set to 4 or 8x oversampling with no dropped frames on OS X ATI 5870
'bitDepth', '8bit',... %try 8bit, FloatingPoint16bit FloatingPoint32bit
'logFrames', 'true',... %every screen flip is logged for full missed frame accounting.
'benchmark', 'false',... %when true flip as fast as possible, turn logFrames off to work
'hideFlash', true); %mario's gamma trick
'hideFlash', false); %mario's gamma trick

%% Setup runExperiment Object
% We now pass our stimulus screen and sequence objects to the
% runExperiment class. runExperinet contains the run class that actually
% runs the task.
rExp = runExperiment('stimuli', myStim,...
'task', myTask,...
'screen', myScreen,...
'debug', false,...
'verbose', false);
rExp = runExperiment('stimuli', myStim,... %stimulus objects
'task', myTask,... %task design object
'screen', myScreen,... %screen manager object
'debug', false,... %debug mode is off
'verbose', false); %minimal verbosity

%%
% run our experiment, to exit early, press the right (OS X) or middle (Win/Linux) mouse
Expand Down
5 changes: 4 additions & 1 deletion screenManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
end
if ~exist('debug','var')
debug = obj.debug;
if ~isempty(obj.windowed) && length(obj.windowed)==2 %override for windowed stimuli!
debug = true;
end
end
if ~exist('tL','var')
tL = struct;
Expand Down Expand Up @@ -251,7 +254,7 @@
%override VTOTAL?
%Screen('Preference', 'VBLEndlineOverride', 1066);

if debug == true || (length(obj.windowed)==1 && obj.windowed ~= 0)
if debug == true || length(obj.windowed)==2 || (length(obj.windowed)==1 && obj.windowed ~= 0)
Screen('Preference', 'SkipSyncTests', 2);
Screen('Preference', 'VisualDebugLevel', 0);
Screen('Preference', 'Verbosity', 2);
Expand Down
5 changes: 3 additions & 2 deletions stimuli/baseStimulus.m
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,15 @@ function run(obj,benchmark,runtime,s)
end
if ~exist('s','var') || ~isa(s,'screenManager')
s = screenManager('verbose',false,'blend',true,'screen',0,...
'bitDepth','8bit','debug',false,...
'bitDepth','8bit','debug',true,...
'backgroundColour',[0.5 0.5 0.5 0]); %use a temporary screenManager object
end
oldwindowed = s.windowed;
if benchmark
s.windowed = [];
else
s.windowed = [0 0 s.screenVals.width/2 s.screenVals.height/2];
wR = Screen('Rect',1);
s.windowed = [wR(3)/2 wR(4)/2];
%s.windowed = CenterRect([0 0 s.screenVals.width/2 s.screenVals.height/2], s.winRect); %middle of screen
end
open(s); %open PTB screen
Expand Down
22 changes: 11 additions & 11 deletions stimuli/dotsStimulus.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
%> type of dot (integer, where 0 means filled square, 1
%> means filled circle, and 2 means filled circle with high-quality
%> anti-aliasing)
dotType = 1
dotType = 2
%> whether to use a circular mask or not
mask = true
mask = false
%> colour of the mask, empty sets mask colour to = background of screen
maskColour = []
%> smooth the alpha edge of the mask by this number of pixels, 0 is
Expand Down Expand Up @@ -219,15 +219,15 @@ function update(obj)
function draw(obj)
if obj.isVisible && obj.tick >= obj.delayTicks && obj.tick < obj.offTicks
try
if obj.mask == true
Screen('BlendFunction', obj.sM.win, obj.msrcMode, obj.mdstMode);
Screen('DrawDots', obj.sM.win,obj.xy,obj.dotSizeOut,obj.colours,...
[obj.xOut obj.yOut],obj.dotTypeOut);
Screen('DrawTexture', obj.sM.win, obj.maskTexture, [], obj.maskRect, [], [], [], [], obj.shader);
Screen('BlendFunction', obj.sM.win, obj.sM.srcMode, obj.sM.dstMode);
else
Screen('DrawDots',obj.sM.win,obj.xy,obj.dotSizeOut,obj.colours,[obj.xOut obj.yOut],obj.dotTypeOut);
end
if obj.mask == true
Screen('BlendFunction', obj.sM.win, obj.msrcMode, obj.mdstMode);
Screen('DrawDots', obj.sM.win,obj.xy,obj.dotSizeOut,obj.colours,...
[obj.xOut obj.yOut],obj.dotTypeOut);
Screen('DrawTexture', obj.sM.win, obj.maskTexture, [], obj.maskRect, [], [], [], [], obj.shader);
Screen('BlendFunction', obj.sM.win, obj.sM.srcMode, obj.sM.dstMode);
else
Screen('DrawDots',obj.sM.win,obj.xy,obj.dotSizeOut,obj.colours,[obj.xOut obj.yOut],obj.dotTypeOut);
end
catch ME
ple(ME)
end
Expand Down
2 changes: 1 addition & 1 deletion stimuli/metaStimulus.m
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function runSingle(obj,s,eL,runtime)
end
if ~exist('s','var') || ~isa(s,'screenManager')
s = screenManager('verbose',false,'blend',true,'screen',0,...
'bitDepth','8bit','debug',false,...
'bitDepth','8bit','debug',true,...
'backgroundColour',[0.5 0.5 0.5 0]); %use a temporary screenManager object
end
if ~exist('runtime','var') || isempty(runtime)
Expand Down
Binary file modified ui/opticka_ui.fig
Binary file not shown.
5 changes: 4 additions & 1 deletion ui/opticka_ui.m
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,11 @@ function OKMenuDots_Callback(hObject, eventdata, handles)
set(handles.OKPanelStimulusText,'String','Loading Stimulus Panel...'); drawnow

if ~isfield(o.store,'dotsStimulus')
o.store.dotsStimulus=dotsStimulus('name','Coherent Dots Stimulus');
o.store.dotsStimulus=dotsStimulus('name', 'Coherent Dots Stimulus',...
'speed', 2,'mask',false);
end
o.store.dotsStimulus.speed = 2;
o.store.dotsStimulus.mask = false;
o.store.visibleStimulus = o.store.dotsStimulus;
o.store.visibleStimulus.makePanel(handles.OKPanelStimulus);
set(handles.OKAddStimulus,'Enable','on');
Expand Down

0 comments on commit e12089e

Please sign in to comment.