Skip to content

Commit ac6fc16

Browse files
committed
MH autolint
1 parent 26de68f commit ac6fc16

File tree

9 files changed

+91
-94
lines changed

9 files changed

+91
-94
lines changed

apertureTexture.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function cfg = apertureTexture(action, cfg, thisEvent)
2-
2+
33
transparent = [0 0 0 0];
4-
4+
55
switch action
6-
6+
77
case 'init'
8-
8+
99
% we take the screen height as maximum aperture width if not
1010
% specified.
1111
if ~isfield(cfg.aperture, 'width') || isempty(cfg.aperture.width)
@@ -15,15 +15,15 @@
1515

1616
cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ...
1717
cfg.color.background(1) * ones(cfg.screen.winRect([4 3])));
18-
18+
1919
case 'make'
20-
20+
2121
switch cfg.aperture.type
22-
22+
2323
case 'none'
24-
24+
2525
Screen('Fillrect', cfg.aperture.texture, transparent);
26-
26+
2727
case 'circle'
2828

2929
diameter = cfg.aperture.widthPix;
@@ -33,14 +33,14 @@
3333
cfg.screen.winRect(3) / 2, cfg.screen.winRect(4) / 2));
3434

3535
end
36-
36+
3737
case 'draw'
38-
38+
3939
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture);
40-
40+
4141
% Screen('DrawTexture', cfg.screen.win, apertureTexture, ...
4242
% cfg.screen.winRect, cfg.screen.winRect, current.apertureAngle - 90);
43-
43+
4444
end
4545

46-
end
46+
end

dotTexture.m

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
function cfg = dotTexture(action, cfg, thisEvent)
2-
2+
33
switch action
4-
4+
55
case 'init'
66
cfg.dot.texture = Screen('MakeTexture', cfg.screen.win, ...
77
cfg.color.background(1) * ones(cfg.screen.winRect([4 3])));
8-
8+
99
case 'make'
10-
10+
1111
Screen('FillRect', cfg.dot.texture, cfg.color.background);
1212
Screen('DrawDots', cfg.dot.texture, ...
1313
thisEvent.dot.positions, ...
1414
cfg.dot.sizePix, ...
1515
cfg.dot.color, ...
1616
cfg.screen.center, ...
1717
1);
18-
18+
1919
case 'draw'
20-
20+
2121
Screen('DrawTexture', cfg.screen.win, cfg.dot.texture);
22-
23-
22+
2423
end
25-
26-
end
24+
25+
end

drawFixation.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ function drawFixation(cfg)
99
cfg.fixation.color, ...
1010
[cfg.screen.center(1) cfg.screen.center(2)], 1);
1111
end
12-
12+
1313
end

farewellScreen.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
function farewellScreen(cfg)
2-
2+
33
Screen('FillRect', cfg.screen.win, cfg.color.background, cfg.screen.winRect);
44
DrawFormattedText(cfg.screen.win, 'Thank you!', 'center', 'center', cfg.text.color);
55
Screen('Flip', cfg.screen.win);
66
WaitSecs(cfg.mri.repetitionTime * 2);
7-
8-
end
97

8+
end

getExperimentEnd.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
function cfg = getExperimentEnd(cfg)
2-
2+
33
drawFixation(cfg);
44
endExpmt = Screen('Flip', cfg.screen.win);
5-
5+
66
disp(' ');
77
ExpmtDur = endExpmt - cfg.experimentStart;
88
ExpmtDurMin = floor(ExpmtDur / 60);
@@ -11,5 +11,5 @@
1111
num2str(ExpmtDurMin), ' minutes ', ...
1212
num2str(ExpmtDurSec), ' seconds']);
1313
disp(' ');
14-
14+
1515
end

getExperimentStart.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
drawFixation(cfg);
44
vbl = Screen('Flip', cfg.screen.win);
55
cfg.experimentStart = vbl;
6-
end
6+
end

initPTB.m

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,158 +19,158 @@
1919
%
2020
%
2121
%
22-
22+
2323
checkPtbVersion();
24-
24+
2525
pth = fileparts(mfilename('fullpath'));
2626
addpath(fullfile(pth, 'subfun'));
27-
27+
2828
% For octave: to avoid displaying messenging one screen at a time
2929
more off;
30-
30+
3131
% check for OpenGL compatibility, abort otherwise:
3232
AssertOpenGL;
33-
33+
3434
cfg = setDefaultsPTB(cfg);
35-
35+
3636
initKeyboard;
3737
initDebug(cfg);
38-
38+
3939
% Mouse
4040
HideCursor;
41-
41+
4242
%% Audio
4343
cfg = initAudio(cfg);
44-
44+
4545
%% Visual
46-
46+
4747
% Get the screen numbers and draw to the external screen if avaliable
4848
cfg.screen.idx = max(Screen('Screens'));
49-
49+
5050
cfg = openWindow(cfg);
51-
51+
5252
% window size info
5353
[cfg.screen.winWidth, cfg.screen.winHeight] = WindowSize(cfg.screen.win);
54-
54+
5555
% Get the Center of the Screen
5656
cfg.screen.center = [cfg.screen.winRect(3), cfg.screen.winRect(4)] / 2;
57-
57+
5858
% Computes the number of pixels per degree given the distance to screen and
5959
% monitor width
6060
% This assumes that the window fills the whole screen
6161
cfg.screen.FOV = computeFOV(cfg);
6262
cfg.screen.ppd = cfg.screen.winRect(3) / cfg.screen.FOV;
63-
63+
6464
% Initialize visual parmaters for fixation cross or dot
6565
cfg = initFixation(cfg);
66-
66+
6767
%% Select specific text font, style and size
6868
initText(cfg);
69-
69+
7070
%% Timing
7171
% Query frame duration
7272
cfg.screen.ifi = Screen('GetFlipInterval', cfg.screen.win);
7373
cfg.screen.monitorRefresh = 1 / cfg.screen.ifi;
74-
74+
7575
% Set priority for script execution to realtime priority:
7676
Priority(MaxPriority(cfg.screen.win));
77-
77+
7878
%% Warm up some functions
7979
% Do dummy calls to GetSecs, WaitSecs, KbCheck to make sure
8080
% they are loaded and ready when we need them - without delays
8181
% in the wrong moment:
8282
KbCheck;
8383
WaitSecs(0.1);
8484
GetSecs;
85-
85+
8686
end
8787

