Skip to content

Commit abc9014

Browse files
authored
Merge pull request #93 from Remi-Gau/remi-test_utils
add test utils and version file
2 parents cf1d8d2 + f262c29 commit abc9014

File tree

9 files changed

+34
-15
lines changed

9 files changed

+34
-15
lines changed

src/aperture/apertureTexture.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
% Draw aperture and we rotate to match the required condition
120120
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture, ...
121121
cfg.screen.winRect, ...
122-
CenterRect(...
122+
CenterRect( ...
123123
cfg.screen.winRect * cfg.magnify.scalingFactor, ...
124124
cfg.screen.winRect), ...
125125
thisEvent.condition - 90);
@@ -154,18 +154,18 @@
154154
cfg.ring.maxEcc = ...
155155
cfg.screen.FOV / 2 + ...
156156
cfg.aperture.width + ...
157-
log(cfg.screen.FOV / 2 + 1) ;
157+
log(cfg.screen.FOV / 2 + 1);
158158
% ring.CsFuncFact is used to expand with log increasing speed so
159159
% that ring is at ring.maxEcc at end of cycle
160160
cfg.ring.csFuncFact = ...
161161
1 / ...
162162
((cfg.ring.maxEcc + exp(1)) * ...
163163
log(cfg.ring.maxEcc + exp(1)) - ...
164-
(cfg.ring.maxEcc + exp(1))) ;
164+
(cfg.ring.maxEcc + exp(1)));
165165
end
166166

167167
case 'bar'
168-
168+
169169
extraPositons = 0;
170170
if cfg.magnify.do
171171
% we add some extra bar positions that we remove afterwards to
@@ -175,18 +175,18 @@
175175

176176
% Set parameters drifting bars
177177
cfg.aperture.barWidthPix = cfg.stimRect(3) / (cfg.volsPerCycle + extraPositons);
178-
178+
179179
barPosPix = ...
180180
[0:cfg.aperture.barWidthPix:cfg.stimRect(3) - cfg.aperture.barWidthPix] + ...
181181
(cfg.screen.winRect(3) / 2 - cfg.stimRect(3) / 2) + ...
182182
cfg.aperture.barWidthPix / 2; %#ok<NBRAK>
183-
183+
184184
% Those positions are removed because they are actually outside of
185185
% the screen when magnification (fit to windows width) is on
186186
if cfg.magnify.do
187-
barPosPix([1:6, end-5:end]) = [];
187+
barPosPix([1:6, end - 5:end]) = [];
188188
end
189-
189+
190190
cfg.aperture.barPosPix = barPosPix;
191191

192192
% Width of bar in degrees of VA (needed for saving)

src/checkPtbVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function checkPtbVersion()
2222
if any([ ...
2323
versionStruc.major < PTB.major, ...
2424
versionStruc.minor < PTB.minor, ...
25-
versionStruc.point < PTB.point, ...
25+
versionStruc.point < PTB.point ...
2626
])
2727

2828
str = sprintf('%s %i.%i.%i %s.\n%s', ...

src/degToPix.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
deg = getfield(structure, fieldName); %#ok<GFLD>
99

1010
structure = setfield(structure, [fieldName 'Pix'], ...
11-
floor(deg * cfg.screen.ppd)) ; %#ok<SFLD>
11+
floor(deg * cfg.screen.ppd)); %#ok<SFLD>
1212

1313
end

src/dot/reseedDots.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
dots.positions < 0, ...
2121
dots.time > dots.lifeTime, ...
2222
radius - cfg.dot.sizePix < fixationWidthPix / 2, ...
23-
rand(cfg.dot.number, 1) < cfg.dot.proportionKilledPerFrame, ...
24-
], 2) ;
23+
rand(cfg.dot.number, 1) < cfg.dot.proportionKilledPerFrame ...
24+
], 2);
2525

2626
% If there is any such dot we relocate it to a new random position
2727
% and change its lifetime to 1

src/printCreditsCppPtb.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
function printCreditsCppPtb()
22

3-
version = '0.0.1';
3+
try
4+
version = fileread(fullfile(fileparts(mfilename('fullpath')), ...
5+
'..', '..', 'version.txt'));
6+
catch
7+
version = 'v1.0.0';
8+
end
49

510
contributors = { ...
611
'Rémi Gau', ...

src/waitForTrigger.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function waitForTrigger(varargin)
4343

4444
if strcmp(KbName(keyCode), cfg.mri.triggerKey)
4545

46-
triggerCounter = triggerCounter + 1 ;
46+
triggerCounter = triggerCounter + 1;
4747

4848
msg = sprintf(' Trigger %i', triggerCounter);
4949

tests/test_reseedDots.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function test_reseedDotsBasic()
3434

3535
dots.time = [ ...
3636
6; ... OK
37-
4 ; ... OK
37+
4; ... OK
3838
56; ... OK
3939
300; ... % exceeded its life time
4040
50]; % OK

tests/test_utils.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function test_suite = test_utils %#ok<*STOUT>
2+
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
3+
test_functions = localfunctions(); %#ok<*NASGU>
4+
catch % no problem; early Matlab versions can use initTestSuite fine
5+
end
6+
initTestSuite;
7+
end
8+
9+
function test_utilsBasic()
10+
11+
printCreditsCppPtb();
12+
13+
end

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.0.0

0 commit comments

Comments
 (0)