Plot Transform Functions#
In the Roboto Visualizer, the Y Transform field in the plot series settings lets you apply a mathematical formula to transform the Y values of a series. This is useful for unit conversion, normalization, scaling, smoothing noisy signals, taking derivatives, and other on-the-fly calculations.
The formula is written as an expression in terms of the variable y, the raw signal
value at each point in time — for example y / 9.81 or sqrt(y). Some functions, such
as savgol and deriv, are windowed: they read a buffered run of samples rather
than a single point. Operators and functions nest freely, so transforms compose; see the
Examples section below.
Supported operators#
Operator |
Description |
|---|---|
|
Addition |
|
Subtraction |
|
Multiplication |
|
Division |
|
Modulo (remainder) |
|
Exponentiation (e.g. |
Supported functions#
Function |
Description |
|---|---|
|
Absolute value |
|
Square root |
|
Raise |
|
Sine (argument in radians) |
|
Cosine (argument in radians) |
|
Tangent (argument in radians) |
|
Natural logarithm (base e) |
|
Exponential (e raised to the power |
|
Smaller of two values |
|
Larger of two values |
|
Round to the nearest integer |
|
Round down to the nearest integer |
|
Round up to the nearest integer |
|
Convert degrees to radians (multiply by π/180) |
|
Convert radians to degrees (multiply by 180/π) |
|
Savitzky–Golay smoothing. |
|
Central-difference derivative. |
Supported constants#
Constant |
Value |
|---|---|
|
π ≈ 3.14159265358979 |
|
e ≈ 2.71828182845905 |
Examples#
Quick reference of common transforms (every operator, function, and constant used here is documented in the sections above):
Formula |
Effect |
|---|---|
|
Convert m/s² to g-force |
|
Convert metres to feet |
|
Linear scale-and-offset (template: replace |
|
Round to two decimal places |
|
Savitzky–Golay smoothing with a 0.5-second window, polynomial order 3 |
|
Convert m/s² to g-force and smooth |
|
First derivative (raw central difference) |
|
Smoothed first derivative — derivative of an SG-smoothed signal |
|
Functions nest freely — here, the natural log of a smoothed signal |
Usage notes#
The variable
yis the only supported input variable. It represents the raw signal value at a given timestamp.Functions and constants are case-sensitive: use
sqrtnotSqrt, andPInotpi.For
savgol, the second and third arguments (windowandorder) must be constant numbers; forderiv, the second argument (n) must be a constant number when present. None of these may referenceyor any other variable.A derivative changes the y-axis units (position in metres becomes m/s after one differentiation, m/s² after two). Use the Label field on the series if you want the displayed name to reflect the new units.
Performance and memory. A formula containing
savgolorderivbuffers the full underlying message stream and skips the visualization-only downsampling step so the kernel sees contiguous samples. On multi-million-sample topics this can use substantially more memory and take longer to render than a point-wise formula.
When to use a derived topic instead#
The Y Transform field is designed for single-series expressions. If your use case requires something more complex — combining multiple signals, applying stateful filters across sessions, resampling to a uniform grid, or computing rolling statistics — consider creating a derived topic as part of your ingestion pipeline using a Roboto Action.
An Action runs on hosted compute after a file is ingested and can write new topics back to Roboto using the Python SDK. Those derived topics then appear alongside the original signals in the visualizer and can be plotted directly, without any runtime transform.
See Process Data with Actions and Create Your Own Action for a full walkthrough, and the Python SDK reference for the topic-writing APIs.