Hey everybody!
I’m currently working on a project using different visual stimuli and face some problems trying to implement certain features. In general, I want to present stimuli of different shapes and numbers. Therefore, I am using ElementArrayStim to achieve this.
However, I haven’t quite figured out how to incorporate other elements in ElementArrayStim since currently it just blacks the whole screen instead of presenting a different shape. Apparently one can use any object that has a .draw() and a .setPos([x,y]) method. So I created some different shapes using ShapeStim and am now trying to incorporate them into the presentation of ElementArrayStim (which isn’t working properly).
My guess is, that I need to give ShapeStim additionally to its position argument a .setPos([x,y]) method, but I do not know how. Another idea I had, was to create an object with init_ etc., but since I am a bloody beginner this seemed even more overwhelming to me.
Currently my code (reduced to the important bits) looks like this:
#define global variables
size_obj = None
n_dots = None
ascending = [1,2,3,4,5,6,20]
#function for the star object
def StarFunction (size_obj):
star = visual.ShapeStim(win, units = 'pix', name='star', vertices='star7',size=(size_obj), ori=0, pos=(50,0), lineWidth=1, lineColor=[-1,-1,-1], lineColorSpace='rgb', fillColor=[-1,-1,-1], fillColorSpace='rgb', opacity=1, depth=0.0, interpolate=True)
star.draw()
#star.setPos([0,50])
star_obj = StarFunction (10)
#function displaying mulitple objects
def Test (n_dots):
VarStim = visual.ElementArrayStim(
win, units="pix",
fieldSize=(1.0, 1.0), fieldPos=(0, 0), fieldShape="circle", nElements=n_dots, colors=[-1,-1,-1], elementTex=None, elementMask=None, element=star_obj, sizes=10)
VarStim.draw()
win.flip()
core.wait(1)
Blankscreen(0.45)
#Loop through the number of objects
for i in ascending:
Test(i)
I would appreciate any help or comment! Also, ideas different than the ones that I had are very much welcome because I’m stuck for a while now.
Thank you so so much in advance!
Best wishes to you all