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!
Hardware:
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():
try:
ser =serial.Serial(device, 56700, timeout = 1)
ser.write('[t]\n')
ser.close()
except:
pass
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!