[solved] Pip & Pop concentric presentation
Hello,
First of all, thank you for this great resource you are making available to us.
My question: I would like to adapt the script you published for the Pip & Pop task so that:
- the stimuli appear on a specific number of concentric circles (I'm thinking 3 or 4) instead of in a rectangular grid.
- I can store the location where the target appeared in each trial as one or two variables (preferably angle + distance to center)
My understanding of Python is very limited. I guessed that the piece of script below (your original script) handles building the stimulus. I thought maybe the RadialStim object (http://www.psychopy.org/epydoc/psychopy.visual.RadialStim-class.html) could do the job, however I am at a loss as to how I should implement it in this script or if it's even the way to go.
If there is any way you can point me in the right direction I would appreciate it very much!
Cheers,
Raquel
# Generate a list of orientations and positions
l_stim = [] # List of all stimuli
for i in range(n_dist):
# Pick an orientation
if i == 0:
ori = ori_target
else:
ori = choice(ori_dist)
# Pick a color:
col = choice(colors)
# Pick an available position on the screen
redo = True
while redo:
x = randint(xmin, xmax)
y = randint(ymin, ymax)
redo = False
for _stim,_x,_y,_ori,_col in l_stim+[fixdot]:
d = sqrt( (_x-x)**2 + (_y-y)**2 )
if d < min_d:
redo = True
break
# Generate and save the stimulus
stim = PatchStim(self.experiment.window, tex=None, mask="gauss", pos=(x,y), size=size, ori=ori, color=col)
l_stim.append( (stim,x,y,ori,col) )
Comments
Hi Raquel,
The PsychoPy
RadialStim
class is used to display retinotopic-mapping-like stimuli. In your case, what you need to do is pick your stimulus coordinates so that they lie on an imaginary circle. This is actually quite easy, and you see it demonstrated in the script below, which is snippet from the script in the Pip & Pop example. As you can see, you need to change very little relative to the original.Basically, you use the stimulus number (
i
) to determine the angle. Because the first stimulus is always the target, you also need to rotate the stimulus display in its entirety by a randomoffset
, otherwise the target will always appear at the same location. Does that make sense?If you have no experience with Python, I would recommend walking through one of the tutorials. You will need some knowledge if you want to create these types of dynamic stimulus displays!
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
This was exactly what I needed, many thanks!
Cheers,
Raquel
Hi Sebastiaan,
Thanks again for your help, I have an experiment now that does ALMOST exactly what I want . I was hoping to be able to share the code for a working experiment, instead I'm asking another question..
I've adapted your code so that the stimuli appear on three concentric circles. The target can appear on any one of those circles. It works perfectly, except for when the target appears on the middle circle. In that case it jumps to the other side of the circle where it overlaps with the distractor at that same spot. I can't for the life of me figure out what I did wrong, maybe you can see my mistake?
I'm only using set sizes 24 and 48. I've added the variable "eccent" which stands for eccentricity and determines value r for radius (100, 175 or 250).
Cheers,
Raquel
Hi Raquel,
One (probably the) thing that goes wrong is the division. Let's take a look at this:
What you are doing is dividing by the division of two
int
s: (n_dist/6
). The problem here is thatint
divisions always return anint
, and never afloat
(in Python 2, which is used by OpenSesame). Or, phrased differently, decimals are lost.What you need to do is make sure that one of the numbers is a
float
:For example:
Does that solve the issue?
See also:
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your comment! I used floats as you suggested, but that didn't solve the issue. In the end the problem was the order of the items in the lists defining the radii for the distracter items. If anyone would like to know about the reason for the problem just let me know. Below is a version of the script that seems to be working.
Cheers,
Raquel
Good to hear you got it working, and thanks for sharing the script!
Check out SigmundAI.eu for our OpenSesame AI assistant!