Using the Library
An example
The Library Handlers
The handlers available in this library assist with designing and running Eyelink experiments. These are the Handlers:
open_data_file ( fileName , preambleText )
add_file_preamble_text ( theText )
set_calibration_type ( calType )
recordAndEchoTrialID ( TrialID , trialVariables )
display_status_message ( TrialID )
drawText ( xyPoint , colorInt , theText )
set_saccade_velocity_threshold ( theValue )
set_saccade_acceleration_threshold ( theValue )
set_file_event_filter ( theValue )
set_link_event_filter ( theValue )
set_link_sample_data ( theValue )
initialize eyelink [dummy open boolean] -- whether to open the Eyelink library in dummy mode (default is false).
send eyelink command string -- the command string to send
send eyelink message string -- the command string to send
do tracker setup
do drift correct
[at point] -- where the fixation is (default is centre of the screen).
[drawing boolean] -- whether to draw the drift stimulus (default is false).
start eyelink recording
[file samples boolean] -- whether to record file samples (default is false).
[file events boolean] -- whether to record file events (default is false).
[link samples boolean] -- whether to record link samples (default is false).
[link events boolean] -- whether to record link events (default is false).
stop eyelink recording
set eyelink offline
eyelink replay
OK. A complete experiment might look like
initialize eyelink
do tracker setup
do drift correct at {0,0} without drawing
start eyelink recording with file samples file events without link samples link events
do trial " 'look around the screen please'"stop eyelink recording
set eyelink offline
eyelink replay
-- >> Cmd strings
property cmd_open_data_file
: " open_data_file "
-- >> Filter and threshold properties
property defSaccadeVelThreshold
: 35
property defSaccadeAccThreshold
: 9500
property defFileEventFilter
: " LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON
"
property defLinkEventFilter
: " LEFT, RIGHT, FIXATION, BUTTON "
property defLinkSampleData
: " LEFT, RIGHT, GAZE, AREA "
-- > In-trial command strings
property pGazeOnInTrial
: " !ic(link_event_filter = LEFT,RIGHT,FIXUPDATE) !ic(fixation_update_interval
= 50) !ic(fixation_update_accumulate = 50) "
property pGazeOffInTrial
: " !ic(link_event_filter = LEFT,RIGHT,FIXATION) !ic(fixation_update_interval
= 0) !ic(fixation_update_accumulate = 0) "
-- >> Experiment properties: drift stimulus, link boolean
property pDriftStimulusName
: ""
property pLinkPresent
: false -- boolean
property pBlack : 0
property p1 : 1
property p2Int : 2
property p3Int : 3
property p4Int : 4
property p5Int : 5
property p6Int : 6
property pMedGray : 7
property p8Int : 8
property p9Int : 9
property p10Int : 10
property pI11nt : 11
property pIn12t : 12
property p13Int : 13
property p14Int : 14
property pWhite : 15
-- property pDefaultFiltersThresholds : {saccadeVelocityThreshold:defSaccadeVelThreshold,
saccadeAccelerationThreshold:defSaccadeAccThreshold, fileEventFilter:defFileEventFilter,
linkEventFilter:defLinkEventFilter, linkSampleData:defLinkSampleData}
to initLinkAndSetup (
calType , bLinked , DriftStimulusName
, screenParameters , fileHelper
, screen )
tell screen to setDistanceScreenXAndScreenY ( screenParameters ) -- physical propertiesend initLinkAndSetup
set pLinkPresent to bLinked
set pDriftStimulusName to DriftStimulusName
tell application " PsyScript "load permanent stimulus pDriftStimulusName as masked picture stimulus -- load tracking stimulusend tell
if pLinkPresent then -- setup Eyetracking Stuffset oldSpace to ( noticed of key space )else
set noticed of key space to true
do trial " !w(200 200) To check the cameras press the enter key. !t(0) "
do trial " !w(200 230) \"C\" for calibration. !t(0) "
do trial " !w(200 260) When done, press \"O\" to run the experiment.
!t(0) "
do trial " !w(200 290) Press SPACE BAR to begin. ''(0) !t "
set noticed of key space to oldSpace
initialize eyelink
my initDisplayCoordinates ()
my set_calibration_type ( calType )
my setFixationUpdatesOFF ()
do tracker setupdo trial " 'dummy stimulus' "end if
initialize eyelink with dummy open
tell application " PsyScript "end checkLinkif pLinkPresent thenend tellif not ( eyelink connected ) thenend iferror " link lost "end if
if ( count of fileName ) > 8 thenend open_data_fileerror " filename " & fileName & " too long " & return & " (must be 8 characters or less) "elsemy close_data_file ()end if
tell application " PsyScript " to send eyelink command " open_data_file " & fileName
my add_file_preamble_text ( preambleText )
tell application " PsyScript " to send eyelink command " close_data_file "end close_data_file
tell application " PsyScript " to send eyelink command " add_file_preamble_text ' " & theText & " ' "end add_file_preamble_text
tell application " PsyScript "end initDisplayCoordinatesset { l , t , r , b } to { 0 , 0 } & screen sizeend tell
send eyelink command " screen_pixel_coordinates = " & l & " " & t & " " & r & " " & b
send eyelink message " DISPLAY_COORDS " & l & " " & t & " " & r & " " & b
tell application " PsyScript " to send eyelink command " calibration_type = " & calTypeend set_calibration_type
(* if eyelink connected then *)end recordAndEchoTrialID
tell application " PsyScript "send eyelink message " TRIALID " & TrialID & " " & trialVariablesend tell
send eyelink command " record_status_message = TRIALID= " & TrialID & " " & trialVariables
-- you should set the trialid before calling this.end doDriftCorrect
tell application " PsyScript "-- tryend tell
if pDriftStimulusName is "" then -- not using a specific graphicset trialString to " + ?1 !w(10 10) push space when fixating ''(0) "else if (( every permanent stimulus whose name is pDriftStimulusName ) is not {}) thenif ( type of ( every permanent stimulus whose name is pDriftStimulusName ) is masked picture stimulus ) then -- masked needs old and new poselse -- not a permanent stimulusset trialString to " ë?1(0)(0) !w(10 10) push space when fixating ''(0) "else -- plain stimulusset trialString to " ë?1(0) !w(10 10) push space when fixating ''(0) "end ifset trialString to " @?1(0) !w(10 10) push space when fixating ''(0) "end if
-- set theResult to 27
-- repeat while theResult is 27 --escape pressed (calibration invoked). Repeat the drift correction
do trial trialString given { pDriftStimulusName }
if pLinkPresent then do drift correct without drawing -- how does this workl???
-- set theResult to do drift correct --without drawing --how does this workl???
-- do trial "!e !t(0)"
-- end repeat
-- end try
tell application " PsyScript " to send eyelink command " record_status_message = TRIAL " & TrialIDend display_status_message
tell application " PsyScript "end drawTextif ( class of xyPoint is list or class of xyPoint is record ) thenend tellset xyPoint to xyPoint as listelse
set textMsg to item 1 of xyPoint & " " & item 2 of xyPoint & colorInt & " ' " & theText & " ' "set textMsg to xyPoint & colorInt & " ' " & theText & " ' "end if
trysend eyelink command " draw_text " & textMsg -- e.g. draw_text 100 100 1 'hi there'on error errMsg number errNumerror errMsg & " from draw text " number errNumend try
tell application " PsyScript " (* SET UP TRACKER CONFIGURATION *)end setDefaults(* set parser (conservative saccade thresholds) *)end tell
send eyelink command " recording_parse_type = GAZE "
send eyelink command " saccade_velocity_threshold = 35 "
send eyelink command " saccade_acceleration_threshold = 9500 "
(* set EDF file contents *)
send eyelink command " file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON "
(* set link data (used for gaze cursor) *)
send eyelink command " link_event_filter = LEFT,RIGHT,FIXATION,BUTTON "
send eyelink command " link_sample_data = LEFT,RIGHT,GAZE,AREA "
tell application " PsyScript "end setParserToCognitivesend eyelink command " recording_parse_type = GAZE "end tell
send eyelink command " saccade_velocity_threshold = 30 "
send eyelink command " saccade_acceleration_threshold = 9500 "
send eyelink command " saccade_motion_threshold = 0.15 "
send eyelink command " saccade_pursuit_fixup = 60 "
send eyelink command " fixation_update_interval = 0 "
tell application " PsyScript "end setParserToPursuitOrNeurologysend eyelink command " recording_parse_type = GAZE "end tell
send eyelink command " saccade_velocity_threshold = 22 "
send eyelink command " saccade_acceleration_threshold = 5000 "
send eyelink command " saccade_motion_threshold = 0.0 "
send eyelink command " saccade_pursuit_fixup = 60 "
send eyelink command " fixation_update_interval = 0 "
tell application " PsyScript " (* SET UP TRACKER CONFIGURATION *)end setFilterList(* set parser (conservative saccade thresholds) *)end tell
send eyelink command " saccade_velocity_threshold = " & SVT -- default = 35
send eyelink command " saccade_acceleration_threshold = " & SAT -- default = 9500
(* set EDF file contents *)
send eyelink command " file_event_filter = " & FEF -- default = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON
(* set link data (used for gaze cursor) *)
send eyelink command " link_event_filter = " & LEF -- defaults = LEFT,RIGHT,FIXATION,BUTTON"
send eyelink command " link_sample_data = " & LSD -- defaults = LEFT,RIGHT,GAZE,AREA"
-- message these parameters?
tell application " PsyScript " (* SET UP TRACKER CONFIGURATION *)end setFixationUpdatesONsend eyelink command " link_event_filter = LEFT,RIGHT,FIXUPDATE "end tell
send eyelink command " fixation_update_interval = 50 "
send eyelink command " fixation_update_accumulate = 50 "
tell application " PsyScript " (* SET UP TRACKER CONFIGURATION *)end setFixationUpdatesOFFsend eyelink command " link_event_filter = LEFT,RIGHT,FIXATION "end tell
send eyelink command " fixation_update_interval = 0 "
send eyelink command " fixation_update_accumulate = 0 "
tell application " PsyScript " to send eyelink command " saccade_velocity_threshold = " & theValue -- default =35end set_saccade_velocity_threshold
tell application " PsyScript " to send eyelink command " saccade_acceleration_threshold = " & theValue -- default = 9500end set_saccade_acceleration_threshold
tell application " PsyScript " to send eyelink command " file_event_filter = " & theValue -- LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTONend set_file_event_filter
tell application " PsyScript " to send eyelink command " link_event_filter = " & theValue -- LEFT,RIGHT,FIXATION,BUTTONend set_link_event_filter
tell application " PsyScript " to send eyelink command " link_sample_data = LEFT,RIGHT,GAZE,AREA "end set_link_sample_data
| MACCS | |
Documentation | Downloads | FAQ | Mailing List | Last change: echo date( "F d Y.", getlastmod() ); ?> |
| Advanced Search |