Measurements
Last updated on June 26, 2026
Measurements Overview (one phase, three measurements)
Device Name | String | "Device-A" | x != "" | PASS
Output Voltage | Numeric | 5.00 V | 4.8 < x < 5.2 | PASS
Power Enabled | Boolean | True | x == False | FAILYou can capture numeric, string, boolean, JSON, and multi-dimensional measurements with validators and aggregations.
TofuPilot will evaluate validators, record outcomes, and timestamp each measurement.
Type
Numeric
Floating-point values with validators and aggregations
String
Text values with pattern matching and validation
Boolean
True/false values for binary state checks
JSON
Structured objects and arrays for rich device state
Multi-Dimensional
Complex data structures for charts and waveforms
Name
You can create a new measurement by adding it to the phase's measurements list.
main:
- name: Measure Voltage
measurements:
- name: Output VoltageTofuPilot will automatically trim whitespace and enforce a 100 character limit.
Description
You can add an optional description to explain what the measurement captures.
measurements:
- name: Output Voltage
description: "5V power rail output voltage"TofuPilot will enforce a 50,000 character limit on descriptions.
Key
You can define a key for referencing this measurement in your Python phases or YAML procedure.
measurements:
- name: Output Voltage
key: output_voltageIf not specified, TofuPilot auto-generates a key from the measurement name. You can use the key in Python phases and for binding to operator UI. Keys must be valid Python identifiers: start with a letter or underscore, followed by letters, numbers, or underscores.
Value
You can set measurement values using the measurement name as an attribute on measurements.
def measure_voltage(run, measurements, multimeter):
voltage = multimeter.read_voltage()
measurements.output_voltage = voltage TofuPilot will automatically detect the measurement type from the value.
Validators
You can validate measurements against expected ranges or patterns.
measurements:
- name: Output Voltage
validators:
- operator: ">="
expected_value: 4.8
- operator: "<="
expected_value: 5.2TofuPilot will evaluate each validator and set the measurement outcome to pass or fail. See type-specific pages for available operators.
Outcome
You can check measurement outcomes to determine if validators passed or failed.
TofuPilot will set the outcome based on validator results: PASS when all validators succeed, FAIL when any validator fails, or UNSET when no validators are defined. The outcome is automatically computed and stored with each measurement.
An UNSET outcome does not affect the final phase result.
Aggregations
You can compute statistics across numeric arrays.
measurements:
- name: Voltage Readings
aggregations:
- type: mean
validators:
- operator: ">="
expected_value: 4.9Your Python phase computes and sets the aggregation values; TofuPilot validates them against the declared validators. Learn more in Aggregations.
How is this guide?