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.
ProbabilityFittransforms 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 withpylife.utils.functions.rossow_cumfreqs().- Parameters:
probs (array_like) – Estimated cumulative probabilities of the sorted sample values. Values should lie between
0and1.occurrences (array_like) – Positive sample values, usually fatigue lives or strengths, in the same order as
probs.
- Raises:
ValueError – Raised if
probsandoccurrenceshave different lengths or if fewer than two data points are supplied.
Notes
The fitted probability-paper line is
percentile = slope * log10(occurrence) + intercept. Plotpercentilesversuslog10(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:
- 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:
- 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: