creating patches for radialStim

299 views
Skip to first unread message

Andy S

unread,
Mar 31, 2016, 6:53:21 PM3/31/16
to psychopy-users
Hi all,

My ultimate goal is to create a radial checkerboard where the "rings" of the stimulus increase logarithmically with eccentricity. The default sqrXsqr texture supplied with radialStim comes close, but the rings are equally spaced.

Thanks to Michael MacAskill's comment on a related stackoverflow question I asked, I was able to make a number of potential patches that I believed would achieve the desired effect.

The first patch I tried looked like this (red patches = -1 and blue patches - 1 in the corresponding numpy array):


I figured that making checks expand along the Y axis with eccentricity might do the trick, but the resulting radialStim image looks like this:

checkerboard = visual.RadialStim(win, tex = texture, color=1, size=12,
    visibleWedge=[0, 360], radialCycles=1, angularCycles=1, interpolate=False)
 
checkerboard.draw(win)


It's close, but its clear that the shortest (radial length) checks are not located at the center-most ring. Sinceit looks like the stimulus above has a little unwanted oscillation of radial length, I instead tried the following texture:

But the resulting stimulus actually looks as though it has more extreme unwanted oscillations. it's as though the stimulus is somehow tiling the patch in a way I wasn't intending, but in the code snippet to create the stim object, I specify only 1 angular and radial cycle of the texture --- checkerboard = visual.RadialStim(win, tex = texture, color=1, size=12,

    visibleWedge=[0, 360], radialCycles=1, angularCycles=1, interpolate=False) ----

I guess I still don't understand what the texture is supposed to be in order to create a radial checkerboard where the ring-widths increase with eccentricity. So ultimately, my question is: what is the patch supposed to look like to create the stimulus I want?

Thanks in advance!

Andy


Michael MacAskill

unread,
Mar 31, 2016, 11:39:53 PM3/31/16
to psychop...@googlegroups.com
Hi Andy,

I suspect Jon will be the one to answer this properly, but to facilitate things you should probably post the code you actually use to generate the textures.

Regards,

Michael

> On 1/04/2016, at 11:53, Andy S <andrew...@gmail.com> wrote:
>
> Hi all,
>
> My ultimate goal is to create a radial checkerboard where the "rings" of the stimulus increase logarithmically with eccentricity. The default sqrXsqr texture supplied with radialStim comes close, but the rings are equally spaced.
>
> Thanks to Michael MacAskill's comment on a related stackoverflow question I asked, I was able to make a number of potential patches that I believed would achieve the desired effect.
>
> The first patch I tried looked like this (red patches = -1 and blue patches - 1 in the corresponding numpy array):
>
>
>
>
> I figured that making checks expand along the Y axis with eccentricity might do the trick, but the resulting radialStim image looks like this:
>
> checkerboard = visual.RadialStim(win, tex = texture, color=1, size=12,
> visibleWedge=[0, 360], radialCycles=1, angularCycles=1, interpolate=False)
>
> checkerboard.draw(win)
>
>
>
>
> It's close, but its clear that the shortest (radial length) checks are not located at the center-most ring. Sinceit looks like the stimulus above has a little unwanted oscillation of radial length, I instead tried the following texture:
>
>
>
> But the resulting stimulus actually looks as though it has more extreme unwanted oscillations. it's as though the stimulus is somehow tiling the patch in a way I wasn't intending, but in the code snippet to create the stim object, I specify only 1 angular and radial cycle of the texture --- checkerboard = visual.RadialStim(win, tex = texture, color=1, size=12,
>
> visibleWedge=[0, 360], radialCycles=1, angularCycles=1, interpolate=False) ----
>
> I guess I still don't understand what the texture is supposed to be in order to create a radial checkerboard where the ring-widths increase with eccentricity. So ultimately, my question is: what is the patch supposed to look like to create the stimulus I want?
>
> Thanks in advance!
>
> Andy

--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

Andy S

unread,
Apr 1, 2016, 12:01:54 AM4/1/16
to psychopy-users
Right. The code I used to generate both textures is below. I added comments in an attempt to make my code a little more understandable.

import numpy, scipy.signal
from numpy import pi
import matplotlib.pyplot as plt


t= numpy.linspace(0,12,256) # timeline

## # Create expanding-freq y-axis sinusoid # # #
f0y = .1 # begining freq
t1y = 12 # time of reference freq
f1y = 1  # reference freq

y = scipy.signal.chirp(t, f0y, t1y, f1y, method='logarithmic')
ally = numpy.zeros((len(t),len(t)))
for i in xrange(len(ally)):
    ally[:,i] = y #create cols of texture

allys = numpy.append(ally, ally, axis = 1) # this stuff is a dirty way to get the larger texture
reversedy = numpy.flipud(allys) * -1      # this stuff is a dirty way to get the larger texture
yTex = numpy.append(allys, reversedy, axis = 0) # this stuff is a dirty way to get the larger texture


## # Create standard x-axis sinusoid
f0x = .5 
t1x = 12
f1x = .5 # freq is fixed at .5

x = scipy.signal.chirp(t, f0x, t1x, f1x, method='logarithmic')
allx = numpy.zeros((len(t),len(t)))
for i in xrange(len(allx)):
    allx[i,:] = x #create rows of texture

allxs = numpy.append(allx, allx, axis = 0)
reversedx = numpy.fliplr(allxs)
xTex= numpy.append(allxs, reversedx, axis = 1)
### #

fullStim = xTex * yTex #combined sinusoid

texture = numpy.where(fullStim>0, 1, -1) #binarize full sinusoid pattern

texture2 = ally * allx # only one quarter of the full sinusoid
texture2 = numpy.where(texture2>0, 1, -1) 


plt.imshow(texture)
plt.show()
plt.imshow(texture2)
plt.show()

Reply all
Reply to author
Forward
0 new messages