Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ For instructions see the following links:
| [CPP_BIDS](https://github.com/cpp-lln-lab/CPP_BIDS) | ? |
| [CPP_PTB](https://github.com/cpp-lln-lab/CPP_PTB) | ? |
| [PsychToolBox](http://psychtoolbox.org/) | >=3.0.14 |
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2017 |
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2017 |
| or [octave](https://www.gnu.org/software/octave/) | >=4.? |

## Installation

git clone --recurse-submodules https://github.com/Remi-Gau/repo_with_submod.git
cd repo_with_submod/
git submodule update --remote
The CPP_BIDS and CPP_PTB dependencies are already set up as submodule to this repository.
You can install it all with git by doing.

```bash
git clone --recurse-submodules https://github.com/cpp-lln-lab/localizer_visual_motion.git
```

## Structure and function details

Expand Down
2 changes: 1 addition & 1 deletion lib/CPP_PTB
8 changes: 4 additions & 4 deletions setParameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
% Coherence Level (0-1)
cfg.dot.coherence = 1;
% nb dots per visual angle square.
cfg.dot.density = .25;
cfg.dot.density = .25;

% Dot life time in seconds
cfg.dot.lifeTime = 10;

Expand All @@ -70,7 +70,7 @@
% Diameter/length of side of aperture in Visual angles
cfg.aperture.type = 'circle';
cfg.aperture.width = []; % if left empty it will take the screen height
cfg.aperture.xPos = -30;
cfg.aperture.xPos = 0;

%% Task(s)

Expand All @@ -85,7 +85,7 @@
cfg.fixation.color = cfg.color.white;
cfg.fixation.width = 1;
cfg.fixation.lineWidthPix = 2;
cfg.fixation.xDisplacement = 30;
cfg.fixation.xDisplacement = 0;
cfg.fixation.yDisplacement = 0;

cfg.target.maxNbPerBlock = 2;
Expand Down
48 changes: 24 additions & 24 deletions subfun/doDotMo.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,66 @@
% The dots are drawn on a square with a width equals to the width of the
% screen
% We then draw an aperture on top to hide the certain dots.

%% Get parameters

dots = initializeDots(cfg, thisEvent);

% Set for how many frames this event will last
framesLeft = floor(cfg.eventDuration / cfg.screen.ifi);

%% Start the dots presentation
vbl = Screen('Flip', cfg.screen.win);
onset = vbl;

while framesLeft

[dots] = updateDots(dots, cfg);

%% Center the dots
% We assumed that zero is at the top left, but we want it to be
% in the center, so shift the dots up and left, which just means
% adding half of the screen width in pixel to both the x and y direction.
thisEvent.dot.positions = (dots.positions - cfg.screen.winWidth / 2)';

%% make textures
dotTexture('make', cfg, thisEvent);

apertureTexture('make', cfg, thisEvent);

%% draw evetything and flip screen

dotTexture('draw', cfg, thisEvent);

apertureTexture('draw', cfg, thisEvent);

% If this frame shows a target we change the color
thisFixation.fixation = cfg.fixation;
thisFixation.screen = cfg.screen;
if thisEvent.target(1) && GetSecs < (onset + cfg.target.duration)
thisFixation.fixation.color = cfg.fixation.colorTarget;
end
drawFixation(thisFixation);

Screen('DrawingFinished', cfg.screen.win);

vbl = Screen('Flip', cfg.screen.win, vbl + cfg.screen.ifi);

%% Update counters

% Check for end of loop
framesLeft = framesLeft - 1;

end

%% Erase last dots

drawFixation(cfg);

Screen('DrawingFinished', cfg.screen.win);

vbl = Screen('Flip', cfg.screen.win, vbl + cfg.screen.ifi);

duration = vbl - onset;

end
2 changes: 1 addition & 1 deletion subfun/expDesign.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
% Set directions for static and motion condition
motionDirections = [0 90 180 270];
staticDirections = [0 90 180 270];
% staticDirections = [-1 -1 -1 -1];
% staticDirections = [-1 -1 -1 -1];

%% Check inputs

Expand Down
18 changes: 9 additions & 9 deletions visualLocTanslational.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
% Convert some values from degrees to pixels
cfg.dot = degToPix('size', cfg.dot, cfg);
cfg.dot = degToPix('speed', cfg.dot, cfg);

% Get dot speeds in pixels per frame
cfg.dot.speedPixPerFrame = cfg.dot.speedPix / cfg.screen.monitorRefresh;

cfg.aperture = degToPix('xPos', cfg.aperture, cfg);

% dots are displayed on a square with a length in visual angle equal to the
% field of view
cfg.dot.number = round(cfg.dot.density * (cfg.screen.winWidth / cfg.screen.ppd)^2);
Expand All @@ -55,15 +55,15 @@
% Prepare for the output logfiles with all
logFile.extraColumns = cfg.extraColumns;
logFile = saveEventsFile('open', cfg, logFile);

% prepare textures
cfg = apertureTexture('init', cfg);
cfg = dotTexture('init', cfg);

disp(cfg);

standByScreen(cfg);

% prepare the KbQueue to collect responses
getResponse('init', cfg.keyboard.responseBox, cfg);
getResponse('start', cfg.keyboard.responseBox);
Expand Down Expand Up @@ -148,7 +148,7 @@
WaitSecs(cfg.endDelay);

cfg = getExperimentEnd(cfg);

% Close the logfiles
saveEventsFile('close', cfg, logFile);

Expand All @@ -166,7 +166,7 @@
else
save(matFile, '-v7.3');
end

farewellScreen(cfg);

cleanUp();
Expand Down