Loading...

Taps

Taps

Taps Overview

Taps are ports for reading data from nodes in a signal chain built using ZeroMQ. Taps come in two functional flavors: standard node IOs and tap outputs for streaming data via wifi to a client computer running synapse-python. All nodes have standard input and output taps, which function as the connection points between nodes in the signal chain and in your configuration file. These are used to create both linear and branching signal chains with discreet data sources and sinks..

In addition to this standard function, node output taps can also stream data via wifi to client devices running Synapse-python. Taps operate independently of one another making it possible to stream data from one or many nodes simultaneously depending on your experimental needs.

Data read from taps can either be saved to on-device storage using the DiskWriter node or streamed to the client computer over wifi.

Stream and Save Taps Data

Data streamed over wifi with Taps is saved using a custom python client script, or using the synapsectl command line interface (CLI) read command. Streaming and saving taps data using the CLI does however have limitations meant to simplify the experience. For instance, CLI can only stream data from one tap at a time, and this tap must be transmitting data in broadband frame format due to limitations with HDF5 format.

Command line interface

You can use the following commands to view a list of the available taps and initiate streaming:

# start your device
synapsectl -u $DEVICE_IP start

# view a list of the available streaming taps
synapsectl -u $DEVICE_IP taps list

# view the available taps
# you can stop streaming at any time using CTRL+C
synapsectl -u $DEVICE_IP taps stream "your_tap_name"

# stop your device
synapsectl -u $DEVICE_IP stop

Initiate streaming from a tap and save data to HDF5 as follows:

synapsectl -u $DEVICE_IP read $PATH_TO_CONFIG --output $PATH_TO_SAVE_DIR/FILENAME

Python Client Scripts

Data from taps can be read into a python script running on your client. The example snippet below receives data from a device with ip “device_ip” using a tap called "tap_name":

    tap = Tap(device_ip, verbose=True)
    taps = tap.list_taps()

    if tap_name not in [tap.name for tap in taps]:
        print(f"Tap {args.tap_name} not found")
        return

    tap.connect(tap_name)

    for message in tap.stream():
        message_size = len(str(message))
        print(message, expand_all=False)