Skip to main content

Documentation for ScryLab v0.7.1

Changelogs

Plot Signal

POST /api/plot

Plots a signal in the active tab. It goes into the last plot of the tab, in a new row if the plot already shows signals. If the tab has no plot yet, one is created.

Request

POST /api/plot HTTP/1.1
Host: localhost:5678
Content-Type: application/json

Body Parameters

ParameterTypeRequiredDescription
signal_idstringYesSignal ID from POST /api/signals/send or /api/signals/upload
{
"signal_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}

Response

Status Code: 200 OK

{
"status": "ok",
"result": {
"signals": [
{
"working_signal_id": "0b0d4c1e-6f0a-4c56-9d0e-5a4e5c1f2a77",
"name": "Sine 5Hz",
"source_cntr": 1,
"row_id": "row_1"
}
],
"target": "plot",
"plot_name": "Plot 1",
"plot_id": "c2a9d5b0-3a43-4b6e-8b0a-1f6a7d0e9c11",
"computed": true
}
}
FieldTypeDescription
result.signals[].working_signal_idstringID of the plotted signal. It differs from signal_id, which names the channel in the data source
result.signals[].namestringName of the signal in the plot
result.signals[].source_cntrintegerNumber of the data source it comes from
result.signals[].row_idstringRow of the plot the signal was placed in
result.plot_name, result.plot_idstringThe plot that received the signal
result.computedboolean or "pending"Whether the signal was drawn before the response was sent

Errors

StatusMeaning
400signal_id field missing
404Signal not found

Example

Terminal window
# Send a signal, capture the signal_id
SIGNAL_ID=$(curl -s -X POST http://localhost:5678/api/signals/send \
-H "Content-Type: application/json" \
-d '{"name":"Sine 5Hz","y":[0,1,0,-1,0],"target_source_id":"<source_id>"}' \
| jq -r '.result.signal_id')
# Plot it
curl -s -X POST http://localhost:5678/api/plot \
-H "Content-Type: application/json" \
-d "{\"signal_id\":\"$SIGNAL_ID\"}"

Tip

The Python and MATLAB clients send the signal with scry.plot() and call this endpoint automatically. See scrylab (Python) and scrylab-matlab (MATLAB).