So I’m using a QUEST handler, and I’ve obtained 75, 50 and 25% detection thresholds. They are saved as such:
threshold_50
threshold_25
threshold_75
I want to use these threshold values later in the study to change the volume of an audio stimulus. I have multiple trials in a block and the volume needs to vary between the 3 thresholds and 0 volume. I have created a conditions file and a column (GVolume), that includes: threshold_50, threshold_25, threshold_75 and 0. And have set the volume of my audio stimuli to GVolume.
The problem is it is recognising the value as a string not a float. All the thresholds are a float. I was just wondering if there were anyway to use my obtained values from the QUEST to set the volume of my stimuli?
Is there a reason why it needs to be a float and not an int? It’ll probably be easier to just save them as integers and use them that way. Otherwise, float() should work.
It just depends what format the volume setting is in. For PTB sound it looks like volume is a float between 0 and 1, so you’ll need to 1) have it as a float and 2) convert it to a value between 0 and 1.
If float() does not work and it’s recognizing them as strings specifically, eval() will also work, though whether you get a float or an int will depend on whether there is a decimal. That said, if you need to convert it to a value between 0 and 1 anyway, it’ll get turned into a float at that point.
No I created the cvs before - I was unsure how to set the trial order when creating a new file. I think I’ve fixed it. I’ve used the column name GVolume and added code to convert it to the threshold value and then used GVolume2 as my volume of my audio component:
if GVolume == ‘threshold_50’:
GVolume2 = threshold_50
elif GVolume == ‘threshold_25’:
GVolume2 = threshold_25
elif GVolume == ‘threshold_75’:
GVolume2 = threshold_75
elif GVolume == ‘0’:
GVolume2 = 0
else:
GVolume2 = 0
In a completely unrelated problem (which I might start a new thread for). When I use a keyboard response, after so many trials a brief noise (almost like a bounce/ping sound), when a key is pressed appears. Any suggestions why?
What version of PsychoPy are you using? It sounds like your key presses are being sent to Builder as well as being registered by the experiment. I think this was fixed in 2024.2.3 or 2024.2.4.
I’m using 2024.2.4 - it only starts happening after about 20 trials. I’ve used previous version and never had that problem - I switched to 2024.2.4 as the QUEST handler has been working a lot smoother for me.