https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

SN_diagram

class reliability.PoF.SN_diagram(stress, cycles, stress_runout=None, cycles_runout=None, xscale='log', stress_trace=None, cycles_trace=None, show_endurance_limit=None, method_for_bounds='statistical', CI=0.95, **kwargs)

This function will plot the stress vs number of cycles (S-N) diagram when supplied with data from a series of fatigue tests.

Parameters:
  • stress (array, list) – The stress values at failure.

  • cycles (array, list) – The cycles values at failure. Must match the length of stress.

  • stress_runout (array, list, optional) – The stress values that did not result in failure. Optional input.

  • cycles_runout (array, list, optional) – The cycles values that did not result in failure. Optional input. If supplied, Must match the length of stress_runout.

  • xscale (str, optional) – The scale for the x-axis. Must be ‘log’ or ‘linear’. Default is ‘log’.

  • stress_trace (array, list, optional) – The stress values to be traced across to cycles values on the plot. Optional input.

  • cycles_trace (array, list, optional) – The cycles values to be traced across to stress values on the plot. Optional input.

  • show_endurance_limit (bool, optional) – This will adjust all lines of best fit to be greater than or equal to the average stress_runout. Defaults to False if stress_runout is not specified. Defaults to True if stress_runout is specified.

  • method_for_bounds (str, None, optional) – The method for the confidence bounds. Must be ‘statistical’, ‘residual’, or None. Defaults to ‘statistical’. If set to ‘statistical’ the CI value is used, otherwise it is not used for the ‘residual’ method. Residual uses the maximum residual datapoint for symmetric bounds. Setting the method for bounds to None will turn off the confidence bounds.

  • CI (float, optional) – The confidence interval. Must be between 0 and 1. Default is 0.95 for 95% confidence interval. Only used if method_for_bounds is ‘statistical’.

  • kwargs – Other plotting keywords (eg. color, linestyle, etc) are accepted and passed to matplotlib for the line of best fit.

Returns:

None – The plot is the only output. All calculated values are shown on the plot.

Notes

Example usage:

from reliability.PoF import SN_diagram
import matplotlib.pyplot as plt
stress = [340, 300, 290, 275, 260, 255, 250, 235, 230, 220, 215, 210]
cycles = [15000, 24000, 36000, 80000, 177000, 162000, 301000, 290000, 361000, 881000, 1300000, 2500000]
stress_runout = [210, 210, 205, 205, 205]
cycles_runout = [10 ** 7, 10 ** 7, 10 ** 7, 10 ** 7, 10 ** 7]
SN_diagram(stress=stress, cycles=cycles, stress_runout=stress_runout, cycles_runout=cycles_runout,method_for_bounds='residual',cycles_trace=[5 * 10 ** 5], stress_trace=[260])
plt.show()