psychopy.org | Reference | Downloads | Github

Random gabor stimulus

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.0.6
Standard Standalone? (y/n) If not then what?: Yes

**What are you trying to achieve?: I am trying to create a gabor stimulus with 2 intervals where the gabor is random and counterbalanced in its location (left or right) of the fixation and in the intervals (1st or 2nd). Each block consists of 50 trials.
circle 2.0 sec
diamond + gabor 0.02 sec
circle 2.0 sec
diamond + gabor 0.02 sec
circle 0.04 sec
not timed for response and rating
Response (1st or 2nd interval?)
Confidence rating

**What did you try to make it work?: I have a trial routine with everything listed above that is timed, a response routine, and a confidence rating routine. For the gabors I am using the grating stimulus and I have them named as gabor_1_L, gabor_1_R, gabor_2_L, gabor_2_R

I think that I am at the point where I have to insert code. I am not sure if I can use an excel sheet for this specific situation or not. I don’t know what I am doing. I need some help to find my way through the woods so to speak. I am not sure what approach from here I can take. I saw a video on using an excel sheet and using IF statements under 2 counterbalance conditions. However, for a block of 50 trials and having the condition of 1st or 2nd interval as well as left or right of fixation has me confused on where to go from here. Also since I’m using a gabor I don’t know if I can even use an excel file. Thank you.

So I am looking into making 2 lists.
stim_location = [’(-10,0)’, ‘(10,0)’]
stim_time = [2.0, 4.02]

I have in the gabor stimulus on builder $stim_location and $stim_time in the appropriate fields.

This will give the variables stim_time[0], stim_time[1], stim_location[0], stim_location[1].
Now I am wondering how to go about making 4 conditions with a time and location 2x2. Then I want to randomize these conditions, but have it to where it equally distributes the time(interval) and location.

This certainly sounds like something that could just be handled best by a conditions file, and shouldn’t require any code. In your Excel file, just balance all of the factors (i.e. have one row containing each of all of the possible combinations), and then set the loop type to “random”, possibly with an nReps value specified if you need to have some replication to get the the total number of trials desired.

NB:

  • The number of trials will need to be a multiple of 4 (i.e. 2 levels of location × 2 levels of time), so 50 trials doesn’t seem compatible (i.e. wouldn’t you need to have, say 48 or 52 trials to maintain a balanced design?).
  • Presentation durations need to be an integer multiple of the frame duration that arises from your display’s fresh rate. e.g. a 60 Hz display can only support durations that are multiples of 16.6666 ms. So stimulus durations like 0.02 seconds are possible only if your display has a refresh rate that is a multiple of 50 Hz (say, two refresh periods of a 100 Hz display).
1 Like