jspsych / jsPsych

Create behavioral experiments in a browser using JavaScript
http://www.jspsych.org
MIT License
1.05k stars 679 forks source link

jsPysch and Triggers - Lab Streaming Layer #2275

Open FedericoCurzel opened 3 years ago

FedericoCurzel commented 3 years ago

Hi jsPsych community,

In my next experiment, I would need to use jsPysch in the lab and to send triggers from it to a/multiple software/s of a neuroimaging/physiological system/s. (e.g. OxySoft, ...) I thought about Lab Streaming Layer (LSL) and I tried also to use "jsPsychHardware" [https://github.com/rivasd/jsPsychHardware], but I couldn't find a solution yet.

Did anyone face the same problems? Or have you some ideas about how I could find a solution?

Thanks in advance!!

Federico Curzel

jodeleeuw commented 3 years ago

Hi @FedericoCurzel,

We're actually working on solving this exact issue with LSL in my lab right now. I'm hoping to have a solution ready by mid January at the latest, when I need to teach my next EEG class 😁

FedericoCurzel commented 3 years ago

Hi @jodeleeuw ,

Thank you very much for your quick answer! It's great that you're working on the same thing! I feel less lonely :relaxed: I am trying everything in order to continue to use jsPsych also in the lab after the really good experience using it online.

I need to run some pilots with fNIRS and Skin Conductance before December, so I will continue to try to find easier solutions and I'll keep you posted if I find something interesting. If I won't find anything I'll do manual triggering waiting for you :)

Thanks for your work!

jodeleeuw commented 3 years ago

Depending on your setup, @jeti182's Trigger Handler package might work. We are working on adding LSL support directly to this via a fork (and hopefully a merge!).

FedericoCurzel commented 3 years ago

I will check it! Thanks!

jodeleeuw commented 3 years ago

Hi @FedericoCurzel

I wanted to update that it turns out the best short-term solution for our internal EEG system is to add TCP events to the trigger handler package, so we probably won't be adding LSL support in the near term. Still something that I would like to do eventually, but it's not on the priority list anymore.

nortcele commented 3 years ago

Hi @FedericoCurzel,

I tested a working configuration with jsPsych sending LSL markers via a LSL proxy. More informations and code available at Sending Lab Streaming Layer Markers with jsPsych.

prashantig25 commented 3 years ago

Hi @nortcele,

Thank you for sharing your version of LSL proxy for jsPsych. However, I am trying to send markers to the SR eye-link eye-tracker. But I believe that the python code sends the markers oxy-soft eye tracker software. Could you let me know how can I do that? What do I change to accommodate the same. Thank you.

Sincerely, Prashanti

prashantig25 commented 3 years ago

Hi @nortcele,

Just to give more context on my experimental set-up, I present the jsPsych experiment on a display PC. The display PC is connected to the eye-link host PC via a LAN cable. So I implemented all the steps according to your instructions. But, I am a little confused as to on which computer I am to run LabRecorder. Currently, I run it on the display PC (where I also run the jsPsych task) but your instructions state that the labrecorder must be run on the second computer. However, I won't be able to run it on the host PC as that is connected to the eye-tracker. Any guidance in this matter would be really helpful. Thank you.

Sincerely, Prashanti

nortcele commented 3 years ago

Hi Prashanti,

LSL is a way to send/receive data with timing information using ethernet connexion. All LSL devices should be connected to ethernet. Data could be data acquired by a device, data produced by a presentation software and LSL could transport many type of data (sound, video, eeg, rmn, triggers, markers…). In general there could be many devices that act as data providers and a computer with a data acquisition software is used to record the data.

The LSL proxy is used to send a LSL stream to a LSL compatible data acquisition software. In my case the source is a computer running a jspsych presentation and the target is Oxysoft on another computer. The type of LSL data sent is markers that will be associated with the data acquired by the software (eye tracking movements).

LabRecorder is a LSL data acquisition I used for tests. It records informations transmitted via LSL. AudioCapture capture is a LSL data acquisition sofware I also used for tests. It captures audio signal from the microphone of a computer and stream the captured data with LSL.

A first test with LSL could be made with one machine. Launch AudioCapture, give a name to the stream where the captured audio will be streamed and click the "Link" button. Then launch the LabRecorder application. In the "Record from Streams" part, the AudioCapture stream should be shown and you could select and start recording.

A second test could be made with LabRecorder on another computer. As for the first test, launch AudioCapture on the first computer, give a name to the stream where the captured audio will be streamed and click the "Link button. Then launch the LabRecorder application on the second computer. In the "Record from Streams" part, the AudioCapture stream should be shown and you could select and start recording. If the audio stream doesn't appear in the stream list of LabRecorder the configuration could need some adaptation and a ethernet connexion for the two computers.

Those tests only validate that the ethernet connexion between two computers is good and that LSL could be used on the two computers.

The aim of LSL applications it to have timed data transmitted and recorded with a LSL receiver and then show combined data and LSL streams.

I don't know how you acquire eye-link data and if your eye-link data acquisition tool is LSL compatible. If it is LSL compatible it should be able a add LSL streams and combine them with data from eye-link.

prashantig25 commented 3 years ago

Hi @nortcele,

Thank you so much for this detailed explanation. I am collecting data using SR eye-link but I don't think it is compatible with LSL. If I understood correctly, the data acquisition software needs to be identified by the LSL. Since that can't happen with eye-link, I am planning to try it out with another SMI eye-tracker, which is LSL compatible. The LSL test with one computer works well and hopefully, the same can happen with SMI eye-tracker.

Thanks, once again.

Sincerely, Prashanti

prashantig25 commented 2 years ago

Hi @nortcele,

Thank you for the LSL proxy. It works with the current SMIeye-tracker and I was successful in recording the data with jsPsych triggers. However, the data format of the signal is .xdf. Could you tell me if there are any suggestions to convert the signal data to .csv format because using Sigviewer, I can only export events to CSV? Thank you.

Sincerely, Prashanti

nortcele commented 2 years ago

I don't know how to convert XDF data to CVS. There are some XDF tools available at https://github.com/xdf-modules. Perhaps will you find here one that could help you.