Loading...

Record

Record

Record from a probe

To record from a probe, you will need to specify the recording configuration using a synapse JSON file. A configuration file specifies the nodes in the signal chain, as well as how they are connected. An example configuration file for the Axon Omnetics adapter is provided below that defines which channels are being recorded from, the bit depth and sample rate of the recording, and the high- and low-pass filter corner frequencies. Please refer to the Synapse peripheral documentation for a complete list of configuration options.

A few pre-written configuration files are available in the synapse-python repo for download.

{
    "nodes": [
      {
        "type": "kStreamOut",
        "id": 1,
        "stream_out": {
          "multicast_group": "224.0.1.115"
        }
      },
      {
        "type": "kBroadbandSource",
        "id": 2,
        "broadbandSource": {
          "peripheral_id": 2,
          "sample_rate_hz": 32000,
          "bit_width": 12,
          "signal": {
            "electrode": {
              "channels": [{"id": 0, "electrode_id": 122, "reference_id": 513}, {"id": 1, "electrode_id": 126, "reference_id": 513}, {"id": 2, "electrode_id": 116, "reference_id": 513}, {"id": 3, "electrode_id": 120, "reference_id": 513}, {"id": 4, "electrode_id": 110, "reference_id": 513}, {"id": 5, "electrode_id": 114, "reference_id": 513}, {"id": 6, "electrode_id": 104, "reference_id": 513}, {"id": 7, "electrode_id": 108, "reference_id": 513}, {"id": 8, "electrode_id": 98, "reference_id": 513}, {"id": 9, "electrode_id": 66, "reference_id": 513}, {"id": 10, "electrode_id": 92, "reference_id": 513}, {"id": 11, "electrode_id": 60, "reference_id": 513}, {"id": 12, "electrode_id": 86, "reference_id": 513}, {"id": 13, "electrode_id": 54, "reference_id": 513}, {"id": 14, "electrode_id": 80, "reference_id": 513}, {"id": 15, "electrode_id": 48, "reference_id": 513}, {"id": 16, "electrode_id": 74, "reference_id": 513}, {"id": 17, "electrode_id": 38, "reference_id": 513}, {"id": 18, "electrode_id": 68, "reference_id": 513}, {"id": 19, "electrode_id": 36, "reference_id": 513}, {"id": 20, "electrode_id": 62, "reference_id": 513}, {"id": 21, "electrode_id": 0, "reference_id": 512}, {"id": 22, "electrode_id": 56, "reference_id": 513}, {"id": 23, "electrode_id": 4, "reference_id": 512}, {"id": 24, "electrode_id": 50, "reference_id": 513}, {"id": 25, "electrode_id": 12, "reference_id": 513}, {"id": 26, "electrode_id": 44, "reference_id": 513}, {"id": 27, "electrode_id": 14, "reference_id": 513}, {"id": 28, "electrode_id": 42, "reference_id": 513}, {"id": 29, "electrode_id": 20, "reference_id": 513}, {"id": 30, "electrode_id": 32, "reference_id": 513}, {"id": 31, "electrode_id": 26, "reference_id": 513}],
              "low_cutoff_hz": 57,
              "high_cutoff_hz": 13489
            }
          }
        }
      }
    ],
    "connections": [
      {
        "src_node_id": 2,
        "dst_node_id": 1
      }
    ]
  }

After saving a configuration JSON, you can begin a recording using:

synapsectl read $DEVICE_IP --config $PATH_TO_CONFIG_FILE.json

This will begin recording that will run indefinitely. You can end a recording by pressing CTRL+C in the terminal window. You can supplement your recording session with a combination of the following functions:

FlagFunction
--duration $TIME_IN_SECONDSSpecify recording duration
--plotEnable live plotting GUI
--bin trueSave data to binary format
--output $OUTPUT_FILE_NAMESpecify output filename
--overwriteOverwrite existing data if filename is identical

An example 10 second recording from a device with ip 192.168.0.1 with a binary dump, live plotting, and specified filename with:

synapsectl read 192.168.0.1 --config ./config_32_hg.json --bin true --plot --duration 10 --output data1

If you encounter an error caused by attempting to start recording before the probe is recognized, stop the device, wait a few seconds, and try again.

synapsectl stop $DEVICE_IP

When connecting the probe adapter to a passive probe, ensure the text on the Omnetics connectors matches up on both sides of the connector.

Use the Live Plot GUI

Use the --plot flag with the read command to open a pop-up GUI that displays a live feed of your data. We recommend viewing less than 96 channels at a time to avoid performance issues.

Synapse plot gui showing all channels

The GUI has two main views that can be toggled with the top navigation bar: All Channels and Zoomed Channel.

The left side of the window contains the configuration settings:

  • Which channel is displayed in the zoomed view.
  • The bounds of the y-axis in the zoomed view.
  • Distance between traces in the all channels view (signal separation).

The x axis can be rescaled by right-clicking on the graph window.

Visualize Data Offline

By default, the read command will save a folder with the data and the runtime configuration. You can point the synapsectl plot command to a directory to plot the data:

synapsectl plot --dir ./PATH_TO_DATA_FOLDER

Synapse offline plot gui showing all channels, a single channel, and a fourier transform plot

You can change the selected channel in the bottom window with the dropdown menu in the upper left corner. You can scroll across plots with left click and drag or you can change x- and y-axis scales with right click and drag. You can also right click on a window to manually adjust the plot settings.

Measure Impedance

Query Construction

In order to request an impedance measurement from a Synapse device, you will need to construct and format an “Impedance Query” message to send to the SciFi in the form of a JSON file:

{
  "query_type": "kImpedance",
  "impedance_query": {
    "electrode_ids": [1, 2, 3, 4, 5]
  }
}

Your list of electrode IDs can be as long as you’d like.

Run the Test

Use the following command to begin the measurement:

synapsectl query $DEVICE_IP $QUERY_JSON_PATH

The command may take a few minutes if your list of electrode IDs is large.

After the measurement finishes, an output is generated with a status message (typically blank) and a list of each electrode measurement measured by magnitude (Ohms) and phase (degrees). The output file is saved in a CSV format and titled impedance_measurements_$DATE_$TIMESTAMP.csv.

status {
}
impedance_response {
  measurements {
    electrode_id: 1
    magnitude: 13414576.0
    phase: -210.17554
  }
  measurements {
    electrode_id: 2
    magnitude: 28159914.0
    phase: -184.9782
  }
  measurements {
    electrode_id: 3
    magnitude: 12796945.0
    phase: -168.97946
  }
  measurements {
    electrode_id: 4
    magnitude: 31529048.0
    phase: -248.70753
  }
  measurements {
    electrode_id: 5
    magnitude: 1768543.4
    phase: -147.09204
  }
}