[open] Displaying Error Feedback with 'Swipe Stimuli' on Android
Hello,
I have an experiment that involves 'swiping' stimuli up and down the screen (an image is presented, and the individual then either swipes it towards or away from them), however I want to make this blocked instead of free-response - thus there will be incorrect/error feedback. However, I'm not entirely sure how to do this seeing as the image is being swiped, so it is the end location that needs to provide the feedback of whether it was an error or not (as well as whether it was too slow).
from openexp.mouse import mouse
from openexp.canvas import canvas
my_mouse = mouse(exp)
my_canvas = canvas(exp)
path = exp.get_file(u'NEM4.png')
upper = exp.get("height") - 200
lower = 200
my_canvas.image(path)
trialstart = my_canvas.show()
button, position, movstart = my_mouse.get_click(timeout=None)
exp.set ("position_NEM4", position)
while True:
pos, time = my_mouse.get_pos()
my_canvas.clear()
my_canvas.image(path, x=pos[0], y=pos[1])
timestamp = my_canvas.show()
if pos[1] < lower:
response = "top"
break
if pos[1] > upper:
response = "bottom"
break
# calculate the movement time
movtime = timestamp - movstart
# calculate the RT
resptime = movstart - trialstart
exp.set("response_NEM4", response)
exp.set("movetime_NEM4", movtime)
exp.set("reponse_time_NEM4", resptime)
Thanks!
Comments
Hey,
I don't really understand the problem. When exactly do you want to present the feedback? During the movement, or after it is done? From what I get so far, your situation is not much different than in a regular experiment.
Would you mind helping me out here?
Eduard
Hi Eduard,
I would like the feedback to be presented if the image is swiped in the wrong direction (there is a sketchpad item before each image telling the participant which way to swipe), which I thought could be done by importing another sketchpad item to the script when it's the wrong way?
Also, there needs to be feedback if the response time is too short or too long, however I'm not entirely sure how to do this.
So basically, for the former, the feedback would be after the movement is done (i.e. if the response is incorrect) and the latter would be before the movement if it is too slow and after if it was too quick, if that makes any more sense?
Thanks!
Hi,
Assuming that you have a variable that codes the correct response, this code here (adapted from the one you posted) should do what you want.
As you can see I added another
while
loop to make it work. Can you try the code and let me know whether it does what it supposed to do?Thanks,
Eduard
Whereabouts should I be defining the correct response? Is it in this bit:
or
The correct response for example would be 'bottom'.
Thanks for your help.
Rather the first than the second, in best case even earlier. Like you said, a
sketchpad
informs the subjects which direction is the correct one. I suppose this direction is not constant but can change over trials. Therefore, you would have to have a variable, whose value is updated on every trial and defines the direction. This variable (if it has the valuesbottom
andtop
) you can use as correct response variable.The typical approach is to define for every unique trial the respective correct response in the
loop table
. If you did so, you can retrieve those values with the commandexp.get(variable)
.Does this make sense?
Eduard