科研 Skill

测量不确定度分析

measurement-uncertainty-propagation

Builds a GUM-style measurement uncertainty budget from Type A/B evaluation, RSS combination, and error propagation to a derived result. Use when a reported value needs a defensible plus-or-minus.

发布者 Codar安全审核通过v0.1.0更新于 2026-11-18

SKILL.md

Measurement Uncertainty Propagation

Builds an uncertainty budget for an experimental result, following the structure of the ISO GUM (Guide to the Expression of Uncertainty in Measurement): identify every input quantity's uncertainty source, evaluate it as Type A (statistical, from repeated readings) or Type B (from a spec sheet, calibration certificate, or judgment), combine them, and propagate through to a derived result with partial derivatives or Monte Carlo. Use this whenever a reported number needs a defensible "+/-", not just the number itself.

Purpose

  • Turn repeated readings into a Type A standard uncertainty (standard deviation of the mean) with the right degrees of freedom.
  • Turn an instrument spec (accuracy class, resolution, calibration certificate) into a Type B standard uncertainty with the correct assumed distribution (rectangular, triangular, or normal) and divisor.
  • Combine multiple uncertainty components for one input quantity (RSS, or correlated with a covariance term when components share a cause, e.g. the same calibration).
  • Propagate input uncertainties through a derived quantity (e.g. efficiency from measured flow, head and power) via the first-order Taylor/error-propagation formula, cross-checked with a Monte Carlo sample when the function is strongly nonlinear or the inputs are not independent.
  • Report an expanded uncertainty U = k*u_c at a stated coverage (k=2 for ~95% under a normal-ish combined distribution is the common engineering default).

Prerequisites

numpy and scipy (pip install numpy scipy). For each input quantity: either a set of repeated readings (Type A) or a stated tolerance/accuracy with its source and assumed distribution (Type B). For propagation: an explicit formula for the derived quantity in terms of the input quantities (the script differentiates it numerically; it does not need or use a symbolic formula string evaluated unsafely — see Workflow step 4).

Workflow

  1. List every input quantity and how it enters the result. Write the measurement equation explicitly (e.g. eta = (rho*g*Q*H) / P_shaft). An uncertainty analysis without an explicit equation is not reproducible.

  2. Type A evaluation (repeated readings): python scripts/uncertainty.py type-a --readings readings.csv --col value reports the mean, sample standard deviation, standard uncertainty of the mean (s / sqrt(n)), and degrees of freedom (n-1). Flag n < 10 as a high-uncertainty-on-the-uncertainty case (the Student-t correction in step 6 matters most here).

  3. Type B evaluation (spec/calibration): python scripts/uncertainty.py type-b --half-width 0.05 --distribution rectangular converts a stated +/- half-width to a standard uncertainty (half_width / sqrt(3) for rectangular, /sqrt(6) for triangular, /k for a normal distribution with stated coverage factor k). Always record the source of the half-width (datasheet page, cal certificate number).

  4. Combine components for one input (if more than one source applies to the same quantity, e.g. calibration + resolution + drift): python scripts/uncertainty.py combine --components 0.02,0.01,0.015 applies RSS combination (components assumed independent; use --correlation to supply a correlation matrix when they are not).

  5. Propagate to the derived result: python scripts/uncertainty.py propagate --inputs inputs.csv --expr-module my_model.py --func efficiency numerically differentiates the named Python function (imported from a file the user provides and controls — never a string evaluated with eval()) with central finite differences at each input's nominal value, forms the sensitivity coefficients c_i = dF/dx_i, and combines u_c(y) = sqrt(sum((c_i*u_i)^2)) for independent inputs (add covariance terms via --correlation otherwise).

  6. Cross-check with Monte Carlo when inputs are strongly correlated, the function is markedly nonlinear over the uncertainty range, or any input distribution is far from normal: python scripts/uncertainty.py monte-carlo --inputs inputs.csv --expr-module my_model.py --func efficiency --n 100000 samples each input from its stated distribution and reports the empirical standard deviation and percentile interval of the output; a large disagreement with step 5's linear result is itself a finding (it means the first-order approximation is not valid here).

  7. Expand and report: python scripts/uncertainty.py expand --uc 0.0083 --k 2 reports U = k*u_c. Use k=2 (≈95% coverage for an approximately normal combined distribution) unless the user needs a different coverage probability, in which case use the Student-t value for the effective degrees of freedom (Welch-Satterthwaite, scripts/uncertainty.py welch-satterthwaite) rather than assuming normality when a dominant component has few degrees of freedom.

  8. Report: the measurement equation, a table of every input with its value, uncertainty, type (A/B), distribution and source, the sensitivity coefficients, the combined standard uncertainty, the expanded uncertainty with its coverage factor and approximate confidence level, and the single largest contributor (useful for deciding where to invest in a better instrument).

