Loading...

Synapse App API

Getting Started

Synapse supports on-head applications generally referred to as "apps". Synapse Apps are standalone applications that can be deployed to a Synapse device, such as SciFi. Apps allow you to run your custom neural processing algorithms on-device to minimize latency.

Apps can be integrated into existing signal chains using kApplication node type. See the Synapse API GitHub for more details.

Prerequisites

Before beginning, make sure you have the following installed:

  • Python3
  • pip
  • Docker

Synapse App development is currently supported for and tested on MacOS and Ubuntu Linux, with Windows support to follow. Contact us if you have a different operating system you would like to use.

Science Libraries

We provide a C++ SDK that allows your app to take full advantage of the SciFi hardware. Additionally, we provide the Synapse Python client API that allows you to listen to your data using the Tap API.

Getting Started

Before diving into custom app development, we will walk through the installation, build and deploy process using the Synapse example app. This will introduce the workflow you will use to create your own custom apps using Synapse and SciFi.

Install synapsectl

synapsectl is a command line tool that allows you to build, deploy, and monitor your application while it is running. It also comes with the Python API to programmatically interface with your running app.

Install the synapse-python client with pip:

pip install science-synapse

We recommend installing and running synapsectl in a virtual environment.

Download Synapse Example App

Next, clone or fork the synapse-example-app.

git clone git@github.com:sciencecorp/synapse-example-app.git
cd synapse-example-app
git submodule update --init --recursive

Building Your App

With the example application cloned, we can now build the app. Remember to have Docker installed and running, as we will need to cross-compile the application before deployment onto a Synapse device.

The first time you build the application, it may take some time. This is because it needs to install and build the dependencies in the docker container. Subsequent builds should be faster.

synapsectl build <path to synapse-example-app>

Errors encountered during the build process should be self descriptive, but feel free to contact Science Corporation if you need support. You can also report persistent issues or bugs here.

When the build is completed successful, you will see a Build complete message.

Deploying Your App

The app is now built and ready for packaging and deployment to your Synapse device. The deploy command packages and installs your application. Remember, device uri can be your SciFi's IP address or name.

synapsectl -u "device uri" deploy <path to synapse-example-app>

Using Your App

To start your app, your Synapse device needs both a start command and your .json signal chain configuration file. Remember, apps can be integrated into existing signal chain configurations using the kApplication node type.

synapsectl -u "device uri" start <path to config>.json

You can confirm the app is running using the info command.

synapsectl -u "device uri" info

Changes to signal chain configuration can be made by issuing the stop command, updating the configuration file, then issuing the start command as shown below:

synapsectl -u "device uri" stop
synapsectl -u "device uri" start <path to config>.json

Reading Data From Your App

You can to listen to data streams on your Synapse device from your local client using the Taps API To see the list of available taps, run:

synapsectl -u "device uri" taps list

You can verify that you are receiving the expected data using the following commands:

synapsectl -u "device uri" taps stream "taps_name"

Refer to the Taps API documentation or the examples in the \client\ folder of the example application for more information on how to read data into client software.

Custom App Development

To develop your own custom application logic, refer to the Synapse App SDK documentation for a detailed explanation of Synapse application development using the SDK. We recommend starting from the synapse-example-app, and developing from there