Skip to content

bil/licorice

Repository files navigation

LiCoRICE - Linux Comodular Realtime Interactive Computation Engine

LiCoRICE is an open-source computational platform implementing model-based design for realtime processing of streaming data.

It facilitates the execution of numerical operations in python with empirical realtime guarantees, supports storage of streaming data to an SQLite Database, and supports USB peripherals and output to a display via pygame, all while maintaining at least 1ms ticks.

LiCoRICE was developed in the Stanford Brain Interfacing Laboratory, where it is currently used to control and conduct closed-loop neuroscience experiments.

Motivation

Why Realtime?

While offline data analysis collects data and processes it in batches, realtime processing is the analysis of data as it is collected, allowing for predictable response time (latency) and minimal timing variation (jitter). Systems in which delays are consequential, such as conducting closed-loop experiments or high-frequency trading, can benefit from implementing realtime practices.

Why Licorice?

Although realtime computational platforms do exist, many of them are inaccessible due to programming language, hardware, cost, or being proprietary. The high-level, POSIX-compliant, and open-source nature of LiCoRICE forgoes these problems and allows users to easily install LiCoRICE and adapt it to their use case.

System Requirements

  • x86_64 system
  • Modern UNIX environment (Linux, MacOS)
  • Python 3.6+
  • GCC toolchain, libevent, SQLite3, and MessagePack

NOTE: Soft realtime timing guarantees are only currently tested for Ubuntu 20.04 LTS (Focal Fossa) and Ubuntu 18.04 LTS (Bionic Beaver).

We recommend starting with a stock install of Ubuntu Server 20.04 LTS. Use of other UNIX platforms besides MacOS requires manual installation of packages.

Installation

LiCoRICE can be installed with pip, but requires some dependencies and permissions detailed in the documentation.

To achieve minimal jitter, it is recommended to install the stock linux-lowlatency kernel or a custom kernel. We provide a one-click setup script to install a suitable realtime kernel.

User Guide

LiCoRICE has a growing user guide which walks through creating some basic models from the ground up.

Examples

LiCoRICE also ships with a number of examples that highlight its capabilities.

Some examples require external hardware to run.

Usage

In general, only one command needs to be issued to parse, compile, and run a model:

licorice go <model_name>

For a more detailed description, take a look at the API reference.