Hello,
I am trying to use visual.ElementArrayStim to produce many gabor patches.
The code I have is as below:
from psychopy import visual, core, data, event, logging, sound, gui
import numpy as np
from numpy import sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray
from numpy.random import random, randint, normal, shuffle
win = visual.Window(size=(900, 900), fullscr=False, screen=0, allowGUI=False, allowStencil=False,
color=[0,0,0], colorSpace='rgb',
blendMode='avg', useFBO=True,
)
import math
from random import randrange
from random import randint
nEls = 50
tex='sin'
mask='gauss'
sizes = [15,15]
sfs = 2
elements = visual.ElementArrayStim(win, nElements=nEls,
sizes=sizes, sfs=sfs, units='pix',
elementTex=tex, elementMask=mask,
fieldShape='sqr')
xys = random([nEls,2])*465-232.5
oris = random()*180
elements.setXYs(xys)
elements.setOris(oris)
for frameN in range(160):
elements.draw()
win.flip()
This code (with sfs = 2)
produces nice looking gabors, like the image on the left.
But since the units='pix'
for my ElementArrayStim, the sfs
value should actually be lower (within 0.2-0.001 according to the PsychoPy documentation).
But when I do uses sfs=0.002, the gabors don’t look correct (image on the right)
I’m not sure what i’m doing wrong.
*I made sure that the units were set to pixels in the Preference box (general) too.
Thanks in advance.