Cedrus response box communication issues

283 views
Skip to first unread message

Michael Cohen

unread,
Dec 12, 2015, 7:23:31 PM12/12/15
to psychopy-users
Hi,
I've been trying to get a new fMRI study working with a PsychoPy Coder script, using a response box that pyxid identifies as a Cedrus RB-834.  (The actual manufacturer of this box appears to be MRA, although I'm not sure if that makes a difference.)

In testing out my scripts, I've run in to two strange problems. 

The first is that the box will work great for a while, but then at some point, it suddenly stops communicating with PsychoPy, and no more input comes in until I stop and reset the script.  The amount of time it takes before that happens is variable...but clearly for an MRI study, we don't want that to ever happen.  I did find an old thread asking about a similar issue, and the solution that Jon suggested was to download the pyxid library directly from Cedrus.  I haven't had a chance to test this out at the scanner yet, but since that thread was from over a year ago, I'm wondering if anybody has any more information about this issue (i.e., what works, what doesn't seem to help, etc.).

Another issue is that the communication between the response box and PsychoPy seems to be fairly reliable on a Mac (with the exception of the issue noted above), but on Windows, it's very sporadic.  Specifically, when running the pyxid.get_xid_devices() command, it seems to alternate between working and not working, every other time I try to communicate with the button box.  I can get around this by running it on my Mac, but it still seems worth seeing if there might be a solution to this.

Finally, this button box seems to have a number of different modes for communicating with the computer, including XID for SuperLab, and ASCII for Presentation.  Both of those seemed to work (although possibly the XID mode was a bit better, in terms of being less likely to fail sporadically).  Does anybody have insight as to which is actually best for communicating with PsychoPy through pyxid?

I can try asking some of these questions on the Cedrus forums as well, but since people at the scan center using other programs don't seem to be having problems with the response box, it also seems like they could be related to how the button box interfaces with PsychoPy, so I'm hoping somebody here might be able to help.

Best,
Michael

Jonathan Peirce

unread,
Dec 14, 2015, 7:45:53 AM12/14/15
to psychop...@googlegroups.com
I experienced the same crumbiness from the cedrus box when connected to a windows machine. Not sure which part to blame. The code produced by Builder gets around this by doing::

    for n in range(10): #Cedrus connection doesn't always work first time!
    try:
        devices = pyxid.get_xid_devices()
        core.wait(0.1)
        buttonBox = devices[0]
        break #once we found the device we can break the loop
    except:
        pass

That seems to work fairly reliably. My *guess* is that the other software packages do something similar which is why the users aren't noticing any problems.

cheers
Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/122b1f6a-75af-4c89-99da-2f90c5755bfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Andrey Chetverikov

unread,
Dec 14, 2015, 10:12:20 AM12/14/15
to psychopy-users
Hi Michael,

We've been using RB830  for some time and experienced similar issues. Take a look at this: https://github.com/cedrus-opensource/pyxid/issues/4 I'm not sure they ever fixed it. In addition, according to this https://github.com/cedrus-opensource/pyxid, "there is a known issue with clock drift in XID devices", and I was under impression that it's more related to firmware/hardware rather than particular python implementation (similar issues are discussed in Psychtoolbox help).

Best,
Andrey


воскресенье, 13 декабря 2015 г., 0:23:31 UTC пользователь Michael Cohen написал:

Michael Cohen

unread,
Dec 14, 2015, 11:56:31 AM12/14/15
to psychopy-users
Thanks, very good to know that these are known issues, and that there are (in theory) fixes for them.

