recall task: break loop time condition and accuracy issue
Dear all,
I'm currently working on a simple experiment where participants are presented with images and then asked to recall their names. To facilitate this, I've implemented a form allowing participants to input their answers using buttons and text input widgets.
However, I've encountered two main issues:
- I aim to grant participants a time window of 3 minutes to input as many answers as they wish. Additionally, I'd like to enable them to end the experiment whenever they feel they're done. While the latter functionality works smoothly, I'm facing challenges with the timing aspect. I've attempted to implement a solution by setting a start time () and then defining a timeout duration. My approach involves checking if the difference between the current time and the start time exceeds the timeout value:
if clock.time() - start_time > timeout: end_exp = True
However, this approach isn't yielding the desired results. I've also experimented with using variables automatically generated by the software, such as time_form
, which represents the time of the answer input form. While this method works better, it seems that the program only checks the value of the variable at the beginning of each new routine. Consequently, the timeout condition is only evaluated when a new action occurs, leading to termination of the experiment in delay. I've attempted to circumvent this issue by setting a break condition within the if statement, such as time_form > 30000
. However, the program seems to evaluate this condition only after a new action is initiated, resulting in a delayed response (and break of the loop).
I believe there must be a way to continuously monitor the passage of time and evaluate the break condition dynamically throughout the experiment, rather than solely relying on the occurrence of new actions.
Any insights or suggestions on how to resolve this issue would be greatly appreciated!!
- My second issue concerns matching participant responses with correct responses. I would like the feedback item to display the accuracy between the words inserted by the participants and the actual correct responses set by the experiment. I've defined the variable in the loop table and entered the names of the objects below in each row. I've also left the keyboard option open so it should automatically import correct response values. Additionally, I've attempted to use a logger, but unfortunately, the and values remain fixed at 0.
What steps can I take to address this issue?
Thank you for your attention! Any help will be very much accepted
p.s. I'll attach the experiment below so that anyone interested can check the builder!
(exp. 7: time and button end condition functioning with delay) - exp 6: button working properly, time not implemented in the way described, still working on delay)
Leonardo
Comments
Hi Leonardo,
First, it should be
if button_fine == 'yes':
not[button_fine]
(Otherwise you compare whether a list is a string which is always false.Second, you should put the entire code of the inline_script
new2_inline_script
into the run phase.Third, your
keyboard_response
item, doesn't do anything. You can remove it.Forth, you need to set
var=response
in the text input widget (not the formform_var
item).Finally, you need to manually compute the correct variable. The automatic computation only works for mouse and keyboard response items (I think). So:
correct = response == correct_response
should do the trick.Hope this helps,
Eduard
Eduard, thanks a lot!
Quick update on the experiment: the time break and button conditions are working smoothly now, thanks a lot for that!
Only one thing is still not clear: how do I get
accuracy
? Without keyboard_response item the variables (acc, accuracy) do not even get activated. However, even when active (when keyboard item added); it always gives result 0, as if I didn't get any of the correct_response, which indeed I had write in the input of the form.I added the inline_script you suggested, and it seems to store some values but accuracy is still not affected by it. I upload here the experiment updated version… Do you know how can I get the accuracy to work?
Thank you in advance for your precious time and help!
Cheers,
Leonardo
Hi Leonardo,
Like with
correct,
accuracy
is probably not computed automatically if you don't have a keyboard or a mouse item. So, you need to implement it yourself. The ingredients are:total_trials
, andtotal_correct
andaccuracy
(all to0
)inline_script
, you always incrementtotal_trials
by 1 (so essentially you count the number of trials), andtotal_correct
by 1 onlyif response == correct_response
inline_script
(or in a separate one after the loop), you can then compute the accuracy like so:accuracy = total_correct / total_trials
Does this make sense?
Eduard
Eduar thank you very much for your precious help!
I've done what you suggested but then I encountered a new error. SInce I entered the variable correct_response as a column in the table of the builder's loop, the variable was calling one value (one of the correct_response) at a time, and only when accidentally my response and the correct_response picked randomly by the loop where matching in that trial, the programme would add +1 to my total_correct! In that way, obviously, I wasn't able to get the correct accuracy value.
To solve this, I defined correct_response in the inline_script before the loop in terms of a list. This way I have been able, also by implementing your code, to get the correct accuracy and finally solve the problem.
Thank you again,
You have been very kind!
Cheers,
Leonardo
Eduar thank you very much for your precious help!
I've done what you suggested but then I encountered a new error. SInce I entered the variable correct_response as a column in the table of the builder's loop, the variable was calling one value (one of the correct_response) at a time, and only when accidentally my response and the correct_response picked randomly by the loop where matching in that trial, the programme would add +1 to my total_correct! In that way, obviously, I wasn't able to get the correct accuracy value.
To solve this, I defined correct_response in the inline_script before the loop in terms of a list. This way I have been able, also by implementing your code, to get the correct accuracy and finally solve the problem.
Thank you again,
You have been very kind!
Cheers,
Leonardo