Hello everyone
I’m posting on the forum to ask for help because I’m new and I haven’t mastered the tool yet, but mainly because I’ve been stuck on a problem for 2 weeks.
My problem: in my experiment, subjects see rdk and have to point in the direction they think is the right one. However, in 2 out of 3 cases they can (if they want to) see the rdk again to refine their decision.
My experiment works very well, however, after reading several articles (Okazawa et al., 2018; Kiani et al., 2008) I realized that in cases where participants see the stim again, keeping the same coherence and direction is not enough. I need exactly the same rdk with the dots at the same position in every frame (whether informative or noise).
To achieve this, I tried to create a dictionary for which each frame number would be linked to the list of x y coordinates of each point for that frame. I could then reuse this dictionary to determine the position of each point at each frame, in the event that the person wanted to review the stim. However, I don’t know if there’s anything simpler, and don’t know either in which variables the positions of the points are contained and how to reintroduce them afterwards…
# --- Prepare to start Routine "rdk_task" ---
continueRoutine = True
routineForceEnded = False
# update component parameters for each repeat
dots_rdk_task.setDir(direction_dots_rdk_task)
dots_rdk_task.setFieldCoherence(coherence_level_rdk_task)
# keep track of which components have finished
rdk_taskComponents = [dots_rdk_task]
for thisComponent in rdk_taskComponents:
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")
frameN = -1
# --- Run Routine "rdk_task" ---
while continueRoutine and routineTimer.getTime() < 1.0:
# get current time
t = routineTimer.getTime()
tThisFlip = win.getFutureFlipTime(clock=routineTimer)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *dots_rdk_task* updates
if dots_rdk_task.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
dots_rdk_task.frameNStart = frameN # exact frame index
dots_rdk_task.tStart = t # local t and not account for scr refresh
dots_rdk_task.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(dots_rdk_task, 'tStartRefresh') # time at next scr refresh
# add timestamp to datafile
thisExp.timestampOnFlip(win, 'dots_rdk_task.started')
dots_rdk_task.setAutoDraw(True)
if dots_rdk_task.status == STARTED:
# is it time to stop? (based on global clock, using actual start)
if tThisFlipGlobal > dots_rdk_task.tStartRefresh + 1-frameTolerance:
# keep track of stop time/frame for later
dots_rdk_task.tStop = t # not accounting for scr refresh
dots_rdk_task.frameNStop = frameN # exact frame index
# add timestamp to datafile
thisExp.timestampOnFlip(win, 'dots_rdk_task.stopped')
dots_rdk_task.setAutoDraw(False)
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
routineForceEnded = True
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in rdk_taskComponents:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
I also tried to look at the source code but I must admit I just got lost.
I’d be happy to receive any advice, hints or solutions.
Thank you very much in advance.