Trigger signal inaccuracies

OS: MacOS Ventura Version 13.3.1 (Processor: Apple M1 (2020))
OS: Win10 Pro (Processor: 12th Gen Intel(R) Core i7-1265U 2.70GHz)
PsychoPy version (e.g. 1.84.x): Psychopy v.2022.2.5
**Standard Standalone?: **yes
What are you trying to achieve?: We want to send trigger signals from PsychoPy to a MEG system via StimTracker (manufacturer Cedrus). Following code is used to send trigger signals:
###Section for setting up StimTracker###
import pyxid2 as pyxid #import usb driver
import time

devices = pyxid.get_xid_devices()
dev = devices[0]
dev.reset_base_timer()
dev.reset_rt_timer()

###Section for sending trigger signals###
dev.set_pulse_duration(10) #define trigger duration to 10ms
dev.activate_line(lines=[1,4]) #send the trigger signal to line 1 and 4

time.sleep(0.01) #wait until the 10ms trigger signal is executed

time.sleep(0.01) # interval of 10ms between trigger signals

Note: ftd2xx (version: 1.4.24) is used to directly access from computer to StimTracker through DLL for MacBook Pro.

Upon inspecting the actual trigger signals generated using an oscilloscope, we saw both variations in time taken for sending trigger signals and interval duration between trigger signals.

What did you try to make it work?:
We suspected that OS might be a reason for the inaccuracies, so we ran the script on Windows. Furthermore, since the MacBook Pro uses a USB hub to connect to StimTracker, we also tested whether removing the USB hub solves the issue on the Windows computer.

What specifically went wrong when you tried that?:
We found the millisecond inaccuracies in all three cases (on macOS, Windows 10 pro, and Windows 10 Pro with USB hub). This inaccuracy is problematic since these errors accumulate for each trial which results in significant variation in trigger timing.




Hi, maybe this is helpful for you, but is applied for EEG signals. I had pretty much the same problem when I was validating my experiment. I learned this:

  • You need a dedicated graphic card when you are working with visual stimuli. I’m not sure if this is your case.

  • In Windows, you need to set real-time processing for Python in the task manager (this was critical in my case) to avoid jitter completely.

  • Send triggers using the function callOnFlip to synchronize drawing new elements.

  • I tried with macos Ventura in m1 2020 (touchbar version), but I couldn´t solve it.

Hope this is helpful, and if you found a way to do it on macos I would appreciate the advice.

To try and get more sense of what’s going on here can you add some additional details?

What is your MEG system? Do you have a Cedrus M-pod? Do you have a StimTracker Duo or Quad?

What will you eventually use for your stimuli? Are they visual, auditory, or something else? What’s your setup for presenting these to a participant? Projector? What brand?

It’s not terribly surprising that you’re getting variability in your triggers and interval durations. Could be a number of factors. Are you using built-in Python versions? Anaconda? Are there any other things running on the system?

What’s likely a better measure is the reliability of the offset = difference of when you send the trigger and when your stimulus actually happens. My impression of the Cedus system is that it is supposed to do exactly this.