Measurements
Capture and validate structured results within your phases.
You can capture numeric, string, boolean, 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
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 1,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.9TofuPilot will compute aggregations and validate the results. Learn more in Aggregations.
How is this guide?