Skip to content

ump_spec.rules.intervals

module ump-spec

Interval helpers: envelopes, widening, width labels, imputed bands, audit level min (G-AUD-01).

function

def z_for_level(level: float) -> float

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 23

function

def envelope(intervals: Iterable[Interval], *, level: float | None = None) -> Interval

Smallest interval covering every input (used for assumed alignments and dependence). level is the declared level to report (spec §5 rule 4: the envelope keeps the declared level); without it the highest input level is reported.

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 27

function

def widen(interval: Interval, factor: float, center: float | None = None) -> Interval

Scale each side’s distance from center (default midpoint) by factor.

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 38

function

def widen_beyond(interval: Interval, value: float, factor: float = 2.0) -> Interval

G-SCN-03: interval doubled beyond seen spend (around the point value).

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 45

function

def impute_band(
value: float,
rel_half_width: float = DEFAULT_IMPUTED_REL_HALF_WIDTH,
level: float = 0.9,
library_sd: float | None = None,
) -> Interval

G-UNC-01 imputation: from the library spread (sd on the value scale) if known, else a proposed tier-default relative band.

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 50

function

def relative_width(value: float, interval: Interval) -> float

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 61

function

def width_label(value: float, interval: Interval) -> str

narrow (<= .35), moderate (<= .70), wide; relative to |value|. Cut points proposed.

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 67

function

def audit_level_min(levels: Iterable[int]) -> int

G-AUD-01: an artifact’s audit level is the lowest of its inputs (1 if no inputs known).

Source: packages/ump-spec/src/ump_spec/rules/intervals.py, line 77

NameTypeValueDescription
WIDTH_CUTSdict[str, float]{'narrow': 0.35, 'moderate': 0.7}Relative width cut points, proposed (UI convention, not from a study).
WIDTH_CUTS_PROPOSEDTrue
DEFAULT_IMPUTED_REL_HALF_WIDTH0.5Proposed tier-default band when no uncertainty and no library spread exist (G-UNC-01).
DEFAULT_UNDECLARED_WIDEN1.5Proposed widening factor for an assumed estimand field with no registered alternatives (spec §5 rule 4, method imputed). Mirrors envelope.widen_factor in registries/source_types.yaml, which rules.estimands.widen_factor reads (with a per-source override); kept for callers that widen later.