Thread Tools  
mcohen1
Junior Member
 
Join Date: Dec 2015
mcohen1 is on a distinguished road Posts: 2
Hi,
I have been trying to get a new fMRI study working with PsychoPy and a Cedrus response pad (via the Cedrus pyxid library). The scanner has an MRA response box that pyxid identifies as a Cedrus RB-834. 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, so I'd like to figure out what's causing this.

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, since using a Mac may not always be an option.

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). Can you clarify which is actually best for communicating with PsychoPy through pyxid?

I should also note that people using other programs don't seem to be having these issues with the button box, and they're also happening at such a basic level that I don't think my PsychoPy script is the problem; thus, it seems like the glitches are probably in the pyxid library. So any help that you would be able to provide would be really helpful.

Best,
Michael
Reply With Quote
Hisham
Founder
 
Join Date: Aug 2006
Location: San Pedro, CA
Hisham is on a distinguished road Posts: 1,138
Posted December 15th, 2015 #2
There is a side effect with the pyxid library that is documented on GitHub, which is that the timer stops after about 4 hours and pyxid will stop reporting keypresses. The solution is simple, if thatís the issue: send a command to reset the built-in timer at least once every four hours.

See also the pyxid read me file.

pyxid can be used with the response pad only in XID mode. If you want to use another, simpler mode like ASCII, then you want to consider using pyserial instead and use it to simply open the serial port and wait for a single byte to arrive on the port, then close the port when youíre done at the end of the experiment.
Reply With Quote
mcohen1
Junior Member
 
Join Date: Dec 2015
mcohen1 is on a distinguished road Posts: 2
Posted December 16th, 2015 #3
Hi,
Thanks for the reply. As it turns out, I'm pretty sure that the issue you indicated isn't the problem, as I do reset the base timer at the top of my script, and my test run lasts much less than 4 hours. Instead, with further troubleshooting, it's looking like the real problem is a different issue that has been documented on GitHub (https://github.com/cedrus-opensource/pyxid/issues/4). When I replaced the version of pyxid that is distributed with PsychoPy v1.83 with the one found at https://github.com/cedrus-opensource...7d309c274f4042 , I think the problem is resolved.

I'm a little bit confused because what's available online says that pyxid and PsychoPy were already updated two years ago to address this problem. And in fact, both the version of pyxid included with PsychoPy v1.82, and the version of pyxid currently listed as most recent on GitHub, both seem to include a version of the key code snippets in the above linked version. But the pyxid library in PsychoPy v.1.83 seems to be different, and the relevant code there matches the code from the v1.0 version of the library, released in 2011. I've attached here the internal.py file from the pyxid library included with PsychoPy v1.83 (with .txt added to go around the file type filters on this message board); could you confirm whether this is in fact an old version, or what the issue is? If so, I'd say it looks like this old version of pyxid was mistakenly included with the new version of PsychoPy.

Finally, thanks for the explanation about XID vs. ASCII response modes, that is helpful.

Best,
Michael
Attached Files
File Type: txt internal.py.txt (6.5 KB, 3 views)
Reply With Quote
Eugene
Developer
 
Join Date: Jun 2011
Eugene is on a distinguished road Posts: 1
Posted December 17th, 2015 #4
Thank you very much for looking into this and attaching the file!

It indeed matches a version of that file back from 2011, so that appears to be the issue. Someone over at PsychoPy should probably be notified of this, so the problem can be fixed in the next release.
Reply With Quote
Tags
fmri, psychopy, pyxid, windows
Thread Tools
Posting Rules
Forum Jump:
© Copyright Cedrus Corporation, 1991-2014.
All times are GMT -7. The time now is 06:55 PM.