How to use PsychoPy Builder to create a TMS experiment?

If this template helps then use it. If not then just delete and start from scratch.

OS Win10
PsychoPy version 1.90.2
Standard Standalone? (y/n) yes
What are you trying to achieve?:
I have built a behavioral experiment. the procedure is in the attachment. I want to add the TMS stimulation at the onset of the second image and end the offset of the second image.
So how to use the parallel port component? could you give me a template?

Because I am a novice. I hope the answer can be more detail.

Hi, maybe you could read the documentation and specify your question more precisely? What exactly don’t you know / doesn’t work as expected?

Thanks for your reply!

the first picture is one trial in my experiment.
I have looked the document, I am not sure that it is right about the position of p_port?
I want to add the TMS simulation in the onset of imagetarget and end the offset of it.

the second picture is my setting about the p_port, but I am not sure it’s right?
and I don’t know how to set the start data and stop data.

Do you understand my question?

Thanks for the more concrete questions. We could not have known what the problem was.

In the p_port component, you need to set the Start to condition (not time(s)) because you have entered a condition (fx2 component is finished) instead of a time point.
In Stop data $, you can enter any number between 0-255. It’s the value that the parallel port sends. For example, you would see this number as a trigger on an EEG computer. Maybe your TMS machine needs a particular value (you could check its manual).

ok, thank you very much.
I will find the manual.
Is the position of p_port right?
The Start data is filled out 1?

If imagetarget starts when fx2 is finished in your paradigm, then the p_port position is correct, yes. To make the timing of the trigger more transparent, you could also set the Start of p_port to condition and enter $imagetarget.status==STARTED.

With the code above, the parallel port sends 1 when the target image starts and 0 again when it stops. Now you need to get your TMS machine to interpret this information correctly.

1 Like

OK, thank you very much!

Hi, just wanted to add that I don’t think that I could provide any further assistance (since you asked in the other thread) than what is already discussed here.

Were you able to fire the parallel port at all?

Hey, I hope you can provided your solution about it.
or you can send your program. I want to learn more.
Because I haven’t get the best way to deal with it.

Thank you very much!

Well my script is very different, mainly because I used to TMS devices firing at different times.
In particular, I had fixed timing (s), and the “Start data” field pointed to a text file with a column listing specific values based on the TMS setup (in my case, “0” for no TMS, “64” for TMS device 1, “128” for TMS device 2).
This was necessary since both TMS devices were fully controlled by the experimental task, but via a single parallel port.
Therefore, different “Start data” would activate different pins on the port, which in turn would activate either TMS 1 or TMS 2.

Hey, Thank you so much for tell me the details. Do you mean you use a different number to control the TMS devices?
Then you have three conditions.
Can you tell me the model of your TMS machine?
Our TMS was delivered using a PowerMag 100 Research Stimulator (MES Forschungssysteme GmbH). Neuronavigation was carried out using a PowerMag View (MES Medizintechnik GmbH) Neuronavigation system.
and the system’s language is German, Do you have some manual about the operation about the TMS machine in English?
If you have, I hope you can share them with me, my email address is lichenglin105@gmail.com.

Hello, we are doing something very similar at our lab. Thinking of using MagPy package. We are having trouble understanding the hardware requirements and what’s needed to physically send the signal from the computer with the task to the MagStim. Any info is appreciated!

Hi,

I want to ask if this issue has been solved. We have exactly the same problem. @chenglin_li Do you have any suggestions or what’s your reaction to this?
Any information is really appreciated!

Many thanks,
Mao

Hi Mao,

I solved this problem three years ago.
first, you should check whether you have the inpout32.dll or inpoutx64.dll file on your PC.

second, write a few lines (see the below) when you want to trigger TMS.

PS, you should be careful the version of your PychoPy. the version I used is PychoPy2 (v1.84…2). If you use PychoPy 3, it should be much easy to solve this problem.
Good luck.

Bests,
Chenglin

TMS pulse ----------------------------

pport.setData(255) #sets all pins high
core.wait(0.01)
pport.setData(0)   #sets all pins low

Hi Chenglin,

thanks for responding so quickly and being so accurate on this question. By the way, how do you control the intensity of the TMS pulse? I also use the PowerMag TMS EEG system (MAG & More - Transcranial magnetic stimulation - TMS | PowerMAG EEG 100).

Many thanks,
Mao

Hi Mao,
there should be a button on the frontal surface to adjust the intensity if I remember correctly.

Bests,
Chenglin

Chang-Mao Chao via PsychoPy <notifications@psychopy.discoursemail.com> 于2022年11月4日周五 23:07写道: