Qu

apply_calibration_curve

Builtin index · Signal processing

apply_calibration_curve(s, raw_points, physical_points, [unit=], [extrapolate="error"])

Input: s, raw_points, physical_points, unit, extrapolate · Output: no output

What it is

Added in v0.2.4. A non-linear calibration: a lookup table from raw reading to physical value, interpolated piecewise-linearly — what a thermocouple or a certificated load cell actually gives you, and what no slope/offset pair represents. raw_points must be strictly increasing (a curve that doubles back does not define a single value for a reading). extrapolate defaults to "error" because a sample outside the measured domain is one the calibration says nothing about; "clamp" holds the end value and "linear" continues the end slope, both explicit opt-ins to a guess. The curve's own points are not retained on the result.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
apply_calibration_curve(s, raw_points, physical_points, [unit=], [extrapolate="error"])
s —The curve's own points are not retained on the result.
raw_points —raw_points must be strictly increasing (a curve that doubles back does not define a single value for a reading).
physical_points —not documented yet
unit optionalnot documented yet
extrapolate optional (default "error")extrapolate defaults to "error" because a sample outside the measured domain is one the calibration says nothing about.
not documented yetAdded in v0.2.4. A non-linear calibration: a lookup table from raw reading to physical value, interpolated piecewise-linearly — what a thermocouple or a certificated load cell actually gives you, and what no slope/offset pair represents.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

apply_calibration_curve(s, raw_points, physical_points, [unit=], [extrapolate="error"]) -- §10's NON-LINEAR calibration: a lookup table from raw reading to physical value, interpolated piecewise-linearly between the points. This is what a thermocouple or a load cell with a certificate of calibration actually gives you, and no slope/offset pair represents it. extrapolate DEFAULTS TO "error", deliberately. A sample outside the curve's measured domain is a reading the calibration says nothing about, and the two usual behaviours -- clamp to the end value, or run the end segment onwards -- both answer confidently from data that does not exist. §6's rule is "a measurement that had to guess says so", so the default is to say so; "clamp" and "linear" are available for callers who have decided which guess they want.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.