Giter Site home page Giter Site logo

psychopy-lsl's Introduction

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]).

psychopy-lsl's People

Contributors

kaczmarj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

psychopy-lsl's Issues

pylsl URL

Hi, can you please update the README from https://github.com/chkothe/pylsl/blob/master/pylsl/pylsl.py to https://github.com/labstreaminglayer/liblsl-Python/blob/master/pylsl/pylsl.py?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.