[solved] Presenting stimuli at different frequencies
Hi Sebastiaan,
The stimuli that I wish to present needs to follow the normal curve, and so some stimuli will be presented, randomly, more frequently than others during the loop. For example, say I have 10 experimental stimuli whose frequencies are as follows
1 -> 1
2 -> 2
3 -> 3
4 -> 4
5 -> 5
6 -> 5
7 -> 4
8 -> 3
9 -> 2
10 - > 1
So here there would be 30 cycles in the loop, though not every stimulus is presented the same number of times. How can I make it so each stimulus is presented a specific number of times during the loop? I realise that I could simply input the stimuli individually under the variable name, but the experiment I am running has far more stimuli and requires at least 200 cycles per loop. I was wondering if there was an easier way to achieve this?
Kind Regards
Rob
Comments
Hi Rob,
There is. As you say, for a low number of stimuli, it's probably better to manually create a list, but ...
Method 1
... for a large nr of stimuli you could draw a number from a gaussian distribution. You could do this by inserting an inline_script at the start of the trial, with (something like) the following code in the prepare phase.
import random nr = round(random.gauss(5, 1)) # Mean = 5, Stdev = 1 self.experiment.set('my_random_number', nr)See http://docs.python.org/library/random.html#random.gauss
Method 2
This has the disadvantage that you cannot control exactly how often each number occurs (although for a large number of trials this probably doesn't matter). If you want exact control, you could add an inline_script to the start of the experiment, with (something like) the following code in the run phase:
This generates a randomly ordered list of numbers, where '1' occurs 5 times, '2' occurs 10 times, etc. To draw a number from this list on every trial, add an inline_script at the start of the trial, with (something like) the following code in the prepare phase:
nr = self.experiment.nr_list.pop() self.experiment.set('my_random_number', nr)Hope this helps!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan
Sorry for my delayed reply, and thank you for your help. That helps greatly!
Great support!
Cheers,
Rob