The FKMNonlinearDetector class

class pylife.stress.rainflow.fkm_nonlinear.FKMNonlinearDetector(recorder, notch_approximation_law, binner=<class 'pylife.materiallaws.notch_approximation_law.NotchApproxBinner'>)[source]

HCM-Algorithm detector as described in FKM nonlinear.

__init__(recorder, notch_approximation_law, binner=<class 'pylife.materiallaws.notch_approximation_law.NotchApproxBinner'>)[source]

Instantiate an AbstractDetector.

Parameters:

recorder (subclass of AbstractRecorder) – The recorder that the detector will report to.

history()[source]

Compile the history of noteworthy points.

Returns:

history – The history containing of load, stress, strain and secondary_branch. The secondary_branch column is bool and indicates if the point is on secondary load branch.

The index consists of the following levels:
  • load_segment: the number of the point

  • load_step: the index of the point in the actual samples

  • run_index: the index of the run (usually 1 or 2)

  • turning_point: the number of the turning point (-1 if it is not a turning point)

  • hyst_from: the number of the hysteresis starting at the point (-1 if there isn’t one)

  • hyst_to: the number of the hysteresis opened at the point (-1 if there isn’t one)

  • hyst_close: the number hof the hysteresis closed at the point (-1 if there isn’t one)

Return type:

pd.DataFrame

Notes

The history contains all the turning points with two other kinds of points injected:
  • The primary hysteresis opening (Memory 3 of the guidline)

  • The closing points of a hysteresis

Note that the load_step index of the injected points is always -1, so you can’t use it to determine the index of a hysteresis closing in the original signal.

interpolated_stress_strain_data(*, load_segment=None, hysteresis_index=None, n_points_per_branch=100)[source]

Caclulate interpolated stress and strain data.

Parameters:
  • load_segment (int, Optional) – The number of the load segment for which the stress strain data is to be interpolated.

  • hysteresis_index (int, Optional) – The number of the hysteresis for which the stress strain data is to be interpolated.

  • n_points_per_branch (int, Optional) – The number of points to be interpolated to of each load segment

Returns:

stress_strain_data

The resulting DataFrame will contain the following columns:

  • stress, strain – the stress strain data

  • secondary_branch– a bool column indicating if the point is on a secondary load branch

  • hyst_index – the number of the hysteresis the load segment is part of (-1 if there isn’t one)

  • load_segment the number of the load segment

  • run_index the number of the run

Return type:

pd.DataFrame

process(samples, flush=False)[source]

Process a sample chunk. This method implements the actual HCM algorithm.

Parameters:
  • samples (array_like, shape (N, )) – The samples to be processed

  • flush (bool) –

    Whether to flush the cached values at the end.

    For explanations see process()

Returns:

self – The self object so that processing can be chained

Return type:

FKMNonlinearDetector

process_hcm_first(samples)[source]

Perform the HCM algorithm for the first time. This processes the given samples accordingly, only considering “turning points”, neglecting consecutive duplicate values, making sure that the beginning starts with 0.

Parameters:

samples (list of floats or list of pd.DataFrame`s) – The samples to be processed by the HCM algorithm.

process_hcm_second(samples)[source]

Perform the HCM algorithm for the second time, after it has been executed with process_hcm_first. This processes the given samples accordingly, only considering “turning points”, neglecting consecutive duplicate values, making sure that the beginning of the sequence is properly fitted to the samples of the first run, such that no samples are lost and no non-turning points are introducted between the two runs.

Parameters:

samples (list of floats or list of pd.DataFrame`s) – The samples to be processed by the HCM algorithm.

property strain_values

Get the strain values of the turning points in the stress-strain diagram. They are needed in the FKM nonlinear roughness & surface layer algorithm, which adds residual stresses in another pass of the HCM algorithm.

Returns:

The strain values of the turning points that are visited during the HCM algorithm.

Return type:

list of float

property strain_values_first_run

Get the strain values of the turning points in the stress-strain diagram, for the first run of the HCM algorithm. They are needed in the FKM nonlinear roughness & surface layer algorithm, which adds residual stresses in another pass of the HCM algorithm.

Returns:

The strain values of the turning points that are visited during the first run of the HCM algorithm.

Return type:

list of float

property strain_values_second_run

Get the strain values of the turning points in the stress-strain diagram, for the second and any further run of the HCM algorithm. They are needed in the FKM nonlinear roughness & surface layer algorithm, which adds residual stresses in another pass of the HCM algorithm.

Returns:

The strain values of the turning points that are visited during the second run of the HCM algorithm.

Return type:

list of float