Limitations

  • The linear (first-order Taylor) propagation formula assumes the function is approximately linear over the range of the input uncertainties; it under- or over-estimates the output uncertainty for strongly nonlinear functions or large relative uncertainties — always sanity-check against the Monte Carlo result (step 6) before trusting the linear number alone for a critical result.
  • Treats unlisted correlation as zero by default; shared calibration standards, shared reference instruments, or simultaneous environmental effects (e.g. one temperature sensor used to correct several readings) create real correlation that must be supplied explicitly via --correlation, or the combined uncertainty will be wrong (usually understated).
  • Type B "distribution" choices (rectangular/triangular/normal) are standard GUM conventions, not a universal law; use the distribution the source actually implies (e.g. a stated calibration uncertainty with a coverage factor is normal-like, a stated tolerance band with no further information is conventionally rectangular).
  • Does not handle uncertainty in a quantity with intrinsically asymmetric bounds (e.g. a one-sided detection limit) — flag these to the user rather than forcing a symmetric U.
  • This is a calculation aid, not a substitute for a lab's or standard's own uncertainty procedure (e.g. ISO/IEC 17025 for an accredited lab); follow the governing procedure when one applies.

Related skills

research-data-analysis (the broader experimental-design and validation workflow this uncertainty budget feeds into), sympy-symbolic (deriving the measurement equation or its analytic partial derivatives symbolically before numeric propagation), pint-units (keeping units consistent across the inputs before this skill combines them), engineering-calc-report (presenting the final uncertainty budget in a formal report).

Quality checks

  • python scripts/uncertainty.py --selftest checks the Type B rectangular/triangular divisors, the RSS combination formula, and the linear-propagation sensitivity coefficients against a hand-solvable linear case (y = ax1 + bx2); run it after any edit to the script.
  • Every reported uncertainty number is accompanied by its type (A/B), source, assumed distribution, and degrees of freedom (where relevant) — a bare "+/- X" without this is treated as incomplete.
  • When step 5 (linear) and step 6 (Monte Carlo) disagree by more than about 10% on the combined uncertainty, the report says so explicitly rather than picking one silently.

示例提示词

帮我把这组流量和压力读数的不确定度传递到效率计算结果上。

所属插件

工程分析、控制与工程科研面向工程科研通用方法:有限元分析、控制系统设计、信号处理与振动诊断、可靠性工程、离散事件仿真、ROS2 机器人、测量不确定度,以及热流体方向的工程科研选题、数据分析、论文写作与审稿互评。

安装该插件会一并获得同领域的 17 个 Skill / MCP。

同插件的其他科研 Skill

常见问题

测量不确定度分析能做什么?

Builds a GUM-style measurement uncertainty budget from Type A/B evaluation, RSS combination, and error propagation to a derived result. Use when a reported value needs a defensible plus-or-minus。

如何安装测量不确定度分析?

在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「测量不确定度分析」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。

测量不确定度分析需要哪些权限?

该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。

测量不确定度分析经过官方审核吗?

是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。