Measurements

Last updated on October 5, 2026

Device Name
Device-Ax!=""PASS
Output Voltage
5.00V4.8<x<5.2PASS
Power Enabled
Truex==FalseFAIL
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     | FAIL

You 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

Name

You can create a new measurement by adding it to the phase's measurements list.

name: Power Supply Test

main:
  - name: Measure Voltage
    measurements: 
      - name: Output Voltage

TofuPilot 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_voltage

If 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.

Your phase must record the measurement under its key. A declared measurement the phase never records is uploaded as an empty measurement, and the phase log warns that it will be filled as empty until a value is provided in the phase. An empty measurement can't meet its validators, so it is FAIL and fails its phase. Without validators, it is UNSET. The same rule applies to the key of each y axis in a multi-dimensional measurement and to the type of each aggregation. TofuPilot Studio shows the same warning before the run when the phase's Python never writes the measurement key.

A measurement recorded as None is empty too, and fails its validators the same way. Only a phase that ran to its end is completed this way: a phase that was skipped, raised an error, or returned early with phase.retry(), phase.stop() or phase.fail() keeps only what it recorded.

A measurement recorded under a key that isn't declared is uploaded as recorded, with the validators set from Python. When a declared measurement is missing, the phase log also lists the undeclared ones, since the two are usually a naming mismatch.

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.2

TofuPilot will evaluate each validator and set the measurement outcome. See type-specific pages for available operators.

Outcome

You can check measurement outcomes to determine if validators passed or failed.

TofuPilot computes the outcome from every validator on the measurement, on its aggregations and on the axes of a multi-dimensional measurement.

ValidatorsOutcome
Any validator failsFAIL
A validator has no value to check: the measurement, the aggregation or the axis is emptyFAIL
None, or aggregations without validatorsUNSET
A validator couldn't run, such as a numeric limit on a stringUNSET
A declared axis or aggregation without validators was never recorded, even if every validator passedUNSET
Every validator passedPASS

A FAIL wins over everything else. UNSET means the measurement was not fully checked.

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.9

Your Python phase computes and sets the aggregation values; TofuPilot validates them against the declared validators. Learn more in Aggregations.

How is this guide?

On this page