Documentation for dareplane_utils

Server

The server components can be used from dareplane_utils.default_server.server

DefaultServer A class representing a default server used and modified by other Dareplane projects.

Logging

Logging components which add a TCP handler to a logger derived from Python’s standard logging.Logger. This allows to the dp-control-room to create a single consolidated log-file.

logger.get_logger Get a configured logger.
server.LogRecordStreamHandler Handler for a streaming logging request.
server.LogRecordSocketReceiver Simple TCP socket-based logging receiver suitable for testing.
server.modify_root_logger

Streaming data

Dareplane relies mostly on the lab streaming layer (LSL) for streaming data. A central element of the dareplane-utils is the StreamWatcher which is a ring buffer to read from streams. Currently we only have a StreamWatcher for LSL implemented, using pylsl and inlets defined therein.

StreamWatcher
get_streams_names Get a list of all available lsl stream names.
pylsl_xmlelement_to_dict The pylsl XMLElement is hard to investigate -> cast to a dict for
get_channel_names Extract channel names from the LSL stream info.

General

General utility functions and classes

ringbuffer.RingBuffer A simple numpy ring buffer for data and timestamps.
time.sleep_s Sleep for a specified duration with partial sleep optimization.
time.partial_sleep Sleep for 90% of s or up to 30ms to the end, whatever is longer
time.full_speed
event_loop.EventLoop A class that implements a custom event loop with precise timing.