8888
function initDebug(cfg)
89-
89+
9090
% init PTB with different options in concordance to the debug Parameters
9191
Screen('Preference', 'SkipSyncTests', 0);
9292
if cfg.debug.do
93-
93+
9494
Screen('Preference', 'SkipSyncTests', 2);
9595
Screen('Preference', 'Verbosity', 0);
9696
Screen('Preference', 'SuppressAllWarnings', 1);
97-
97+
9898
fprintf('\n\n\n\n');
9999
fprintf('########################################\n');
100100
fprintf('## DEBUG MODE. TIMING WILL BE OFF. ##\n');
101101
fprintf('########################################');
102102
fprintf('\n\n\n\n');
103-
103+
104104
testKeyboards(cfg);
105-
105+
106106
end
107-
107+
108108
if cfg.debug.transpWin
109109
PsychDebugWindowConfiguration;
110110
end
111-
111+
112112
end
113113

114114
function initKeyboard
115-
115+
116116
% Make sure keyboard mapping is the same on all supported operating systems
117117
% Apple MacOS/X, MS-Windows and GNU/Linux:
118118
KbName('UnifyKeyNames');
119-
119+
120120
% Don't echo keypresses to Matlab window
121121
ListenChar(-1);
122-
122+
123123
end
124124

125125
function cfg = initAudio(cfg)
126-
126+
127127
if cfg.audio.do
128-
128+
129129
InitializePsychSound(1);
130-
130+
131131
cfg.audio.devIdx = [];
132132
cfg.audio.playbackMode = 1;
133-
133+
134134
if isfield(cfg.audio, 'useDevice')
135-
135+
136136
% get audio device list
137137
audioDev = PsychPortAudio('GetDevices');
138-
138+
139139
% find output device to use
140140
idx = find( ...
141141
audioDev.NrInputChannels == cfg.audio.inputChannels && ...
142142
audioDev.NrOutputChannels == cfg.audio.channels && ...
143143
~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, cfg.audio.deviceName)));
144-
144+
145145
% save device ID
146146
cfg.audio.devIdx = audioDev(idx).DeviceIndex;
147-
147+
148148
% get device's sampling rate
149149
cfg.audio.fs = audioDev(idx).DefaultSampleRate;
150-
150+
151151
end
152-
152+
153153
cfg.audio.pahandle = PsychPortAudio('Open', ...
154154
cfg.audio.devIdx, ...
155155
cfg.audio.playbackMode, ...
156156
cfg.audio.requestedLatency, ...
157157
cfg.audio.fs, ...
158158
cfg.audio.channels);
159-
159+
160160
% set initial PTB volume for safety (participants can adjust this manually
161161
% at the begining of the experiment)
162162
PsychPortAudio('Volume', cfg.audio.pahandle, cfg.audio.initVolume);
163-
163+
164164
cfg.audio.pushSize = cfg.audio.fs * 0.010; % ! push N ms only
165-
165+
166166
cfg.audio.requestOffsetTime = 1; % offset 1 sec
167167
cfg.audio.reqsSampleOffset = cfg.audio.requestOffsetTime * cfg.audio.fs;
168-
168+
169169
end
170170
end
171171

172172
function cfg = openWindow(cfg)
173-
173+
174174
if cfg.debug.smallWin
175175
[cfg.screen.win, cfg.screen.winRect] = ...
176176
Screen('OpenWindow', cfg.screen.idx, cfg.color.background, ...
@@ -179,36 +179,35 @@ function initDebug(cfg)
179179
[cfg.screen.win, cfg.screen.winRect] = ...
180180
Screen('OpenWindow', cfg.screen.idx, cfg.color.background);
181181
end
182-
182+
183183
% Enable alpha-blending, set it to a blend equation useable for linear
184184
% superposition with alpha-weighted source.
185185
Screen('BlendFunction', cfg.screen.win, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
186-
186+
187187
end
188188

189189
function cfg = initFixation(cfg)
190-
190+
191191
if strcmp(cfg.fixation.type, 'cross')
192-
192+
193193
% Convert some values from degrees to pixels
194194
cfg.fixation = degToPix('width', cfg.fixation, cfg);
195-
195+
196196
% Prepare fixation cross
197197
cfg.fixation.xCoords = [-cfg.fixation.widthPix cfg.fixation.widthPix 0 0] + ...
198198
cfg.fixation.xDisplacement;
199199
cfg.fixation.yCoords = [0 0 -cfg.fixation.widthPix cfg.fixation.widthPix] + ...
200200
cfg.fixation.yDisplacement;
201201
cfg.fixation.allCoords = [cfg.fixation.xCoords; cfg.fixation.yCoords];
202-
202+
203203
end
204-
205-
204+
206205
end
207206

208207
function initText(cfg)
209-
208+
210209
Screen('TextFont', cfg.screen.win, cfg.text.font);
211210
Screen('TextSize', cfg.screen.win, cfg.text.size);
212211
Screen('TextStyle', cfg.screen.win, cfg.text.style);
213-
212+
214213
end

0 commit comments

Comments
 (0)