MacOS Ventura 13.4
PsychoPy version: 2024.02
Standard Standalone? yes
I want to find the Near Threshold Value of a sound stimulus. That is, the sound is only detected 50% of the time from participants’ keyboard response. We start from the initial value of 1, and if participants press “y”, yes for detection, then we lower the volume. If participants press “n”, no for detection, we increase the volume.
From what I’ve been reading we should be using the QUEST staircase to set up pThreshold = 0.5, but we have been having so many issues with it and how it ties to the intensity level of the sound stimulus and keyboard responses. I could not give one specific error message as every time I try to debug one issue, another one pops out. Specifically it always spits out this one error message:
text = visual.TextStim(win=win, name='text',
UnboundLocalError: local variable ‘visual’ referenced before assignment
################# Experiment ended with exit code 1 [pid:1564] #################
PTB-INFO: Using PortAudio V19.7.0-devel, revision unknown
Please reply if you know how to construct this experiment better- can we use a simple staircase? Or how can we set up QUEST without having to circle back to error messages that don’t make sense?
Sorry I’m very new to this and not sure exactly I know what you mean. I have attached the original file here but I’m specifically having trouble with the first part of the builder where there’s code component, keyboard response and sound stimulus. I don’t think there is anything wrong necessarily with visuals maybe just a general set up error.
Are you using code from a former experiment programed with Coder? The Builder does automatically a lot you things for you, e.g. win.flip(), importing libraries, waiting for keypresses, win.close, core.quit aso.
I assume that you can delete
Begin experiment
# Begin Experiment
import psychopy
psychopy.useVersion('2024.2.0')
from psychopy import data, event, sound, core, visual
End Routine
win.flip() # Update the window to show the stimulus
# Wait for a response
while response.status != event.FINISHED:
keys = event.getKeys(keyList=['y', 'n'])
if keys:
response.keys = keys[0]
response.status = event.FINISHED
win.flip() # Update the window
But you still need to get the value for response.keys because you use it later.
Thank you! I removed them and the comment below but now its gives an error message: win.callOnFlip(response.clearEvents, eventType=‘keyboard’) # clear events on next screen flip
AttributeError: ‘BuilderKeyResponse’ object has no attribute ‘clearEvents’
################ Experiment ended with exit code 1 [pid:32518] #################
Thank you! I removed them and now its gives an error message: win.callOnFlip(response.clearEvents, eventType=‘keyboard’) # clear events on next screen flip
AttributeError: ‘BuilderKeyResponse’ object has no attribute ‘clearEvents’
################ Experiment ended with exit code 1 [pid:32518] #################
Are you using PsychoPy version 2024.0.2? I am using 2024.1.5 It recognises quite a lot of unknown parameters, either from a routine or a component, see for example the unknown tab of the following component welcometext2. PsychoPy 2024.1.5 complains about the unknown parameters.