Sending Triggers via LSL
Hello all,
I have been working to try to sync triggers to a NIRx NIRSport system via Lab Streaming Layer.
I have initialized my experiment with an in-line script using the following lines
from pylsl import StreamInfo, StreamOutlet # import required classes info = StreamInfo(name='TriggerStream', type='Markers', channel_count=1, channel_format='int32', source_id='Example') # sets variables for object info outlet = StreamOutlet(info) # initialize stream.
This code works perfectly in PsychoPy, and does actually connect my device to the recording software. I am able to verify this on the other end, so I am hesitant to believe I am missing any libraries or have miscoded anything.
I then add an additional in-line script with the following code
outlet.push_sample(x=[1])
to send the trigger.
Strangely, if I highly only the outlet.push_sample(x=[1]) the trigger sends perfectly. But when the experiment is run, the triggers seem to be passed directly over. The fact that I can send the triggers by directly calling the code, again leads me to believe the script at least has no errors, I am wondering if there is something in the pipeline itself that I am failing to include.
I have worked to simplify my experiment to use no loops, and only initializes, verifies the connection, and sends the trigger, yet no triggers are sent.
Does anyone have experience, or even better a sample script using LSL?
I appreciate all the help that I could get.
Comments
Hi,
I don't have any experience with lab streaming layer, but since you say that the triggers are, at least in some cases, sent, this suggests that there's something wrong with the logic of the experiment, and not with the trigger code per se. Why don't you start by adding a
print()
at each place where something important is done? And then check the debug window to see if thatprint()
command is at least executed. If it is, then at least you're sure that relevant code is executed, and take it from there.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!