TMS stimulation during video stimulus

Hello,

I’m using PsychoPy to make an experiment that consists of a series of videos (each video/stimulus lasts 15 s). These videos show an actor performing an action. I want to add the TMS stimulation during a specific temporal interval ranging, for example, from 5 to 10 s after stimulus onset, so that a single TMS pulse will be given randomly within this temporal interval during the video.

I’m not sure what I should write in the “start” and “stop” options of the parallel port properties, since I want the timing of the trigger to be random in a specific temporal interval.

I hope my question makes sense, it’s the first time I’m creating a TMS experiment.

Thanks in advance.

You could create a variable in a Begin Routine code tab and use that. Test it by adding a text component with the same start and duration

tmsStart = randint(5,11)
thisExp.addData(‘TMS Start’,tmsStart)

I’m sorry I’m not sure I understand what you mean (I’m completely new to Python language).
Could you please explain what these two code lines mean?
Do I have to add the code component above the movie one? And how exactly can I test it with a text component?

The first line sets a variable called tmsStart as a random integer at least 5 and less than 11. The second line adds it to the data file. Code components should go at the top of the routine unless you have a good reason to do otherwise. Set the start time of a text component as tmsStart

It works! Thank you so much for your help.
Now the text appears randomly in the interval between 5-11 s, however, I can’t figure out how to make the whole component last 15 s. I set the duration at 15 s, but it lasts more.

Duration should be 15 - tmsStart

It works perfectly!
Thank you very much for all the help! :smiling_face: