Giter Club home page Giter Club logo

dp-mockup-streamer's Introduction

Mockup_streamer

This is a module for the Dareplane project which provides mockup streaming from recorded data (currently only EEG from BrainVision files) or randomly generated data.

Running the module

As for all Dareplane modules, you can have this run standalone, via a TCP server or here also as a Docker container. The core interaction is meant to take place via the TCP server.

Config

The configuration options can be found under ./config in the streams.toml or streaming_docker.toml depending whether you plan to run as a docker container or not. For most use cases, running in a shell is sufficient and should be the prefered way.

Config options

Running in a shell

As standalone python

A simple CLI is implemented in ./mockup_streamer/main.py for the following function

def run_stream(stop_event: threading.Event = threading.Event(),
               stream_name: str = "",
               log_push: bool = False,
               random_data: bool = True,
               **kwargs) -> int:

This will run the standard configuration located in ./config/streams.toml.

To simply spawn a quick stream of random data with CLI control over the parameters, use this:

python -m mockup_streamer.random_cli
# or this for help about parameters
python -m mockup_streamer.random_cli --help

As TCP server

To spawn it, simply run from this directory

python -m api.server

Note: By default, this will bind to port 8080 on the local host. You might want to change this within ./api/server.py.

Running as docker

Start by building the container, e.g.

sudo docker build -t mockup_streamer .

Telling docker to build an image with name mockup_streamer. Next, you can run the container with

sudo docker run -ip 127.0.0.1:8080:8080 --rm --name my_mockup_streamer --mount type=bind,source="/home/md/workspace/data/bbciRaw/my_eeg_session/folder_with_vhdr_files",target=/var/eeg,readonly -t mockup_streamer

Here we are creating a interactive -i container with a port mapping p which will be removed once it is closed --rm with the specific name --name and based of the -t container we just built above.

Makefile

Both of the above-mentioned commands are coded into the Makefile and can be run by make build and make run respectively. The Makefile is here only to simplify the docker interaction.

Connecting

Once the server is running (either in a shell or in a docker container), you can send the primary commands START and STOP to the server, which will start or stop streaming data via LSL. To do so connect a socket, e.g. via telnet from your terminal as

telnet 127.0.0.1 8080

Configure

All configuration can be found under ./config/. Check e.g. ./config/streaming.toml for setting of the mockup stream, and where the source files are globbed from. Also note the ./config/streaming_docker.toml file which would handle the config for running within a container.

TODOs

  • implement replaying xdf
  • include a markers stream

dp-mockup-streamer's People

Contributors

matthiasdold avatar

Watchers

Andreas Meinel avatar Michael Tangermann avatar  avatar  avatar

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.