What are you trying to achieve?:
- Cursor dwell time within a certain ‘correct’ quadrant (four circles presented, one randomly chosen to turn red, signaled as target).
- Must be able to record time even if subject removes cursor from stimulus and re-enters - or doesn’t! Which brings up one of the issues I am trying to solve: ensuring that if the subject decides to stay within the stimulus, or out, until the end of the trial, I am able to still record the time.
*Each routine is 3 seconds long, with the target circle presenting itself 1 second in. Thus, 2 seconds is the theoretical max for cursor dwell time.
What did you try to make it work?:
#begin routine inQuad = False outQuad = True totalTimeIn =  totalTimeOut =  #each frame----- #inside quad if CorrectQuad.contains(mouse): countIn = core.CountdownTimer(2) inQuad = True outQuad = False #exits quad if not CorrectQuad.contains(mouse) and inQuad: timeIn = 2 - countIn.getTime() totalTimeIn.append(timeIn) #outside quad if not CorrectQuad.contains(mouse): countOut = core.CountdownTimer(2) inQuad = False outQuad = True #enters quad if CorrectQuad.contains(mouse) and not inQuad: timeOut = 2 - countOut.getTime() totalTimeOut.append(timeOut) #end routine----- #for when participant dwells till trial is done totalTime = int(sum(totalTimeIn) + sum(totalTimeOut)) finalCountIn = int(countIn.getTime()) finalCountOut = int(countOut.getTime()) if totalTime < 2 and finalCountIn < 2: totalTimeIn.append(2 - finalCountIn) elif totalTime < 2 and finalCountOut < 2: totalTimeOut.append(2 - finalCountOut) thisExp.addData ('timeInQuad (s)', sum(totalTimeIn)) thisExp.addData ('timeOutQuad (s)', sum(totalTimeOut))
What specifically went wrong when you tried that?:
- It seems to (incorrectly) record dwell time within the correct quadrant, but not out (see attached). I suppose once I figure out how to record dwell time within, I could simply subtract from 2 to find dwell time outside.
- The issue is that I want it to
getTimeon variable change (ex. inQuad changes from true to false), but as of now, I think I’ve set impossible conditions with
if CorrectQuad.contains(mouse) and not inQuad. Help!