| Reference | Downloads | Github

Triggering scan from launchscan() -- trouble with sync key

Hi all!

This is my first time using Psychopy, so I apologize for any oversights! I have been having trouble triggering an fMRI task from Psychopy using the LaunchScan() function. The issue I’m running into is that the character which our scanner recieves to start the scan is “[t]”, which does not translate easily the way “=” translates to ‘equals’ or “/” translates to ‘slash’ in the documentation. So far, I have only been able to trigger the scanner by sending the character “[t]” directly to USB port to the scanner, using the serial module. I’ve tried many iterations of ‘sync’ : ‘t’, ‘[t]’, ‘"[t]"’, ‘bracketleft’, ‘bracketleft + t + bracketright’, etc to no avail. While it’s not a big deal to trigger using serial, I’d love to be able to take advantage of the timing features of launchscan(). Thank you for any and all advice!

I’m running this script in Psychopy 2, on a MacBook Pro running High Sierra.

Code for serial trigger workaround:

import serial 
import time
device = '/dev/tty.usbmodem12341'
def trigger():
          ser =serial.Serial(device, 56700, timeout = 1)

Then to launch the scan, I just call trigger().

Code for launchscan() function:

MR_settings = {
     'TR': 2.0000
     'volumes': 200
     'sync': '[t]\n' #NOTE this does not work
     'skip': 0

Then to call this function, I would call launchscan(win, MR_settings, clock, etc). Thank you all!

Unless I’m misunderstanding, what you are referring to seems different to how an fMRI task would usually be triggered. Typically, the scanner sends a trigger - but it sounds like you send a trigger to the scanner?

1 Like

As per Damien above, the MRI usually tells you when it is starting, you don’t tell it. And in fact the documentation for launchscan() makes it clear:

i.e. that this function waits to receive a signal: it isn’t sending one. The sync parameter tells the function what characters to wait for (i.e. it will ignore anything else).

1 Like

Thank you both very much! Somehow I missed this crucial point, but it makes much more sense that way. Cheers!