Set Unit
Shippingset_unitAttach or relabel a quantity's unit without rescaling the numbers
Signature
Inputs
valueScalar|Signalrequired— The quantity whose numbers are kept and whose unit label is replaced.
Outputs
resultScalar|Signal— Same numbers and same σ² as the input, carrying the new (canonicalised) unit symbol.
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
unit | unit | Unit label to attach — the numbers are NOT rescaled (use **Unit Convert** for that). Typical use: annotate raw acquisition data. Empty strips the unit; unknown symbols auto-register as custom units. A syntactically invalid expression (`kg//m`) errors. |
Description
Set Unit relabels a quantity's unit without touching its numbers — the semantic partner of unit_convert. Where convert preserves the physical quantity and changes the value, Set Unit preserves the value and changes what it means.
This is how raw, dimensionless data — an ADC stream, a CSV column, a formula result — is told "you are volts." The dimensionless-wildcard rule (ADR-006) makes that annotation legal everywhere downstream, so a bare number can be given a physical identity and then flow into unit-aware math.
The uncertainty passes through untouched: relabeling can't change the spread, so is carried verbatim, and the σ-correlation lineage rides through unchanged (the operation is numerically the identity).
The unit expression is resolved leniently: unknown symbols auto-register as custom base dimensions (Apples is a feature, ADR-003), so you are free to invent domain units. The canonical resolved symbol is stored, so a u-spelled micro becomes µ, etc. A syntactically invalid expression (kg//m) is still an error. An empty expression resolves to dimensionless — i.e. it strips the unit.
Mathematics
Examples
Annotate a raw ADC stream
A dimensionless signal [1.5, -2.5] (with ) fed through Set Unit with unit = V becomes the same samples [1.5, -2.5], same variances, now labelled . No value changed.
Strip a unit
A scalar with unit = (empty) becomes the dimensionless scalar . Useful before feeding a value into a context that expects a bare number.
Custom domain unit
A count of with unit = Apples yields ; the symbol auto-registers as a custom base dimension and propagates through downstream unit algebra.
Applications
- Labelling raw acquisition data (ADC counts, CSV columns) with its true physical unit so downstream nodes carry correct dimensions.
- Correcting or overriding a mislabelled unit without disturbing the recorded values.
- Stripping a unit to obtain a bare number for a node or export that expects dimensionless input.
- Introducing custom domain units (Apples, Widgets, packets) for non-SI bookkeeping that still benefits from dimensional tracking.
Neat
Set Unit and Unit Convert are exact mirror images: convert keeps the physical quantity and changes the numbers; Set Unit keeps the numbers and changes their meaning.
Because the resolver canonicalises symbols, sloppy input like `u` for micro or an alternate spelling normalises to the stored canonical symbol (µ) — the annotation is cleaned up as it is applied.
Unknown symbols are a feature, not an error: they auto-register as custom base dimensions (ADR-003), so inventing a project-specific unit just works.
Known issues
Set Unit never rescales — attaching `mV` to a signal that is really volts will mislabel it by a factor of 1000. Use Unit Convert when the numbers must change.
A syntactically invalid unit expression (e.g. `kg//m`) errors rather than being coerced.