Skip to content

measurement_uncertainty

measurement_uncertainty ¤

MeasurementUncertaintyEvents ¤

MeasurementUncertaintyEvents(
    dataframe: DataFrame,
    signal_uuid: str,
    *,
    value_column: str = "value_double",
    part_uuid: str | None = None,
    event_uuid: str = "quality:uncertainty",
    time_column: str = "systime"
)

Bases: Base

Quality: GUM-based Measurement Uncertainty Estimation

Compute Type A (statistical) and Type B (external sources) uncertainty, combined and expanded uncertainty, and uncertainty budgets per ISO/IEC Guide 98-3 (GUM).

Methods: - type_a_uncertainty: Statistical uncertainty from repeated measurements. - type_b_uncertainty: Uncertainty from calibration certs, resolution, etc. - combined_uncertainty: Root-sum-of-squares combination with expansion. - uncertainty_budget: Contribution breakdown by source.

part_uuid is deprecated: it has no effect (no method groups by part) and will be removed in the next major release; passing it emits a DeprecationWarning.

type_a_uncertainty ¤

type_a_uncertainty(window: str = '8h') -> pd.DataFrame

Statistical (Type A) uncertainty from repeated measurements.

u_A = std / sqrt(n) per time window.

Parameters:

Name Type Description Default
window str

Resample window size.

'8h'

Returns:

Type Description
DataFrame

Summary DataFrame with columns: start, end, duration_seconds

DataFrame

(the window bounds), window_start (the resample label; a

DataFrame

deprecated twin of start), mean, std, n_samples,

DataFrame

type_a_uncertainty.

DataFrame

Canonical twin columns: sample_count (after n_samples); each holds

DataFrame

the same values as the deprecated column right before it, which is removed

DataFrame

in the next major release.

type_b_uncertainty staticmethod ¤

type_b_uncertainty(
    sources: list[dict[str, Any]],
) -> pd.DataFrame

Type B uncertainty from external sources (GUM method).

Parameters:

Name Type Description Default
sources list[dict[str, Any]]

List of dicts, each with: - 'source': str (name, e.g. 'calibration', 'resolution') - 'half_width': float (half-width of distribution) - 'distribution': str ('rectangular', 'triangular', 'normal', 'u-shaped')

required

Returns:

Type Description
DataFrame

DataFrame with columns: source, distribution, half_width,

DataFrame

divisor, type_b_uncertainty.

combined_uncertainty ¤

combined_uncertainty(
    window: str = "8h",
    type_b_sources: list[dict[str, Any]] | None = None,
    coverage_factor: float = 2.0,
) -> pd.DataFrame

Combined and expanded uncertainty (GUM).

u_c = sqrt(u_A² + sum(u_Bi²)) U = k × u_c

Parameters:

Name Type Description Default
window str

Resample window size.

'8h'
type_b_sources list[dict[str, Any]] | None

Type B sources (same format as type_b_uncertainty).

None
coverage_factor float

k value for expanded uncertainty (default 2.0 for ~95.45% coverage).

2.0

Returns:

Type Description
DataFrame

Summary DataFrame with columns: start, end, duration_seconds

DataFrame

(the window bounds), window_start (the resample label; a

DataFrame

deprecated twin of start), type_a, type_b_combined,

DataFrame

combined_uncertainty, expanded_uncertainty, coverage_factor.

uncertainty_budget ¤

uncertainty_budget(
    window: str = "8h",
    type_b_sources: list[dict[str, Any]] | None = None,
) -> pd.DataFrame

Uncertainty budget — contribution breakdown by source.

Shows which uncertainty source dominates (repeatability vs resolution vs calibration, etc).

Parameters:

Name Type Description Default
window str

Resample window size (uses mean Type A across windows).

'8h'
type_b_sources list[dict[str, Any]] | None

Type B sources.

None

Returns:

Type Description
DataFrame

DataFrame with columns: source, uncertainty, pct_contribution.

DataFrame

Canonical twin columns: contribution_pct (after pct_contribution);

DataFrame

each holds the same values as the deprecated column right before it, which

DataFrame

is removed in the next major release.