Psychopy and TMS

271 views
Skip to first unread message

Byurakn Ishkhanyan

unread,
Apr 21, 2016, 4:56:45 AM4/21/16
to psychopy-users
Hi everyone,

Does anyone know how to send triggers from Psychopy to the TMS stimulator?

My script is working (the usual parallel port problem is solved). With the parallel port the Psychopy computer is connected to a Signal computer, which in turn sends the triggers to a TMS stimulator. The connections are correct (the stimulator stimulates when we mechanically touch the parallel port), so the problem must be in Psychopy. Does anyone have an idea what the issue could be?

I am using builder mode in 64 bit Windows 7.

This is the code I have in the code component:

from psychopy import parallel
parallel.setPortAddress(0x0378)

Thank you for your help in advance.

Regards,
Byurakn

Richard Höchenberger

unread,
May 5, 2016, 6:17:27 PM5/5/16
to psychopy-users
Hi Byurakn,
do you still need assistance here?

Richard

Byurakn Ishkhanyan

unread,
May 5, 2016, 6:24:41 PM5/5/16
to psychop...@googlegroups.com

Hi Richard,

Yes, I do.
Thanks!

Byurakn

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAGm-8jNajGApsnnN0cmikJD5t7Y2YytWKGRQ8ncxNrKS0toa8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Richard Höchenberger

unread,
May 5, 2016, 6:27:53 PM5/5/16
to psychopy-users
All right, so you were stating that "[your] script is working (the
usual parallel port problem is solved)." What exactly does that mean,
how did you verify that PsychoPy is actually accessing the parallel
port correctly?

Richard

Byurakn Ishkhanyan

unread,
May 5, 2016, 6:45:18 PM5/5/16
to psychop...@googlegroups.com

In the beginning I got an error when trying to run the script and I googled to find out that it was a common issue. I installed the .dll files and the script started working. I am not sure though if Psychopy is accessing the parallel port correctly (probably it doesn't). I've tried all the three parallel port addresses the computer has (0xD020, 0xD030 and 0×D050) but neither was able to send the trigger, so I'm thinking there should be some other problem.

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

Richard Höchenberger

unread,
May 5, 2016, 6:56:03 PM5/5/16
to psychopy-users
Does your computer actually have three parallel ports?

Have you tried placing the inpout32.dll in the same folder as your
PsychoPy script?

Does the Signal computer report which pins on the parallel input are
set to high/low at any time?

Richard Höchenberger

unread,
May 5, 2016, 6:58:02 PM5/5/16
to psychopy-users
Oh, and: What code do you use to actually send the triggers?

Byurakn Ishkhanyan

unread,
May 5, 2016, 7:00:24 PM5/5/16
to psychop...@googlegroups.com

Yes, the inpout32.dll is in the same folder (the script didn't work without it).
As for the Signal computer, I haven't checked it. How do I do it?

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

Richard Höchenberger

unread,
May 5, 2016, 7:21:13 PM5/5/16
to psychopy-users
On Fri, May 6, 2016 at 1:00 AM, Byurakn Ishkhanyan <byur...@gmail.com> wrote:
> As for the Signal computer, I haven't checked it. How do I do it?

I wouldn't know :) I thought maybe it has a display that can be used
to easily tell which pins are set to high/low, which we could abuse as
a parallel port tester.

What command(s) do you use to send the actual triggers?

Jonathan Peirce

unread,
May 6, 2016, 7:05:52 AM5/6/16
to psychop...@googlegroups.com
I wonder why you needed to put inpout32 into the script folder. You should have been able to install it as a driver and leave it wherever it was installed
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.

-- 
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.

Richard Höchenberger

unread,
May 6, 2016, 7:11:11 AM5/6/16
to psychopy-users
On Fri, May 6, 2016 at 1:05 PM, Jonathan Peirce <jon.p...@gmail.com> wrote:
> I wonder why you needed to put inpout32 into the script folder. You should
> have been able to install it as a driver and leave it wherever it was
> installed

I realized it's often easier to simply place it in the script folder
than to find the correct windows system folder :) (system32/wow64
confusion, anyone?) :D

Byurakn Ishkhanyan

unread,
May 6, 2016, 7:43:31 AM5/6/16
to psychop...@googlegroups.com

Hi Richard,

I guess in order to give accurate answers to your questions I need to be in the lab to have access to the code and everything. I'll do it next week. Thanks a lot for your help!

Jonathan, there was no way of making the script work. Then somewhere in this group I read someone suggesting to put inpout32.dll in the same folder. When I did it, I stopped receiving the error message.

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

Byurakn Ishkhanyan

unread,
May 11, 2016, 9:42:39 AM5/11/16
to psychopy-users
Hi Richard,

Thanks again for your help. In order to send the triggers, I'm using a p-port component and a code component in builder mode. You can find the screenshots of the parameters and the code attached. I will try to figure out if I can find the pins set to high/low on the Signal computer.
code component.jpg
p_port.jpg

Byurakn Ishkhanyan

unread,
May 11, 2016, 9:56:10 AM5/11/16
to psychopy-users
The parallel port cable from the PsychoPy computer is connected to the CED (which in turn is connected to the Signal computer) via a BNC connector. Could there be a mistake here? (although again, the connections seem to work because everytime I mehcanically touch the parallel port, the triggers are sent to the Signal computer, which in turn sends them to the TMS stimulator. The issue is that it doesn't work when the experiment is running). I couldn't find any pin information on the Signal software. 


On Friday, May 6, 2016 at 1:11:11 PM UTC+2, Richard Höchenberger wrote:

Richard Höchenberger

unread,
May 11, 2016, 10:42:21 AM5/11/16
to psychopy-users
Hi Byurakn,

I think I've been using some kind of (Python-based??) parallel port
tester a while back, which also used inpout32; it can be used to
manually set certain pins to high and low on the PsychoPy computer. If
this indeed produces TMS triggers, then we know for sure that your
computer can indeed access the parallel port correctly, and that the
problem(s) must be in PsychoPy or your code somewhere. I will try to
find out which software I used, and will get back to you tomorrow or
Friday.

EDIT:
Just googled, and I think THIS is the software I used:
http://www.downtowndougbrown.com/2013/06/parallel-port-tester/
Had to place inpout32.dll in the same folder as the executable. See if
it works for you (and get any binaries check at virustotal.com before
actually executing them ;))

Cheers,

Richard

Byurakn Ishkhanyan

unread,
May 11, 2016, 11:02:16 AM5/11/16
to psychop...@googlegroups.com
Hi Richard,

Thanks! I did as you told me and the attached picture is what I get. 



--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, 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.



--
Բյուրակն Իշխանյան
Parallel Port Tester.jpg

Richard Höchenberger

unread,
May 12, 2016, 2:14:16 AM5/12/16
to psychopy-users
Hi,

On Wed, May 11, 2016 at 5:02 PM, Byurakn Ishkhanyan <byur...@gmail.com> wrote:
> Thanks! I did as you told me and the attached picture is what I get.

so the parallel port tester is not working on your computer. I wouldn't know how to fix that.

I don't know of any other software to easily set parallel port pins to high and low on Windows, and I am very reluctant (read: unwilling) to proceed looking into your PsychoPy code as long as we don't even know whether your parallel port is functioning properly at all. These things are a pain to debug remotely. Please ask a tech-savvy person in your lab to assist you with that basic verification. :)

