tolerancing.tolerance#
Tolerance Module
This module contains the Tolerance class: a signed deviation from nominal,
bounded by a lower and an upper limit and drawn from a distribution. Unlike a
Perturbation, which sets absolute values of an optimization variable, a
tolerance is defined the way a drawing or a shop states it, e.g. ±0.05.
Kramer Harrison, 2026
Classes
|
A signed deviation from nominal between two limits. |
- class Tolerance(tolerance_type: ToleranceType, minus: float, plus: float, distribution: str | Distribution = 'normal')[source]#
A signed deviation from nominal between two limits.
- Parameters:
tolerance_type – The bound tolerance type that applies the deviation.
minus – The lower limit (signed, usually negative).
plus – The upper limit (signed, usually positive).
distribution – The distribution used by Monte Carlo analyses, as a name or a
Distributioninstance. Defaults to"normal", a normal distribution truncated at the limits, with the limits at ±2σ.
- Variables:
type – The bound tolerance type.
minus – The lower limit.
plus – The upper limit.
distribution – The distribution instance.
value (float | None) – The deviation applied last, or 0.0 at nominal.
- Raises:
ValueError – If
minusis greater thanplus.
- apply(rng: np.random.Generator | None = None) None[source]#
Draw a deviation from the distribution and apply it.
- Parameters:
rng – Generator to draw from. Defaults to the tolerance’s own.
- apply_value(delta: float) None[source]#
Apply a given deviation from nominal.
- Parameters:
delta – The signed deviation, in the units of the tolerance type.
- property phase: Phase#
Return the phase of the underlying tolerance type.