Skip to content

Commit 4347a32

Browse files
committed
prepare for radial motion
1 parent 84a1f8e commit 4347a32

File tree

5 files changed

+39
-16
lines changed

5 files changed

+39
-16
lines changed

initEnv.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function addDependencies()
8888
pth = fileparts(mfilename('fullpath'));
8989
addpath(fullfile(pth, 'lib', 'CPP_BIDS', 'src'));
9090
addpath(fullfile(pth, 'lib', 'CPP_PTB'));
91+
addpath(genpath(fullfile(pth, 'lib', 'CPP_PTB', 'src')));
9192
addpath(fullfile(pth, 'subfun'));
9293

9394
end

lib/CPP_BIDS

setParameters.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,25 @@
3434

3535
%% Experiment Design
3636

37+
% cfg.design.motionType = 'translation';
38+
% cfg.design.motionType = 'radial';
39+
cfg.design.motionType = 'translation';
3740
cfg.design.names = {'static'; 'motion'};
3841
cfg.design.nbRepetitions = 4;
3942
cfg.design.nbEventsPerBlock = 12; % DO NOT CHANGE
4043

4144
%% Timing
4245

4346
% Time between blocs in secs
44-
cfg.IBI = .5; % 8;
47+
cfg.IBI = .1; % 8;
4548
% Time between events in secs
46-
cfg.ISI = 0.5;
49+
cfg.ISI = 0.1;
4750
% Number of seconds before the motion stimuli are presented
4851
cfg.onsetDelay = .1;
4952
% Number of seconds after the end all the stimuli before ending the run
5053
cfg.endDelay = .1;
5154

52-
cfg.eventDuration = 1; % second
55+
cfg.eventDuration = 3; % second
5356

5457
%% Visual Stimulation
5558

@@ -68,7 +71,7 @@
6871
cfg.dot.color = cfg.color.white;
6972

7073
% Diameter/length of side of aperture in Visual angles
71-
cfg.aperture.type = 'circle';
74+
cfg.aperture.type = 'none';
7275
cfg.aperture.width = []; % if left empty it will take the screen height
7376
cfg.aperture.xPos = 0;
7477

subfun/expDesign.m

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
% The conditions are consecutive static and motion blocks
55
% (Gives better results than randomised).
66
%
7+
% Style guide: constants are in SNAKE_UPPER_CASE
8+
%
79
% EVENTS
810
% The numEventsPerBlock should be a multiple of the number of "base"
911
% listed in the MOTION_DIRECTIONS and STATIC_DIRECTIONS (4 at the moment).
@@ -55,6 +57,8 @@
5557

5658
% Set variables here for a dummy test of this function
5759
if nargin < 1 || isempty(cfg)
60+
% cfg.design.motionType = 'translation';
61+
cfg.design.motionType = 'radial';
5862
cfg.design.names = {'static'; 'motion'};
5963
cfg.design.nbRepetitions = 4;
6064
cfg.design.nbEventsPerBlock = 12;
@@ -64,7 +68,7 @@
6468
end
6569

6670
[NB_BLOCKS, NB_REPETITIONS, NB_EVENTS_PER_BLOCK, MAX_TARGET_PER_BLOCK] = getInput(cfg);
67-
[~, STATIC_INDEX, motionIndex] = assignConditions(cfg);
71+
[~, STATIC_INDEX, MOTION_INDEX] = assignConditions(cfg);
6872

6973
RANGE_TARGETS = [1 MAX_TARGET_PER_BLOCK];
7074
targetPerCondition = repmat(RANGE_TARGETS, 1, NB_REPETITIONS / 2);
@@ -137,10 +141,7 @@
137141

138142
function cfg = setDirections(cfg)
139143

140-
% CONSTANTS
141-
% Set directions for static and motion condition
142-
MOTION_DIRECTIONS = [0 90 180 270];
143-
STATIC_DIRECTIONS = [-1 -1 -1 -1];
144+
[MOTION_DIRECTIONS, STATIC_DIRECTIONS] = getDirectionBaseVectors(cfg);
144145

145146
[NB_BLOCKS, NB_REPETITIONS, NB_EVENTS_PER_BLOCK] = getInput(cfg);
146147

@@ -182,6 +183,23 @@
182183

183184
end
184185

186+
function [MOTION_DIRECTIONS, STATIC_DIRECTIONS] = getDirectionBaseVectors(cfg)
187+
188+
% CONSTANTS
189+
% Set directions for static and motion condition
190+
191+
STATIC_DIRECTIONS = [-1 -1 -1 -1];
192+
193+
switch cfg.design.motionType
194+
case 'translation'
195+
MOTION_DIRECTIONS = [0 90 180 270];
196+
case 'radial'
197+
STATIC_DIRECTIONS = [666 -666 666 -666];
198+
MOTION_DIRECTIONS = [666 -666 666 -666];
199+
end
200+
201+
end
202+
185203
function [nbBlocks, nbRepet, nbEventsBlock, maxTargBlock] = getInput(cfg)
186204
nbRepet = cfg.design.nbRepetitions;
187205
nbEventsBlock = cfg.design.nbEventsPerBlock;
@@ -253,18 +271,19 @@ function diplayDesign(cfg, displayFigs)
253271
title('Fixation Targets position distribution');
254272

255273
figure(2);
274+
275+
[motionDirections] = getDirectionBaseVectors(cfg);
276+
motionDirections = unique(motionDirections);
256277

257-
MOTION_DIRECTIONS = [0 90 180 270];
258-
259-
for iMotion = 1:length(MOTION_DIRECTIONS)
278+
for iMotion = 1:length(motionDirections)
260279

261-
[~, position] = find(directions == MOTION_DIRECTIONS(iMotion));
280+
[~, position] = find(directions == motionDirections(iMotion));
262281

263282
subplot(2, 2, iMotion);
264283
hist(position);
265284
scaleAxes();
266285
labelAxesFreq();
267-
title(num2str(MOTION_DIRECTIONS(iMotion)));
286+
title(num2str(motionDirections(iMotion)));
268287

269288
end
270289

0 commit comments

Comments
 (0)