Inside the exercise 8 folder is a 1-page article by Whitaker and McGraw (2000). Have a look at it. We're going to see if we can replicate their finding using a more rigorous design.
Your task is to fill in the missing parts in the cycleThroughTrials() function below (the code is in adjustTilt_base.py).
On each trial, the participant will view one of the "standard" images. Their goal is to adjust the orientation of another stimulus to match the orientation of the standard. They will adjust the orientation by using the mouse wheel. Up means increase orientation. Down means decrease orientation.
Assume that you are provided with a curTrial list of dictionaries such that each time cycleThroughTrials is called it receives the information on the current trial.
curTrial['standardStim'] will contain the filename of the "standard" image e.g., 12-col-34_12_right corresponds to 12:34 tilted 12 degrees to the right.
curTrial['adjustingStim'] will contain the name of the stimulus whose orientation is being adjusted. (1 or pipe).
The positions in which each stimulus will be presented are likewise given as part of the curTrial dictionary (see code below).
Your task for this assignment is to fill in cycleThroughTrials() with the code necessary to display the stimuli, update the orientation of
adjustingStim, and, when the participant clicks a mouse-button, writing the output to an output file. More info provided below. Basic code for monitoring mouse-wheels is provided below and in mouseWheelBasics.py
from psychopy import core, visual, prefs, event from myFirstLibrary import * win = visual.Window([800,600],color="white", units='pix') myMouse = event.Mouse() myMouse.setVisible(0) pics = loadFiles('stimuli/','.png','image', win=win) def cycleThroughTrials(curTrial): pics[curTrial['standardStim']]['stim'].setPos(curTrial['standardStimPos']) pics[curTrial['adjustingStim']]['stim'].setPos(curTrial['adjustingStimPos']) while noResponse: pics[curTrial['standardStim']]['stim'].draw() pics[curTrial['adjustingStim']]['stim'].draw() #.... monitor for mouse wheel movements and update orientation of adjustStim as necessary win.flip() """ assume curTrial['header'] contains a list of the keys of the dependent and runtime variables that can be used as keys in curTrial. Write the runtime/independent variables (tab delimited) to an output file (named subjInfo_data.txt) listing the runtime/independent variables in the order specified in trialInfo['header'], followed by the dependent variables (angle of response , number of wheel turns, and RT """
Basic code for monitoring mouse wheel movements (scrolling on a trackpad). See also mouseWheelBasics.py inside the Exercise 8 folder.
from psychopy import core, visual, prefs, event win = visual.Window([800,600],color="white", units='pix') myMouse = event.Mouse() myMouse.setVisible(0) numWheelTurnsDown=numWheelTurnsUp=0 while True: wheelRel = myMouse.getWheelRel() if wheelRel>0.0: numWheelTurnsDown+=1 print 'wheel down' elif wheelRel<0.0: numWheelTurnsUp+=1 print 'wheel up' if myMouse.getPressed()==1: print 'responded'