RadialStim not functioning on any versions from v2024.1.2 onward

From v2024.1.2 onward, I get this error when trying to use visual.RadialStim

    stimulus1 = visual.RadialStim(
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/contrib/lazy_import.py", line 118, in __call__
    return obj(*args, **kwargs)
TypeError: RadialStim() takes no arguments

No issues prior to 2024.1.2. I tested all the other 2024 versions and some 2023 versions.

OS: MacOS 15
Psychopy Version: 2024.1.2 onward
Plugins: Psychopy-visionscience 0.0.7 is installed via plugin manager.

Here’s code I used:

from psychopy import visual, core, event

# Create a window
win = visual.Window(monitor='my_monitor', size=[2560,1440], fullscr=True, screen=0)

# Create stimulus
stimulus1 = visual.RadialStim(
win = win,
units='deg',
colorSpace='rgb',
size=20,
texRes = 512,
angularRes = 512,
tex="sqrXsqr",
color = 1,
contrast = 1,
pos = (0,0),
visibleWedge= (0,360),
mask = 'circle',
radialCycles = 2.5, # 5 rings
angularCycles= 10, # 20 slices
radialPhase = 0,
angularPhase = 0,
)

stimulus1.draw()
win.flip()
core.wait(3)
win.close()
core.quit()

thanks!
Mark

Same goes for NoiseStim.

Hi @mpinsk,

Could you try adding the following to the top of your script:

from psychopy import plugins
plugins.activatePlugins()

Thanks,

Kim

1 Like

That worked! Any chance you can explain why I need that now and not in earlier versions? Just curious.

Thank you!!

It works. Thanks!

1 Like

Plugins were introduced in 2023 to reduce the size of the core package.

1 Like

I met the same problem but failed to solve it as you suggested.

Here I tried the same code, with the two lines on the top, but it did not work. :frowning: PychoPy 2024.2.4 compatiblity+)

Thank you !

Meng

Here is the error information:

Running: C:\Program Files\PsychoPy-3.8\Lib\gm-practice\gm-practice-5.py##

pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File “C:\Program Files\PsychoPy-3.8\Lib\gm-practice\gm-practice-5.py”, line 15, in
stimulus1 = visual.RadialStim(
File “C:\Program Files\PsychoPy-3.8\lib\site-packages\psychopy\contrib\lazy_import.py”, line 118, in call
return obj(*args, **kwargs)
TypeError: RadialStim() takes no arguments
################# Experiment ended with exit code 1 [pid:6016] #################

Here is the code example I tried as above:

Blockquote
#!/usr/bin/env python

from psychopy import visual, core, event

from psychopy import plugins
plugins.activatePlugins() # still do not work

win = visual.Window([1920, 1080], monitor=“testMonitor”, colorSpace=‘rgb’)

stimulus1 = visual.RadialStim(
win = win,
units=‘deg’,
colorSpace=‘rgb’,
size=20,
texRes = 512,
angularRes = 512,
tex=“sqrXsqr”,
color = 1,
contrast = 1,
pos = (0,0),
visibleWedge= (0,360),
mask = ‘circle’,
radialCycles = 2.5, # 5 rings
angularCycles= 10, # 20 slices
radialPhase = 0,
angularPhase = 0,
)

stimulus1.draw()
win.flip()
core.wait(3)
win.close()
core.quit()

Thank you !

Hi @Meng,

Could you please try saving your script somewhere other than in PsychoPy’s Lib folder, for instance on your Desktop or in your Documents folder and see if it runs successfully then?

Thanks so much,

Kim

hi @Meng and @Kimberley_Dundas and anyone else listening in

i have altered legacy code for a flashing radial checkerboard stimulus (with a small circular central fixation that changes colors randomly) that worked fine in psychopy v2023.2.3 but now not in v2024.2.4 (compatibility+ standalone installed today). a window for user options opens and is able to be set, but then the experiment breaks and i’m getting the same errors (“TypeError: takes no arguments”) with both RadialStim() and PatchStim(). i’ve tried moving my script location, adding those 2 lines up top (after i think correctly installing plugins at CLI as well as via Psychopy’s commandline), restarting psychopy (and computer) many times. are there other solutions? please help if you can. i realize some of those functions have been deprecated. i’m all ears for easy drop-in replacements but since it’s legacy code i might be a tad slow on what’s exactly happening (insert monkey with shamed hands over face emoji). thanks in advance! here are the main visual definitions:

central_grey = visual.PatchStim(myWin, tex=None, mask=‘circle’, color=0rgb, size=.23)

fixation = visual.PatchStim(myWin, tex=None, mask = ‘circle’, color=1*rgb, size=1, units=‘deg’)

wedge1 = visual.RadialStim(myWin, tex=‘sqrXsqr’, color=1,size=stimSize,
visibleWedge=[0, 360], radialCycles=4, angularCycles=8, interpolate=False,
autoLog=False,ori=0,pos=(0,0))

wedge2 = visual.RadialStim(myWin, tex=‘sqrXsqr’, color=-1,size=stimSize,
visibleWedge=[0, 360], radialCycles=4, angularCycles=8, interpolate=False,
autoLog=False,ori=0,pos=(0,0))

hold up! sorry for the whiplash. i kept on with this and this works now, with those 2 plug-in lines up top :slight_smile:

central_grey = visual.GratingStim(win=myWin, tex=None, mask=‘circle’, color=0rgb, size=.23, units=‘deg’)

fixation = visual.GratingStim(win=myWin, tex=None, mask=‘circle’, color=1rgb, size=.23, units=‘deg’)

wedge1 = visual.RadialStim(myWin, tex=‘sqrXsqr’, color=1,size=stimSize,
visibleWedge=[0, 360], radialCycles=4, angularCycles=8, interpolate=True,
autoLog=False,ori=0,pos=(0,0))

wedge2 = visual.RadialStim(win=myWin, tex=‘sqrXsqr’, color=-1,size=stimSize,
visibleWedge=[0, 360], radialCycles=4, angularCycles=8, interpolate=True,
autoLog=False,ori=0,pos=(0,0))

so now the nature of my question has completely changed:

when i eventually update to a stable version 2025.1.etc will these GratingStim and RadialStim calls have to be altered again?

and furthermore, will i still need the from psychopy import plugins plugins.activatePlugins()
lines up top?

You’ll still need those lines about activating plugins in future versions if you’re coding from scratch, yes. They’re added automatically if you use Builder.

The reason is that RadialStim and PatchStim are both now in plugins rather than the core library: RadialStim and NoiseStim are in psychopy-visionscience, PatchStim is in psychopy-legacy.

When you have those plugins installed, you can always import these classes directly from the plugins (e.g. from psychopy_visionscience.radial import RadialStim), but calling activatePlugins tells PsychoPy that when you ask for visual.RadialStim it should give you psychopy_visionscience.radial.RadialStim instead. Without those lines, you’ll get the PluginStub placeholder from where that class used to be in the library, hence the error.

Although, in 2025.1 onwards, you should get a more helpful error than that “TypeError: takes no arguments” one! When you try to initialise a PluginStub, it should now give a PluginRequiredError telling you where the class has been moved to.