[open] how to create feedback with different proportions
Hello, we use a free choice task in which one of four relevant keys can cause an effect on the screen (a red circle changes its color to white and disappear).
We have a problem in creating different proportions of feedback to each one of the relevant keys.
for instance, a specific key will cause the effect on the screen in only 70% of the times it is pressed.
any suggestion or example how to do it will be very helpful
Noam
Comments
Hi Noam,
Perhaps you can describe your problem in more detail? I.e. what exactly are you trying to accomplish, what do you have at the moment, and in what sense doesn't it work?
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi
We are new with Sesame so I will try to be more specific:
we have created a response effect (a proceeding sketchpad) that appears when one is pressing any one of four relevant keys. The problem we are facing is how to create two proceeding "effects" (sketchpads) that will appear with different proportions after each key. For example, a sketchpad (a response effect) will follow a key press 70% of the times and different sketchpad (different response effect) after the other 30 % of the times the same key is pressed.
it is a common procedure in experiments using feedback in a fixed proportion.
thank you!
Noam
Hi Noam,
If I understand correctly, a given keyboard response should lead to the appearance of a 'desired' sketchpad in 70% of the cases, whereas it leads to a different sketchpad in the remaining 30% of the cases. Is that correct? The explanation below will give you an idea of how to achieve this. You can adapt this to your specific situation, for example by extending it to multiple keypresses which all have different 'desired' and 'different' sketchpads associated with them.
1: Append an inline_script to your block_sequence, and place the following code in its "Prepare phase" tab:
2: Append an inline_script item to your trial_sequence and place the following code in its "Prepare phase" tab:
3: Append two sketchpad items to your trial_sequence, one with the 'desired' and one with the 'different' content. Make sure those items are placed after the inline_script item and the keyboard_response item.
4: Open your trial_sequence item, and set the "Run if" statement of the 'desired' sketchpad to
[responseEffect] = desired. Adapt the "Run if" statement of the 'different' sketchpad according to similar reasoning.An example experiment can be downloaded here (simply save with the extension '.opensesame'):
Note that I used a little bit of Python inline coding. If you're not familiar with Python, this might be a good start:
I hope this helps you getting started! Please let us know if you have any further questions!
Best wishes,
Lotje
Did you like my answer? Feel free to

You understand it correctly. thank you very match Lotje!
Hi Noam,
You're welcome!
Good luck with your experiment and don't hesitate to post more questions!
Best,
Lotje
Did you like my answer? Feel free to

Hi again
The script that you sent us worked very well. We defined one key that leads to two different sketchpads with different proportion. However, we still have problem in creating four keys that lead to different sketchpads with different proportions. For example, the key "s" leads to "sketchpad 1" in 30% of the presses and to "sketchpad 2" in 70%, while key "d" leads to "sketchpad 1" in 60% of the presses and to "sketchpad 2" in 40%.
We would like to know how to define four keys for each proportion condition and what do we need to change in the script in accordance to the above.
Thank you for your help
Noam
Hi Noam,
I think it's a good idea to make a Python dictionary at the start of your experiment, containing the possible keyboard presses as keys, and the corresponding probabilities of sketchpad1 as values.
For example:
Next, you could append an inline_script to your trial_sequence and determine whether sketchpad1 or sketchpad2 is going to be presented by placing the following Python code in the Run phase tab. (Note that this item should be placed after the keyboard response is collected, but before sketchpad1 and sketchpad2.)
The updated example experiment can be downloaded here.
I hope this helps!
Best wishes,
Lotje
Did you like my answer? Feel free to

thank you!
We have another last question for the cuurent experiment, hope you could help us with this one too.
We would like to add the data output another variable that counts the responses (key presses) whithin each trial.
thank you again!
Noam
Hi Noam,
You're welcome!
I don't completely understand what you mean by 'a variable that counts the responses within a trial'. Is the participant giving multiple responses in one trial?
In general, all items in your experiment are automatically counted by OpenSesame. The counters are stored in the variables called 'count_' followed by the name of the item (e.g. 'count_keyboard_response') and automatically logged to your output file (provided that you appended a logger item to the end of your trial sequence, of course):
Note that in Python counting always starts at zero. So the first time a keyboard_response item is run, 'count_keyboard_response' has the value 0, whereas the second time it has the value 1, etc.
Does this help? If it doesn't solve your question, please don't hesitate to post again!
Best,
Lotje
Did you like my answer? Feel free to

thanks for the quick reply,
Participants are instructed to respond only one time. However,some may respond more than one time in a single trial.
"count_keyboard response" counts only the first response on each trial. I am interested on the actual number of presses within a trial (even though participants are instructed to press only one time per trial).
Noam
Hi Noam,
It's still not completely clear to me what you mean. If you don't want participants to give multiple keyboard responses before the response effect (your second sketchpad) is shown, you could set the duration of the first sketchpad to 0, and place a keyboard_response item immediately after it (see the example experiment I uploaded earlier). By doing so, the experiment will always immediately advance to the next item (in your case the second sketchpad) as soon as a key is pressed.
If you want to continuously check whether your participants are pressing any keys (that will not have any effect anyway) throughout the whole experiment (i.e., during your first sketchpad, your second sketchpad, and any potential other sketchpad or feedback items), you'll need to run all of those items via inline scripts. I'm not sure whether that's worth all the effort.
If you do want to count the number of presses anyway, could you provide us with some more information by for example adding a screen shot of the overview of your experiment or uploading your script? And could you tell us where exactly in your trial sequence you want to continuously pull the keyboard input?
Best,
Lotje
Did you like my answer? Feel free to
