Psychtoolbox

From Cheaha
Revision as of 18:29, 6 November 2014 by Demet@uab.edu (talk | contribs) (Created page with "==Learn to use psychtoolbox== '''Official tutorial''' : [http://psychtoolbox.org/wikka.php?wakka=PsychtoolboxTutorial http://psychtoolbox.org/wikka.php?wakka=PsychtoolboxTuto...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Attention: Research Computing Documentation has Moved
https://docs.rc.uab.edu/


Please use the new documentation url https://docs.rc.uab.edu/ for all Research Computing documentation needs.


As a result of this move, we have deprecated use of this wiki for documentation. We are providing read-only access to the content to facilitate migration of bookmarks and to serve as an historical record. All content updates should be made at the new documentation site. The original wiki will not receive further updates.

Thank you,

The Research Computing Team

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)