The utils.probability_data module#

Provide probability-paper fitting helpers for fatigue samples.

class pylife.utils.probability_data.ProbabilityFit(probs, occurrences)[source]#

Fit occurrence samples for a normal probability-paper plot.

ProbabilityFit transforms cumulative probabilities with the standard normal percent point function and fits a straight line against the base-10 logarithm of the occurrence values. Use it for fatigue test data after sorting the measured occurrences and estimating their cumulative frequencies, for example with pylife.utils.functions.rossow_cumfreqs().

Parameters:
  • probs (array_like) – Estimated cumulative probabilities of the sorted sample values. Values should lie between 0 and 1.

  • occurrences (array_like) – Positive sample values, usually fatigue lives or strengths, in the same order as probs.

Raises:

ValueError – Raised if probs and occurrences have different lengths or if fewer than two data points are supplied.

Notes

The fitted probability-paper line is percentile = slope * log10(occurrence) + intercept. Plot percentiles versus log10(occurrences) together with this line to inspect whether the data are compatible with a log-normal model.

Examples

>>> from pylife.utils.probability_data import ProbabilityFit
>>> from pylife.utils.functions import rossow_cumfreqs
>>> occurrences = np.array([1.0e4, 2.0e4, 4.0e4])
>>> fit = ProbabilityFit(rossow_cumfreqs(len(occurrences)), occurrences)
>>> round(float(fit.slope), 6)
2.795805
>>> [round(float(value), 6) for value in fit.percentiles]
[-0.841621, 0.0, 0.841621]
property intercept#

Return the intercept of the fitted probability-paper line.

Returns:

Standard-normal percentile at log10(occurrence) == 0.

Return type:

float

property occurrences#

Return the occurrence sample values used for the fit.

Returns:

Sample values passed to the fit, usually fatigue lives or strengths.

Return type:

numpy.ndarray

property percentiles#

Return standard-normal percentiles of the cumulative probabilities.

Returns:

Values computed as scipy.stats.norm.ppf(probs) for the probabilities supplied to the fit.

Return type:

numpy.ndarray

property slope#

Return the slope of the fitted probability-paper line.

Returns:

Change in standard-normal percentile per decade of occurrence.

Return type:

float