uncertainty-and-units
できること
このツールは、科学計算における単位(メートル、秒など)と不確かさ(数値がどれくらい信頼できるか)が正しいかを確認するのに役立ちます。単位の変換、誤差の伝播の計算、結果のわかりやすい提示を行います。
使う場面
- ✓科学計算で単位を変換するとき。
- ✓複数の測定値から得られた結果の不確かさを計算するとき。
- ✓不確かさが伝わるように測定結果を提示するとき。
スキルのリンク
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/uncertainty-and-units/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“時速10キロメートルを秒速メートルに変換して、その不確かさも教えてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、専門のライブラリを使って、計算の過程を通じて単位と不確かさを追跡します。単位が正しく扱われ、確立された科学的手法に従って不確かさが伝播されるようにします。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Uncertainty and units
Scope
Use this skill whenever a calculation carries physical units or a reported number needs an uncertainty. Concretely:
- converting between units, including conversions that need a physical context (wavelength to photon energy, mass to amount of substance, energy to temperature);
- propagating uncertainty through a measurement model, with or without correlated inputs;
- building a GUM uncertainty budget from calibration certificates, specifications, and repeatability data;
- choosing a coverage factor and deciding whether
k = 2is defensible; - rounding and writing a result so a reader knows what the
±means; - extracting parameter uncertainties from a curve fit without discarding correlations;
- reviewing existing analysis code for silent unit and uncertainty defects;
- checking that a dimensionally consistent answer is also physically possible — the order of magnitude, the dimensionless group, and the regime it implies.
This skill covers the metrology and the two libraries that implement it. It does not
cover statistical inference, model selection, or study design — see statistical-analysis,
statistical-power, and experimental-design.
Current release and installation
Verified 2026-10-01:
- pint 0.26.1, released 2026-09-10; requires Python 3.12+.
- uncertainties 3.2.3, released 2025-04-21; requires Python 3.8+.
- NumPy 2.5.3 and SciPy 1.18.1; both require Python 3.12+.
scipy.constantsin SciPy 1.18.1 serves CODATA 2022. SciPy 1.11 and earlier served CODATA 2018; the switch to CODATA 2022 occurred in SciPy 1.15.
uv venv --python 3.13
source .venv/bin/activate
uv pip install "pint==0.26.1" "uncertainties==3.2.3" "numpy==2.5.3" "scipy==1.18.1"
pint-pandas and pint-xarray add unit-aware columns and arrays and are separate
installs.
Non-negotiable workflow
- Attach units at input and strip them only at output. Convert at function
boundaries with
ureg.wrapsorm_as("unit"), never mid-calculation. - Write the measurement model explicitly before computing anything, including corrections whose estimated value is zero. A correction left out of the model leaves its uncertainty out of the budget.
- Give every input four things: an estimate, a standard uncertainty, the distribution the uncertainty came from, and its degrees of freedom.
- Convert Type B statements with the right divisor. A certificate's expanded
uncertainty divides by its stated
k; rectangular limits divide bysqrt(3). - Identify correlations before combining. A shared calibration, instrument correction, or fit can induce correlation; quantify shared components instead of assuming every pair is correlated.
- Compute sensitivity coefficients, and read the budget from
c_i * u(x_i)rather than from the raw uncertainties. - Check the linearization. Compare propagated distributions with the GUM interval when in doubt. Establish Monte Carlo numerical stability before a JCGM 101 clause 8 claim; neither method validates the measurement model or the assigned input PDFs.
- Justify coverage. A Student-t factor from effective degrees of freedom is an approximation requiring suitable distributional assumptions.
- Round the uncertainty first, then the value to the same decimal place.
- State what the
±is — standard or expanded, withk, the coverage probability, and the method. - Sanity-check the magnitude before reporting. A dimensionally consistent result can still be impossible. Compare it against a known scale or a dimensionless group, and confirm every assumption you relied on still holds in that regime.
The failures this skill exists to prevent
Each of the following runs without error and produces a plausible number.
A unit stripped at an unknown scale
length = (12.7 * ureg.mm).magnitude # 12.7 -- of what?
length = (12.7 * ureg.mm).m_as("m") # 0.0127 metres, stated
.magnitude returns whatever the quantity happened to be carrying. Name the unit at the
point of extraction, every time.
Offset temperature arithmetic
Q(20, "degC") + Q(5, "degC") # OffsetUnitCalculusError -- correctly refused
Q(20, "degC") + Q(5, "delta_degC") # 25 degree_Celsius
Q(25, "degC") - Q(20, "degC") # 5 delta_degree_Celsius
…
よくある質問
物理単位とは何ですか?
長さ(メートル)、時間(秒)、質量(キログラム)などの量を測るための基準です。
測定の不確かさとは何ですか?
測定値の周囲にある範囲を示すもので、真の値がある確率でその範囲内に入ると期待されることを表します。
単位と不確かさを追跡することがなぜ重要なのですか?
複雑な計算で起こりやすい誤りを避け、科学的結果の正確さ、比較可能性、信頼性を確保するためです。
詳細
作者による元の説明
Tracks physical units and propagates measurement uncertainty in scientific calculations using pint and uncertainties. Use for unit conversion and dimensional checking, GUM uncertainty budgets, Type A and Type B evaluation, coverage factors and expanded uncertainty, Monte Carlo propagation, significant-figure and plus-minus reporting, error propagation through curve fits, CODATA constants, auditing
人気
- GitHubのスター
- 51k
- ランキング
- #3589
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
13c-metabolic-flux
51k炭素13同位体トレーシングのデータを使って代謝フラックスを推定します。細胞の代謝や生化学経路の分析に役立ちます。
adaptyv
51kAdaptyv APIを使ってタンパク質の特性評価実験を設計します。コストの見積もり、配列の提出、ラボの結果の監視を支援します。
aeon
51k時系列データに対して機械学習のタスクを実行します。逐次データの分類、予測、異常検知、パターンの発見に役立ちます。
alphagenome
51k遺伝的変異に対して、事前に計算されたゲノム上の効果を検索します。スコアと説明を提供し、変異がゲノムに与える影響を理解するのに役立ちます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。