Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
164 lines (130 sloc) 6.38 KB
Set up stimuli and constants/variables.
1. Window (copy-paste)
2. Exercise: various stimuli and variables
1. Start with an empty trial with full structure
2. Make oris = [0, 90] and create those trials
3. Exercise: make trials by adding for-loops.
4. Randomize, add trial['no'] and put in function
Exercise 1: create trial_list (a list of dictionaries/trials).
* add for-loops so that every combination of the above variables
is generated.
ORIS --> trial['ori'],
POSITIONS --> trial['xpos'],
GABOR_FRAMES --> trial['duration']
* add a for-loop so that each trial is repeated "repetitions" times
hint: range(repetitions) is a list with the length "repetitions"
* for now, we're just going to deal with the "trueFix" condition.
set trial['fix_pos'] to the the same as trial['gabor_pos'].
* pros: randomize the trialList after it is generated.
hint: random.sample() or random.shuffle()
hint: import
* pros: pack this in a method called "make_trial_list(condition)" which
returns the trialList. Condition will later be used to create xpos
for the "falseFix" condition.
INSTRUCTION: just do this
Exercise 2: create stimuli.
Now we're going to add stimuli to the "import and stimuli" section and add
control of various stimuli-properties from the "variables" section. Suggested
variable names are ("quoted in parenthesis").
* Create a window ("win") using degrees as units. All other stimuli
will inherit this unit by default, so no need to specify it there.
* Let your naive RA specify distance to the monitor ("MON_DISTANCE"), width of
the monitor ("MON_WIDTH") and resolution of the monitor ("MON_SIZE").
Hint: use monitors module and of course visual.Window.
Furthermore, the window should be fullscreen, have a black background and
allowGUI = False.
* Make a gabor patch ("stim_gabor"). Let the user specify spatial frequency
("GABOR_SF") and size ("GABOR_SIZE").
hint: visual.GratingStim, mask='gauss'.
* Make a fixation cross ("stim_fix"). Let the user specify the height ("FIX_HEIGHT").
Hint: visual.TextStim with the text '+'.
* Make a text for a break ("stim_text"). Let the user specify position ("MESSAGE_POS")
and height ("MESSAGE_HEIGHT"). Set the wrapWidth=999 to avoid uncontrolled line breaks.
* make a two beeps ("sound_success") and ("sound_fail") using sound.Sound or ppc.Sound.
Suggestions for success: a C of 0.1 seconds at octave 6
Suggestions for fail: a C of 0.4 seconds at octave 4
* Make a clock ("clock"). We're going to use it to assess timing of responses and stimuli.
hint: core.Clock
* pros: start working on a method ("run_block") in the "methods" section which
1. generates a trialList using make_trial_list
2. loops through trials
3. present a fixation cross in a flip-loop
4. present a stimulus in a flip-loop
5. present a mask in a flip-loop
6. collect response (event.waitKeys will do here)
INSTRUCTION: Present a trial
1. Make function, call it run_condition and loop through trials.
2. Make the fixation cross
3. Exercise: add other flip-loops and render using trial.
Exercise 3: present stimuli in flip-loops.
* Present the stimulus for the correct duration with the fixation cross on top.
Remember to set the orientation and position of the gabor patch
in the beginning of the trial.
Hint: all the stuff you need is available in trial['duration'], trial['ori'] etc.
Hint: flip-loop over trial['duration']
Hint: ori and pos attributes
* Present the mask for the correct duration with fixation cross on top.
The mask is horizontal and vertical gabor patches superimposed to
reduce retinal afterimages.
Hint: we need a new constant "FRAMES_MASK" to control mask duration.
set it to 3 frames.
Hint: draw horizontal, vertical, fix, and then flip.
* Pro: if your concerned about the timing of drawing the mask, you can make
a visual.BufferImageStim() "screenshot" in the "stimuli" section and use that
since it is identical from trial to trial.
1. Collect responses
2. Exercise: score the trial
3. Save trial using ppc.writer. Inspect output.
Exercise 4: handle responses and give feedback:
* save trial['score']. Should be 1 on correct response and 0 otherwise.
Hint: trial['ori'] and trial['response'] should match - sort of.
Hint: think in everyday language: "if the orientation was 90 and the subject
pressed left, trial['score'] should be 1." etc.
* Play the sound_success if subject answered correctly, and the sound_fail otherwise.
* Pros: if you want to record responses already from e.g. stimulus onset,
use ppc.Keyboard because we're in flip-loops and event.getKeys/event.waitKeys
would fail to deliver exact timing here.
Hint: the .reset() method clears all earlier events and resets timing.
INSTRUCTION: Finishing up
1. Make dialogue with "subjectID" and "mood = ['happy', 'sad', 'meh']
2. Exercise: finish dialogue
3. React to condition in makeTrialList and execution
4. Add breaks
5. Assess timing of stimuli
Exercise 5: create initial dialogue.
* Change it so that we now have:
gender: "male" or "female"
condition: "trueFix" or "falseFix"
* Change the order to the following: subject, age, gender, condition.
Hint: look at the arguments/documentation for DlgFromDict
Exercise 6: update trials using info from the dialogue.
Update the trialList so that subject, age and gender takes their values
from the dialogue box. We're going to keep condition being determined by
the argument to makeTrialList.
Exercise 7 (for the over-achievers): test and modify your experiment.
* I'm worried that the drawing of the mask is too slow. Test it.
Hint: ppc.timer using a multi-line script.
* What is the actual visual angle extended by the gabor patch?
Adjust so that it is closer to 5 degrees.
Hint: ppc.deg2cm
* Add a new position condition to the task.