Psychtoolbox

From UABgrid Documentation
Jump to: navigation, search

Learn to use psychtoolbox

Official tutorial : http://psychtoolbox.org/wikka.php?wakka=PsychtoolboxTutorial

Playing with the screen example : http://ureca.recherche.univ-lille3.fr/uploads/File/chauvin/html/psychToolbox.html

TTLRead.m

After the fMRI pulse signal is input to the fORP via fiber optic cable, it is converted to a TTL pulse and output via BNC. Using USB1208FS, the TTL pulse is converted to readable numbers in PsychToolbox. The below function reads these TTL pulses using PTB Daq functions. Please read comments to make adjustments.

function TTLRead(n)
% TTLRead(n)
% TTLRead(number of TTL pulses to read)
% This function reads TTL pulses from fMRI and sends them to PyscToolbox
% using USB1208FS.
if nargin == 0
    n = 1;
end
if ~exist('daqID','var') % tests whether device is open or not
    daqID = DaqDeviceIndex; % grab first device
end
i = 0;
tic;
oldDlines=DaqDIn(daqID);
while i ~= n
    WaitSecs(0.050); % delay between each read (default = 0.050)
    Dlines = DaqDIn(daqID); % read the port
    if Dlines(1) ~= oldDlines(1); % determines if there is a change
        i = i + 1;
        oldDlines = Dlines;
    end
end
toc;
disp '...stimulus now presenting...'


RTBox('fake', 1)

It is possible to run functions/scripts which use RTBox to operate without actually having RTBox plugged into the MBP. This code should be entered into the command window before running the function/script. 'clear all' to end the 'fake' setup.

RTBox(’fake’, 1)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox