Sync Pulse Emulator: Timing of Sync Pulse Onset

Version 1.80.03 (I cannot update it for several reasons).

I am building an fMRI experiment and am attempting to test the timing using a launchScan sync pulse emulator.

Method Outlined on this page: http://www.psychopy.org/api/hardware/emulator.html.
Code Added to Current Script: https://github.com/psychopy/psychopy/blob/master/psychopy/demos/coder/experiment%20control/fMRI_launchScan.py#L71.

However, when I run my script, the sync pulses start immediately. Meanwhile, It takes a few seconds to enter the subject number and start the experiment. Meaning, the sync pulses will start before I get the experiment running. Is there a way to either 1) hold off on the onset of the sync pulses for a few seconds, or 2) sync the start of the experiment with the start of the sync pulses?

Hi Jenny, I’m not really familiar with this, but it seems like the key line from that script is this:

vol = launchScan(win, MR_settings, globalClock=globalClock)

Don’t execute that until you are ready to handle the pulses.

Thank you! I guess I need to figure out how to delay a line in python.

It’s not really a matter of “delaying” a line, but just putting it in your script after the stuff about entering the subject number and so on. If the experiment is a script you’ve written yourself, that should be straightforward.

But are you actually talking about a custom-written script, or are you working with a Builder -generated experiment?

It’s in the coder. It’s partially a script I made myself, and partially a script that from the PsychoPy website that was modified to suit my code.

I’m new to coding, so I’m not 100% on how to solve little problems like this just yet. Thanks for the tip! I will try that.

Sure. Don’t be afraid to post some code here for more specific guidance if you get stuck.

I have been having a similar problem. I used the builder to code my task and used the launchScan code, but it seems to be starting the task before the pulse is even sent. Where do you recommend adding the launchScan code?