GitXplorerGitXplorer
k

psychopy-lsl

public
22 stars
4 forks
0 issues

Commits

List of commits on branch master.
Verified
d0605a805268c9758249ac06bef4d4e4a42e9297

Merge pull request #3 from kaczmarj/kaczmarj-patch-1

kkaczmarj committed 3 years ago
Verified
583daaad3289dc790b729cb70e1d5c2ed8531319

update link to pylsl.py

kkaczmarj committed 3 years ago
Verified
fb4e1abaffeebbc651fcb9eac4a5ffe0c6797c88

fix url to pylsl.py file

kkaczmarj committed 4 years ago
Unverified
53240a00c51440d0881bb01d44ab931c1f50560f

Deleted old files

committed 8 years ago
Unverified
240106b2884793a0f4068c77ec1279aafcc374db

Updated readme

committed 8 years ago
Unverified
1d50eeb5243b819af72162b925fbee1019f626b6

Separated Coregui info from readme

committed 8 years ago

README

The README file for this repository.

PsychoPy event markers with LabStreamingLayer

This repository demonstrates how to send event markers in PsychoPy with LabStreamingLayer (LSL).

See coregui.md to learn how to receive markers in Coregui with LSL.

Example scripts

  • example_coder.py is a minimal PsychoPy "experiment". Two words alternate on the screen, and a marker is sent whenever a word appears. This was coded manually.
  • example_builder.py behaves in the same way as example_coder.py, but it was created in the builder and uses stimuli and markers defined in example_builder.csv

General steps

  1. Install pylsl (the Python interface of LSL).
  2. Include code in your Python script to send markers.

Install LabStreamingLayer

See the PyPI page.

pip install pylsl

In your PsychoPy code

Refer to pylsl.py for documentation on pylsl functions.

# ...
from pylsl import StreamInfo, StreamOutlet
info = StreamInfo(name='my_stream_name', type='Markers', channel_count=1,
                  channel_format='int32', source_id='uniqueid12345')
# Initialize the stream.
outlet = StreamOutlet(info)
# ...
  • Include markers wherever you need them.
# ...
outlet.push_sample(x=[100])
# ...
  • The example above sends a marker 100. x must be a list with a length equal to channel_count (specified in StreamInfo). It is easiest to use integers as markers.
  • You can also include dynamic marker names (see example script). If you are using a trial loop in PsychoPy, include marker values in a column in the spreadsheet used for the loop. If the column header is "marker", the code would be outlet.push_sample(x=[marker]).