Home > other >  Stroop psychopy psychology experiment development problems for help.
Stroop psychopy psychology experiment development problems for help.

Time:09-20


I want justice, inside the subjects reaction stage, the subjects by the left key to return to again preparation cycle, right click the participants can make the program to the next stage trial1, should how to set up, trouble you!
Software psychopy generated code related script as follows (only justice part is not preach) :
 # -- -- -- -- -- -- -- Run the Routine "justice" -- -- -- -- -- -- -- 
While continueRoutine:
# get the current time
T=justiceClock. GetTime ()
TThisFlip=win. GetFutureFlipTime (clock=justiceClock)
TThisFlipGlobal=win. GetFutureFlipTime (clock=None)
FrameN=frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame

Choose # * * updates
If choose the status==NOT_STARTED and tThisFlip & gt;=0.0 frameTolerance:
# keep track of the start time/frame for later
Choose. FrameNStart=# frameN exact frame index
Choose. TStart=t # local t and not account for SCR refresh
Choose. TStartRefresh=tThisFlipGlobal # on global time
Win. TimeOnFlip (choose, 'tStartRefresh') # time at next SCR refresh
Choose. SetAutoDraw (True)

Updates key_resp_6 # * *
WaitOnFlip=False
If key_resp_6. Status==NOT_STARTED and tThisFlip & gt;=0.0 frameTolerance:
# keep track of the start time/frame for later
Key_resp_6. FrameNStart=# frameN exact frame index
Key_resp_6. TStart=t # local t and not account for SCR refresh
Key_resp_6. TStartRefresh=tThisFlipGlobal # on global time
Win. TimeOnFlip (key_resp_6, 'tStartRefresh') # time at next SCR refresh
Key_resp_6. Status=STARTED
# the rid_device_info_keyboard checking is just starting
WaitOnFlip=True
Win. CallOnFlip (key_resp_6. Clock. Reset) # t=0 on the next screen flip
Win. CallOnFlip (key_resp_6 clearEvents, eventType='the rid_device_info_keyboard') # clear events on the next screen flip
If key_resp_6. Status==STARTED and not waitOnFlip:
TheseKeys=key_resp_6. GetKeys (keyList=[' left ', 'right'], waitRelease=False)
_key_resp_6_allKeys. The extend (theseKeys)
If len (_key_resp_6_allKeys) :
Key_resp_6. Keys=_key_resp_6_allKeys [1]. The name # just the last key pressed
Key_resp_6. Rt=_key_resp_6_allKeys [1]. Rt
# a response ends the routine
ContinueRoutine=False

# check for the quit (typically the Esc key)
If endExpNow or defaultKeyboard. GetKeys (keyList=[" escape "]) :
The core. The quit ()

# check if all the components have finished
If not continueRoutine: # a component has requested a forced - the end of the Routine
Break
ContinueRoutine=False # will revert to True if the at further one component, the running
For thisComponent justiceComponents in:
If hasattr (thisComponent, "status") and thisComponent. Status!=FINISHED:
ContinueRoutine=True
Break # at further one component has not yet finished

# refresh the screen
If continueRoutine: # don 't flip the if this routine is over or we' l l get a blank screen
Win. Flip ()

# -- -- -- -- -- -- -- Ending Routine "justice" -- -- -- -- -- -- --
For thisComponent justiceComponents in:
If hasattr (thisComponent, "setAutoDraw") :
ThisComponent. SetAutoDraw (False)
ThisExp. AddData (' choose. Started, choose tStartRefresh)
ThisExp. AddData (' choose. Stopped, choose tStopRefresh)
# the Routine "justice" was not non - slip safe, so the reset the non - slip timer
RoutineTimer. Reset ()

# set up handler to look after randomisation of the conditions etc
Loop1=data. TrialHandler (nReps=2, method='random',
ExtraInfo=expInfo, originPath=1,
TrialList=data. ImportConditions (' trial1. XLSX),
Seed=None, name='loop1')
ThisExp. AddLoop (loop1) # add the loop to experiment
ThisLoop1=loop1. TrialList [0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. RGB=thisLoop1. RGB)
If thisLoop1!=None:
For paramName thisLoop1 in:
The exec (' {}=thisLoop1 [paramName] '. The format (paramName))

For thisLoop1 loop1 in:
CurrentLoop=loop1
# abbreviate parameter names if possible (e.g. RGB=thisLoop1. RGB)
If thisLoop1!=None:
For paramName thisLoop1 in:
The exec (' {}=thisLoop1 [paramName] '. The format (paramName))

# -- -- -- -- -- - Prepare to start the Routine "trial1" -- -- -- -- -- -- --
ContinueRoutine=True
# update component parameters for each repeat
Character1. SetColor (color, the colorSpace='RGB')
Character1. SetText (characters)
Key_resp. Keys=[]
Key_resp. Rt=[]
_key_resp_allKeys=[]
# keep track of which components have finished
Trial1Components=[preparation1, character1 key_resp]
For thisComponent trial1Components in:
ThisComponent. TStart=None
ThisComponent. TStop=None
ThisComponent. TStartRefresh=None
ThisComponent. TStopRefresh=None
If hasattr (thisComponent, 'status') :
ThisComponent. Status=NOT_STARTED
# reset timers
T=0
_timeToFirstFrame=win. GetFutureFlipTime (clock="now")
nullnullnull
  • Related