hello,
not sure if there is a weird thing going on, but i’m just trying to find the duration of a keypress from an in-person experiment created using the builder.
a keyboard is made in the routine (called response). the keyPress class is meant to have .name .rt .tDown and .duration methods to calculate (and return) these things, including the duration a button was pressed. I want to store this duration (interval reproduction task), but can’t access it at all. I can’t index it using the response.duration method which normally works when getting RTs. I thought this might be because the compiled code just doesnt store it, but even when i add in code to store this, it stores None
for example, if i do this in my code block:
print('first rt: ' + str(_response_allKeys[0].rt))
print('first key: ' + str(_response_allKeys[0].name))
print('first dur: ' + str(_response_allKeys[0].duration))
if len(response.keys) > 0:
firstkey = _response_allKeys[0]
intervals.addData('response.duration', firstkey.duration)
elif len(response.keys) == 0:
intervals.addData('response.duration', -999)
if i do this, the rt and name of they key that were pressed will get printed, but duration comes out as None
Is there a way of getting the duration of a keypress from within the builder (i.e. stored as part of the keyPress class output from the builder compiled code calling keyboard.getKeys() or is that not possible?
Thanks!