But on the issue of the box suddenly not responding...  I found the original posting from two years ago on this list, and it seemed like both Cedrus and the PsychoPy developers seemed to declare it fixed based on the code contributed by Yaroslav Halchenko, and Jon mentioned then that the updated pyxid library would be included in the next release of PsychoPy.  So if I'm still having this problem two years later, does that mean that the fix didn't work?  Or did it somehow not get incorporated properly?  (I'm using the latest version, PsychoPy v1.83.) 

I'm looking at the code and having trouble figuring out for myself whether that fix was fully incorporated; and if it wasn't, I'm not entirely sure how I'd put it in.  Is there a way to find a version of pyxid that includes this "fix", assuming that it does actually reliably fix the issue?

I did also notice the point about clock drift, and I am seeing some differences in the timing between PsychoPy and the response box (although usually, if anything, the RTs from the response box are actually shorter than those from PsychoPy?)  In any case, I'm not as worried about that, since RTs aren't critical for my experiments.  But this other thing could be a bigger problem.

Thanks,
Michael

Jared Roberts

unread,
Dec 14, 2015, 4:20:12 PM12/14/15
to psychop...@googlegroups.com
Hi Michael,

I ran into a similar (perhaps the same) problem a few years back.  I was able to consistently replicate it by rapidly smashing multiple button simultaneously.  Basically what happens is that simultaneous key presses cause the serial connection to drop a few bits and pyxid tries to adjust for the missing bits, but it didn't work and the bits are off from that time forward messing up all of your button presses.  I lost 4 or 5 scans to the bug before I jumped into the pyxid code and fixed it myself.  I changed the code so that it would just flush the serial connection when it happened instead of trying to adjust.  They current response would be lost, but it wouldn't mess up the rest of the scan. The relevant commit is here: https://github.com/cedrus-opensource/pyxid/commit/ffe7b44f5639d76e18a4f468147d309c274f4042. We no longer use a Cedrus response box, so I don't know if the latest pyxid still includes the patch or not (or if this is even the same problem).

-Jared

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jared Roberts
Graduate Student
Neuroscience of Memory, Aging and Dementia Lab
Department of Neurobiology and Behavior
University of California, Irvine
"A lost cause can be as spiritually satisfying as a victory." - Robert Heinlein

Michael Cohen

unread,
Dec 14, 2015, 5:32:32 PM12/14/15
to psychopy-users
Thanks, that version does indeed seem to solve the problem on my Mac.

Also, Jon's code is working on the Windows computer (thanks for that, as well).

However, now I'm having one other issue: I can't find where the pyxid library is located on the Windows installation of PsychoPy, to use Jared's corrected pyxid script on that installation.  I'm looking under C:\Program Files\PsychoPy2\Lib\site-packages\ , but there doesn't seem to be a pyxid folder, the way there is in the analogous location on the Mac installation.  I've looked all over other folders in the PsychoPy directory, and can't seem to find it, nor is Windows search finding anything.  But it is clearly available to PsychoPy, so it must be getting it from somewhere.  Is there some other weird place where this library might live on the hard drive?

Thanks,
Michael

Michael Cohen

unread,
Dec 16, 2015, 6:43:10 PM12/16/15
to psychopy-users
Hi,
OK, in looking over this a little bit more, I happened upon something else: it seems like the version of pyxid included with PsychoPy v1.82 actually has code that matches the distinctive parts in Jared's code, which he linked to above.  The version of pyxid in PsychoPy v1.83 looks more like an older version of the pyxid library, specifically the v1.0 release of pyxid, dated 2011.  Is there some reason why the code was switched, or could this incorrect version have been included in the latest PsychoPy distribution by mistake?  If so, could you please compile a new update that includes the most current pyxid library?  

Thanks,
Michael

Jonathan Peirce

unread,
Dec 17, 2015, 11:58:32 AM12/17/15
to psychop...@googlegroups.com
On which platform is the wrong pyxid appearing?
Jon

For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk

Michael Cohen

unread,
Dec 17, 2015, 4:00:04 PM12/17/15
to psychopy-users
I noticed it on a Mac, and don't have an easy way to check the PC installation at the moment.  However, given that I had a similar problem on a PC as on the Mac, I'm guessing that it might affect both platforms.

Thanks,
Michael

Michael Cohen

unread,
Jan 6, 2016, 2:49:10 PM1/6/16
to psychopy-users
Hi,
I just wanted to bump up this thread to see if it would be possible to correct the problem with pyxid in the latest version of PsychoPy. 

Please just let me know if there is other information that would be helpful for you to have on this.

Thanks
Michael
Reply all
Reply to author
Forward
0 new messages