Loading...

Control Plane API

The control plane API uses Protocol Buffers and gRPC, and is defined in the synapse-api repo. It has five core function calls:

  • Info
  • Configure
  • Start
  • Stop
  • Query

When a Synapse device turns on for the first time, it has no configuration and by default, will do nothing when started. The main component of a device's configuration is the signal chain which defines a flow of information through the device. The signal chain is built using standard Synapse Nodes connected to a Synapse App. Synapse Apps are neural processing nodes supporting custom algorithms or functions defined by the user.

Discovering Devices

To begin, you must first request the devices available in the API. The discover command will display a procedurally generated name and the IP address for all Synapse devices on the network.

from synapse.utils.discover import discover

discovered = discover()

Info on Devices

After your device(s) have been discovered, you can use the info command to print info on all peripherals available to the device.

import synapse as syn

# Connect to a device
device = syn.Device(uri)

# Get the device's info
info = device.info()
assert info is not None, "Couldn't get device info"
print(f"Device info: {info}")

# {
#  name: "twelve-duckling-stampede";
#  serial: "SFI00001",
#  synapse_version: ""
#  firmware_version: "",
#  status: {...},
#  peripherals: [...],
#  configuration: {...}
# }

Configuring Devices

Synapse uses nodes (including Synapse App) to collect, process, and stream data to and from Synapse devices. Nodes are linked together in series to operate as a signal chain.

Below is an example showing node configuration outputting broadband data to a connected spectral filter node:

import synapse as syn
## set channel map and reference
channels = [
    syn.Channel(
        id=channel_num,
        electrode_id=channel_num * 2,
        reference_id=channel_num * 2 + 1
    ) for channel_num in range(32)
]
## Add broadband source node
broadband = syn.BroadbandSource(
    peripheral_id=2,
    sample_rate_hz=30000,
    bit_width=12,
    gain=20.0,
    signal=syn.SignalConfig(
        electrode=syn.ElectrodeConfig(
            channels=channels,
            low_cutoff_hz=500.0,
            high_cutoff_hz=6000.0,
        )
    )
)
## add spectral filter node
spectral_filter = syn.SpectralFilter(
    method = syn.api.spectral_filter_pb2.SpectralFilterMethod.kBandStop,
    low_cuttoff_hz = 55,
    high_cuttoff_hz = 65
)
## connect broadband output to filters
config = syn.Config()
config.add_node(spectral_filter)
config.add_node(broadband)
config.connect(broadband, spectral_filter)

Devices must be reconfigured if you want to update the signal chain.

Starting/Stopping Devices

You can start or stop signal chains that have been configured on a device using the start and stop commands.

# Start the device
ok = device.start()

# ...

# Stop the device
ok = device.stop()