Leanpub Header

Skip to main content

Measurement Uncertainty with Pytho

A Practical Guide to the GUM, Monte Carlo, and Curve Fitting

The instructor has published 100% of this course.Last updated on 2026-11-21

Learn to evaluate, propagate, and report measurement uncertainty the GUM way, from Type A and Type B evaluation to Monte Carlo and curve fitting, with Python code, a quiz in every lesson, and a certificate.

Minimum price

$39.00

$59.00

You pay

Author earns

$

Also available for 1 course credit with a Learner Membership

PDF
EPUB
WEB
About

About

About the Course

Share this course

Instructor

About the Instructor

Kompri

Kompri is an academic, author, investor, and educator based in Jambi, Indonesia. He holds a doctorate in Education Management and a bachelor’s degree in Physics, and has written and published dozens of books along with numerous other scholarly works. An avid reader, he is one of today’s most productive researchers. Alongside his academic career, he publishes both theoretical and practical books for readers around the world. His work rests on one conviction: knowledge is most valuable when it is clear, usable, and shared, so that anyone, in any country, can put it to work.

Material

Course Material

  • Welcome to the Course

  • How the Course Works

  • Using the Code

  • Earning the Certificate

  • Chapter 1: Why Every Measurement Needs an Uncertainty

  • 1.1 What a Measurement Result Is

  • 1.2 Do the Two Laboratories Agree?

  • 1.3 What Uncertainty Is For

  • 1.4 The Plan of This Book

  • 1.5 A First Example in Python

  • 1.6 What Uncertainty Is Not

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 1 Quiz

    10 attempts allowed

  • Chapter 2: Errors and What They Are Not

  • 2.1 Error, True Value, and Why We Never Know Either

  • 2.2 Random and Systematic Effects

  • Watching a bias survive averaging

  • Repeatability and reproducibility

  • 2.3 Corrections and the Uncertainty That Remains

  • 2.4 Resolution: The Smallest Thing an Instrument Can Show

  • 2.5 Blunders

  • 2.6 A Vocabulary for the Rest of the Book

  • 2.7 Worked Example: A Digital Caliper

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 2 Quiz

    10 attempts allowed

  • Chapter 3: The Statistics You Need

  • 3.1 Distributions as Descriptions of Doubt

  • Summarizing a distribution

  • 3.2 The Distributions That Appear in Practice

  • Choosing among them

  • 3.3 The Mean of Repeated Readings

  • 3.4 Small Samples and Student’s t

  • Checking it by simulation

  • 3.5 Correlation

  • 3.6 What You Need, Summarized

  • 3.7 Worked Example: Pooling Six Days of Repeatability

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 3 Quiz

    10 attempts allowed

  • Chapter 4: The GUM Framework — Type A and Type B Evaluation

  • 4.1 The Measurement Model

  • 4.2 Type A Evaluation: Uncertainty from Repeated Readings

  • Pooled standard deviation

  • 4.3 Type B Evaluation: Uncertainty from Everything Else

  • When there is no certificate

  • 4.4 Combining: The Combined Standard Uncertainty

  • 4.5 The Uncertainty Budget

  • 4.6 What the Budget Tells You

  • 4.7 Type A and Type B Are Not “Random” and “Systematic”

  • 4.8 Worked Example: Weighing with an Air Buoyancy Correction

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 4 Quiz

    10 attempts allowed

  • Chapter 5: Combining Uncertainties — The Law of Propagation

  • 5.1 Sensitivity Coefficients

  • 5.2 The Law for Uncorrelated Inputs

  • The cylinder, by hand

  • Relative uncertainties for products and powers

  • 5.3 Sensitivity Coefficients by Computer

  • 5.4 Correlated Inputs

  • Two resistors, one meter

  • 5.5 Where the Law Fails

  • How to tell whether the law is safe

  • 5.6 A Recipe

  • 5.7 Worked Example: A Thermistor Thermometer

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 5 Quiz

    10 attempts allowed

  • Chapter 6: A Complete Evaluation — Preparing a Calibration Standard

  • 6.1 Specifying the Measurand

  • 6.2 The Measurement Model

  • 6.3 Identifying the Sources of Uncertainty

  • 6.4 Quantifying Each Source

  • 6.5 Combining

  • 6.6 Checking the Result by Monte Carlo

  • 6.7 Reporting

  • 6.8 What Stage 1 Has Built

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 6 Quiz

    10 attempts allowed

  • Chapter 7: Automatic Propagation with the uncertainties Package

  • 7.1 Numbers That Carry Their Uncertainty

  • What a ufloat is not

  • 7.2 Correlation Tracking: The Package’s Real Strength

  • Model shared effects as shared variables

  • Inspecting correlations

  • 7.3 The Budget from the Package: Error Components

  • 7.4 Functions and Arrays

  • Mathematical functions

  • Arrays of uncertain numbers

  • Performance

  • 7.5 Results That Are Already Correlated

  • 7.6 Wrapping Functions the Package Cannot See Inside

  • 7.7 Pitfalls

  • 7.8 Worked Example: The Refractive Index of a Prism

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 7 Quiz

    10 attempts allowed

  • Chapter 8: Monte Carlo Propagation of Distributions

  • 8.1 The Idea

  • 8.2 Assigning and Sampling Input Distributions

  • The t distribution for a few readings

  • Correlated inputs

  • 8.3 How Many Trials?

  • The adaptive procedure

  • 8.4 Coverage Intervals

  • 8.5 Validating the Law of Propagation

  • 8.6 What Monte Carlo Does Not Do

  • 8.7 Worked Example: An Orifice Flow Meter at Two Flow Rates

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 8 Quiz

    10 attempts allowed

  • Chapter 9: Expanded Uncertainty, Coverage, and Degrees of Freedom

  • 9.1 From Standard to Expanded Uncertainty

  • 9.2 When a Rectangular Contribution Dominates

  • 9.3 Degrees of Freedom

  • 9.4 The Welch–Satterthwaite Formula

  • Does it work?

  • 9.5 Choosing a Coverage Factor in Practice

  • 9.6 Worked Example: Calibrating a Digital Thermometer

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 9 Quiz

    10 attempts allowed

  • Chapter 10: Fitting Curves to Data with Error Bars

  • 10.1 Least Squares with Error Bars

  • 10.2 The Straight Line

  • A spring constant

  • 10.3 Does the Model Fit? The Chi-Square Test

  • Look at the residuals

  • 10.4 curve_fit and the Meaning of absolute_sigma

  • 10.5 Using Fitted Parameters: Correlation Matters

  • Centring removes the correlation

  • 10.6 Nonlinear Models

  • 10.7 Checking a Fit by Simulation

  • 10.8 Worked Example: A Half-Life from Counting Data

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 10 Quiz

    10 attempts allowed

  • Chapter 11: Errors in Both Variables, Outliers, and Choosing a Model

  • 11.1 When the Abscissa Is Uncertain

  • The effective-variance method

  • York’s method

  • The resistor

  • 11.2 Orthogonal Distance Regression for Any Model

  • 11.3 Outliers

  • What to do about an outlier

  • What not to do

  • 11.4 Choosing a Model

  • 11.5 What Stage 2 Has Built

  • 11.6 Worked Example: The Degree of a Thermocouple Calibration

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 11 Quiz

    10 attempts allowed

  • Chapter 12: Calibration Curves and Inverse Prediction

  • 12.1 The Calibration Problem

  • 12.2 Inverse Prediction

  • The same result with the uncertainties package

  • 12.3 Designing the Calibration

  • 12.4 The Standards Are Uncertain Too

  • 12.5 Degrees of Freedom and Coverage

  • 12.6 Reporting a Result Near Zero

  • 12.7 Worked Example: A Load Cell with a Quadratic Calibration

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 12 Quiz

    10 attempts allowed

  • Chapter 13: Case Study — Measuring g with a Pendulum

  • 13.1 The Model

  • 13.2 The Data

  • 13.3 The Uncertainty Budget

  • 13.4 Is the First-Order Result Good Enough?

  • 13.5 A Better Design: Vary the Length

  • 13.6 Comparing and Combining

  • 13.7 Improving the Experiment

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 13 Quiz

    10 attempts allowed

  • Chapter 14: Case Study — An Uncertainty Budget for a Chemical Analysis

  • 14.1 Specifying the Measurand and the Model

  • 14.2 Finding the Sources: The Cause-and-Effect Diagram

  • 14.3 Quantifying the Inputs

  • 14.4 The Bottom-Up Budget

  • 14.5 Top-Down: What the Control Chart Says

  • 14.6 Reconciling Bottom-Up and Top-Down

  • 14.7 From Standardization to Analysis

  • 14.8 Worked Example: Acidity of a Vinegar Sample

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 14 Quiz

    10 attempts allowed

  • Chapter 15: Quality Assurance — Measurement Systems and Conformity Decisions

  • 15.1 Measurement-System Analysis: Gauge R&R

  • The ANOVA method

  • Interpreting the indices

  • From gauge R&R to measurement uncertainty

  • 15.2 Is the Instrument Good Enough? The Test Uncertainty Ratio

  • 15.3 The Probability of Conformance

  • 15.4 Decision Rules and Guard Bands

  • 15.5 Specific and Global Risk

  • 15.6 Worked Example: A Contaminant Near Its Legal Limit

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 15 Quiz

    10 attempts allowed

  • Chapter 16: Reporting Measurement Results

  • 16.1 What a Complete Report Contains

  • 16.2 Ways of Writing the Result

  • 16.3 Rounding

  • 16.4 The Uncertainty Budget Table

  • 16.5 Graphs with Error Bars

  • 16.6 A Report Generator

  • 16.7 A Checklist for Reports

  • 16.8 Closing Remarks

  • Key Takeaways

  • Further Reading

  • Exercises

  • Lesson 16 Quiz

    10 attempts allowed

  • Appendix A: Python Setup and Quick Reference

  • A.1 Installing the Tools

  • A.2 The uncertainties Package at a Glance

  • A.3 NumPy and SciPy Functions Used Most Often

  • Appendix B: Distributions and Coverage Factors

  • B.1 Standard Uncertainty from Common Distributions

  • B.2 Coverage Factors from the t Distribution

  • B.3 Key Formulas

  • Appendix D: Answers and Hints for Selected Exercises

  • Chapter 1

  • Chapter 2

  • Chapter 3

  • Chapter 4

  • Chapter 5

  • Chapter 6

  • Chapter 7

  • Chapter 8

  • Chapter 9

  • Chapter 10

  • Chapter 11

  • Chapter 12

  • Chapter 13

  • Chapter 14

  • Chapter 15

  • Chapter 16

  • Appendix E: Glossary

  • Appendix F: Notation

  • Appendix G: A Cookbook of Short Recipes

  • G.1 Readings from a Display That Barely Changes

  • G.2 Combining Several Results: Weighted Mean and Birge Ratio

  • G.3 Comparing Two Results: En and Zeta Scores

  • G.4 Interpolating in a Calibration Table

  • G.5 Sums, Differences, and Ratios from One Instrument

  • G.6 How Many Readings Are Enough?

  • G.7 Monte Carlo with an Implicit Model

  • G.8 Uncertainty of a Median by Bootstrap

  • G.9 Integrating Sampled Data

  • G.10 Saving Results with Their Correlations

  • Appendix H: Type B Inputs for Common Laboratory Equipment

  • H.1 Where the Numbers Come From

  • H.2 Effects That Are Easy to Forget

  • H.3 A Short Checklist for Type B Inputs

  • Appendix I: Choosing a Method — A Decision Guide

  • I.1 From Problem to Method

  • I.2 Which Tool for Which Situation

  • Appendix J: A Worked Template — Calibrating a Gauge Block

  • J.1 The Measurement

  • J.2 First-Order Evaluation

  • J.3 The Trap: Zero Sensitivity Is Not Zero Effect

  • J.4 Result and Lessons

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub