The FKMNonlinearHysteresisPlotter class

class pylife.stress.rainflow.fkm_nonlinear.FKMNonlinearHysteresisPlotter(hcm_point_history, ramberg_osgood_relation)[source]
__init__(hcm_point_history, ramberg_osgood_relation)[source]
interpolated_stress_strain_data(n_points_per_branch=100, only_hystereses=False)[source]

Return points on the traversed hysteresis curve, mainly intended for plotting. The curve including all hystereses, primary and secondary branches is sampled at a fixed number of points within each hysteresis branch. These points can be used for plotting.

The intended use is to generate plots as follows:

fkm_nonlinear_detector.process_hcm_first(...)
sampling_parameter = 100    # choose larger for smoother plot or smaller for lower runtime
plotting_data = detector.interpolated_stress_strain_data(sampling_parameter)

strain_values_primary = plotting_data["strain_values_primary"]
stress_values_primary = plotting_data["stress_values_primary"]
hysteresis_index_primary = plotting_data["hysteresis_index_primary"]
strain_values_secondary = plotting_data["strain_values_secondary"]
stress_values_secondary = plotting_data["stress_values_secondary"]
hysteresis_index_secondary = plotting_data["hysteresis_index_secondary"]

plt.plot(strain_values_primary, stress_values_primary, "g-", lw=3)
plt.plot(strain_values_secondary, stress_values_secondary, "b-.", lw=1)
Parameters:
  • n_points_per_branch (int, optional) – How many sampling points to use per hysteresis branch, default 100. A larger value values means smoother curves but longer runtime.

  • only_hystereses (bool, optional) – Default False. If only graphs of the closed hystereses should be output. Note that this does not work for hysteresis that have multiple smaller hysterseses included.

Returns:

plotting_data – A dict with the following keys:

  • ”strain_values_primary”

  • ”stress_values_primary”

  • ”hysteresis_index_primary”

  • ”strain_values_secondary”

  • ”stress_values_secondary”

  • ”hysteresis_index_secondary”

The values are lists of strains and stresses of the points on the stress-strain curve, separately for primary and secondary branches. The lists contain nan values whenever the curve of the same branch is discontinuous. This allows to plot the entire curve with different colors for primary and secondary branches.

The entries for hysteresis_index_primary and hysteresis_index_secondary are the row indices into the collective DataFrame returned by the recorder. This allows, e.g., to separate the output of multiple runs of the HCM algorithm or to plot the traversed paths on the stress-strain diagram for individual steps of the algorithm.

Return type:

dict