mpylab.tools.uncertain module

Compatibility imports for uncertainty statistics.

New code should import these functions from mpylab.tools.stats.

mpylab.tools.uncertain.get_dB_factors(dB, k, A=10)

Convert a linear coverage factor into asymmetric dB factors.

Parameters:
  • dB (float) – Standard uncertainty represented on the logarithmic scale.

  • k (float) – Coverage factor on the linear scale.

  • A (float, optional) – Logarithmic conversion factor, normally 10 for power quantities and 20 for amplitude quantities.

Returns:

Lower and upper coverage factors on the dB scale.

Return type:

tuple of float

mpylab.tools.uncertain.get_k_factor(*args, coverage=0.95, both_tails=True, dist=None, **kwargs)

Return the coverage factor of a SciPy probability distribution.

Parameters:
  • *args (object) – Positional shape parameters passed to the distribution.

  • coverage (float, optional) – Requested probability coverage.

  • both_tails (bool, optional) – Split the excluded probability equally between both tails. If false, only the upper tail is excluded.

  • dist (str, optional) – Name of a distribution in scipy.stats; defaults to "norm".

  • **kwargs (object) – Keyword shape parameters passed to the distribution.

Returns:

Quantile corresponding to the requested coverage.

Return type:

float

Raises:

AttributeError – If the distribution does not exist or has no ppf method.

mpylab.tools.uncertain.get_k_factor_norm(coverage=0.95, both_tails=True)

Return the normal-distribution coverage factor.

Parameters:
  • coverage (float, optional) – Requested probability coverage.

  • both_tails (bool, optional) – Whether to split excluded probability between both tails.

Returns:

Normal-distribution quantile for the requested coverage.

Return type:

float

mpylab.tools.uncertain.get_k_factor_rect(coverage=0.95, both_tails=True)

Return the rectangular-distribution coverage factor.

Parameters:
  • coverage (float, optional) – Requested probability coverage.

  • both_tails (bool, optional) – Whether to split excluded probability between both tails.

Returns:

Rectangular-distribution coverage factor.

Return type:

float

mpylab.tools.uncertain.get_k_factor_ushape(coverage=0.95, both_tails=True)

Return the U-shaped-distribution coverage factor.

Parameters:
  • coverage (float, optional) – Requested probability coverage.

  • both_tails (bool, optional) – Whether to split excluded probability between both tails.

Returns:

U-shaped-distribution coverage factor.

Return type:

float