Parallel ports in general are an ancient legacy from the last century. I hope they will disappear soon, as they're causing nothing but trouble with modern computers. If you have the money, I would strongly suggest to get something like a LabJack to replace your parallel port. Will save you lots of time and nerves.

All the best,

    Richard

Richard Höchenberger

unread,
May 21, 2016, 4:14:30 PM5/21/16
to psychopy-users
Hello Byurakn,
have you been able to make any progress on this issue?

Cheers,

    Richard

Byurakn Ishkhanyan

unread,
May 22, 2016, 5:19:58 PM5/22/16
to psychop...@googlegroups.com
Hi Richard,

unfortunately, no progress. I have asked the engineers to help me but they couldn't find the issue. So we will probably convert the experiment to some other language.

Byurakn

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/LizHkvEIMgM/unsubscribe.
To unsubscribe from this group and all its topics, 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.



--
Բյուրակն Իշխանյան

Richard Höchenberger

unread,
May 23, 2016, 6:53:33 PM5/23/16
to psychopy-users
Hi Byurakn,

On Sun, May 22, 2016 at 11:19 PM, Byurakn Ishkhanyan <byur...@gmail.com> wrote:
> I have asked the engineers to help me but they couldn't find the issue. So
> we will probably convert the experiment to some other language.

oh, that's very unfortunate :( But parallel ports can be really
annoying! Like I said, they're legacy interfaces, and one should keep
in mind that the support is declining. Parallel port support has also
been marked as deprecated in Matlab's Data Acquisition Toolbox many
years ago already (don't know if it has even been removed meanwhile)
-- and that's in a hugely successful commercial product! The struggle is
most often just not worth it: upgrade to some present-day hardware if
you can.

All the best,

Richard

Oliver Clark

unread,
May 24, 2016, 6:52:35 AM5/24/16
to psychopy-users
There are some quite good parallel to USB converters available.  For instance the Black Box Toolkit USB TTL adapter installs as a com-port which you can access with serial.Serial().  Had success using this to send signals to a BIOPAC MP36.  They're around £200 and would save you having to upgrade the whole system

Richard Höchenberger

unread,
May 24, 2016, 7:10:32 AM5/24/16
to psychopy-users
On Tue, May 24, 2016 at 12:52 PM, 'Oliver Clark' via psychopy-users
<psychop...@googlegroups.com> wrote:
> There are some quite good parallel to USB converters available. For
> instance the Black Box Toolkit USB TTL adapter installs as a com-port which
> you can access with serial.Serial(). Had success using this to send signals
> to a BIOPAC MP36. They're around £200 and would save you having to upgrade
> the whole system

Nice, didn't know about these. There's also the LabJack products,
https://labjack.com/products

I personally prefer National Instruments DAQ boards, but they are
usually much more expensive. They can be controlled from within Python
via PyLibNIDAQmx: https://github.com/pearu/pylibnidaqmx

Best,

Richard
Reply all
Reply to author
Forward
0 new messages