How to handle Cedrus (RV-740) button-box double responses

Hi Experts,

I have a function that presents pictures along with text, one after another (code below). I am using a Cedrus RV-740 button-box in order to collect participants’ responses. Strangely, the button-box generates two responses, and causes for stimuli within a list to skip (i.e., one response for down key and one response for up key). I thus came up with a temporary solution to double the picture stimuli (you can see them doubled in the list below, within the code).

def instexmpl(): # optimized
    key = 'r'
    txtlist = [i6, i6, i7, i7, i8, i8, i9, i9]
    piclist = ['Prac_Pos', 'Prac_Pos', 'Prac_Neg', 'Prac_Neg', 'Prac_Neut', 'Prac_Neut', 'Prac_defio','Prac_defio']
    for i, pic in zip(txtlist, piclist):
        txt = visual.TextStim(win, text = i, color = 'black', height = 20.1,pos = (0,0), wrapWidth = 1.5)
        pic = visual.ImageStim(win, image = stimpath + 'Prac_Examples/'+ pic + '.jpeg', pos = [0,0])
        response = {}
        while not dev.has_response():

My question is whether it might be possible to only count the down-press of the button box.

Below is the code output for the button-box presses as printed by the code above:

{'port': 0, 'pressed': True, 'key': 0, 'time': 5210}
{'port': 0, 'pressed': False, 'key': 0, 'time': 5289}
{'port': 0, 'pressed': True, 'key': 0, 'time': 6472}
{'port': 0, 'pressed': False, 'key': 0, 'time': 6598}
{'port': 0, 'pressed': True, 'key': 0, 'time': 7357}
{'port': 0, 'pressed': False, 'key': 0, 'time': 7494}
{'port': 0, 'pressed': True, 'key': 3, 'time': 9207}
{'port': 0, 'pressed': False, 'key': 3, 'time': 9347}

I tried tweaking the while-loop in various ways but nothing worked. I also tried tried using core.wait function to halt input for a second, but the next stimuli still skips.

One idea I had was appending a data dictionary, and capturing only the first addition, but this doesn’t seem to work quickly enough (ie the button box signal is sent quicker).

Relevant post was raised here (note that other packages do not work with this model):

Also relevant, someone indicated that this might be a problem with psychopy, but this was many years ago (link below). Wondering if this was fixed.

I would love to hear any ideas for approaching this problem.

Much appreciated,

Hello Arkadiy,

The button-box generating two responses is a feature, not a bug. :grinning: Some researchers need the key offset in addition to the onset.

The two links that you mention both reference the original pyxid library. This has now been superseded by pyxid2, which ships with PsychoPy.

You shouldn’t need to double the picture stimuli to make it work. I’m sure there is a simpler solution. I’ll email you to arrange for a Zoom meeting.


1 Like

Hi Hisham,

Thank you for the quick response and the meeting. As we discussed, I will look forward to the updated code.

Best wishes,