The WoehlerCurve class
- class pylife.materiallaws.WoehlerCurve(pandas_obj)[source]
A PylifeSignal accessor for Wöhler Curve data.
Wöhler Curve (aka SN-curve) determines after how many load cycles at a certain load amplitude the component is expected to fail.
The signal has the following mandatory keys:
k_1: The slope of the Wöhler CurveND: The cycle number of the endurance limitSD: The load level of the endurance limit
The
_50suffixes imply that the values are valid for a 50% probability of failure.There are the following optional keys:
k_2The slope of the Wöhler Curve below the endurance limitIf the key is missing it is assumed to be infinity, i.e. perfect endurance
TNThe scatter in cycle direction, (N_90/N_10)If the key is missing it is assumed to be 1.0 or calculated from
TSif given.
TSThe scatter in cycle direction, (S_90/S_10)If the key is missing it is assumed to be 1.0 or calculated from
TNif given.
- property ND
- property SD
- property TN
The load direction scatter value TN.
- property TS
The load direction scatter value TS.
- basquin_cycles(load, failure_probability=0.5)[source]
Calculate the cycles numbers from loads according to the Basquin equation.
- Parameters:
load (array_like) – The load levels for which the corresponding cycle numbers are to be calculated.
failure_probability (float, optional) – The failure probability with which the component should fail when charged with load for the calculated cycle numbers. Default 0.5
- Returns:
cycles – The cycle numbers at which the component fails for the given load values
- Return type:
- basquin_load(cycles, failure_probability=0.5)[source]
Calculate the load values from loads according to the Basquin equation.
- Parameters:
cycles (array_like) – The cycle numbers for which the corresponding load levels are to be calculated.
failure_probability (float, optional) – The failure probability with which the component should fail when charged with load for the calculated cycle numbers. Default 0.5
- Returns:
cycles – The cycle numbers at which the component fails for the given load values
- Return type:
- broadcast(parameter, droplevel=None)
Broadcast the parameter to the object of
self.- Parameters:
parameters (scalar, numpy array or pandas object) – The parameter to broadcast to
- Returns:
parameter, object
- Return type:
index aligned numerical objects
Examples
The behavior of the Broadcaster is best illustrated by examples:
Broadcasting
pandas.Seriesto a scalar results in a scalar and apandas.Series.obj = pd.Series([1.0, 2.0], index=pd.Index(['foo', 'bar'], name='idx')) obj
idx foo 1.0 bar 2.0 dtype: float64
parameter, obj = Broadcaster(obj).broadcast(5.0) parameter
array(5.)
objidx foo 1.0 bar 2.0 dtype: float64
Broadcasting
pandas.DataFrameto a scalar results in apandas.DataFrameand apandas.Series.obj = pd.DataFrame({ 'foo': [1.0, 2.0], 'bar': [3.0, 4.0] }, index=pd.Index([1, 2], name='idx')) obj
foo bar idx 1 1.0 3.0 2 2.0 4.0 parameter, obj = Broadcaster(obj).broadcast(5.0) parameter
idx 1 5.0 2 5.0 dtype: float64
objfoo bar idx 1 1.0 3.0 2 2.0 4.0 Broadcasting
pandas.DataFrameto a apandas.Seriesresults in apandas.DataFrameand apandas.Series, if and only if the index name of the object isNone.obj = pd.Series([1.0, 2.0], index=pd.Index(['tau', 'chi'])) obj
tau 1.0 chi 2.0 dtype: float64
parameter = pd.Series([3.0, 4.0], index=pd.Index(['foo', 'bar'], name='idx')) parameter
idx foo 3.0 bar 4.0 dtype: float64
parameter, obj = Broadcaster(obj).broadcast(parameter) parameter
idx foo 3.0 bar 4.0 dtype: float64
objtau chi idx foo 1.0 2.0 bar 1.0 2.0
- cycles(load, failure_probability=0.5)[source]
Calculate the cycles numbers from loads.
- Parameters:
load (array_like) – The load levels for which the corresponding cycle numbers are to be calculated.
failure_probability (float, optional) – The failure probability with which the component should fail when charged with load for the calculated cycle numbers. Default 0.5
- Returns:
cycles – The cycle numbers at which the component fails for the given load values
- Return type:
Notes
By default the calculation is performed according to the Basquin equation using
basquin_cycles(). Derived classes can choose to override this in order to implement a different fatigue law.
- fail_if_key_missing(keys_to_check, msg=None)
Raise an exception if any key is missing in a self._obj object.
- Parameters:
self._obj (pandas.DataFrame or pandas.Series) – The object to be checked
keys_to_check (list) – A list of keys that need to be available in self._obj
- Raises:
AttributeError – if self._obj is neither a pandas.DataFrame nor a pandas.Series
AttributeError – if any of the keys is not found in the self._obj’s keys.
Notes
If self._obj is a pandas.DataFrame, all keys of keys_to_check meed to be found in the self._obj.columns.
If self._obj is a pandas.Series, all keys of keys_to_check meed to be found in the self._obj.index.
See also
get_missing_keys(),stresssignal.StressTensorVoigt
- property failure_probability
- classmethod from_parameters(**kwargs)
Make a signal instance from a parameter set.
This is a convenience function to instantiate a signal from individual parameters rather than pandas objects.
A signal class like
@pd.api.extensions.register_dataframe_accessor('foo_signal') class FooSignal(PylifeSignal): pass
The following two blocks are equivalent:
pd.Series({'foo': 1.0, 'bar': 2.0}).foo_signal
FooSignal.from_parameters(foo=1.0, bar=1.0)
- get_missing_keys(keys_to_check)
Get a list of missing keys that are needed for a self._obj object.
- Parameters:
keys_to_check (list) – A list of keys that need to be available in self._obj
- Returns:
missing_keys – a list of missing keys
- Return type:
- Raises:
AttributeError – if self._obj is neither a pandas.DataFrame nor a pandas.Series
Notes
If self._obj is a pandas.DataFrame, all keys of keys_to_check not found in the self._obj.columns are returned.
If self._obj is a pandas.Series, all keys of keys_to_check not found in the self._obj.index are returned.
- property k_1
The second Wöhler slope.
- property k_2
The second Wöhler slope.
- keys()
Get a list of missing keys that are needed for a signal object.
- Returns:
keys – a pandas index of keys
- Return type:
pd.Index
- Raises:
AttributeError – if self._obj is neither a pandas.DataFrame nor a pandas.Series
Notes
If self._obj is a pandas.DataFrame, the self._obj.columns are returned.
If self._obj is a pandas.Series, the self._obj.index are returned.
- load(cycles, failure_probability=0.5)[source]
Calculate the load values from loads.
- Parameters:
cycles (array_like) – The cycle numbers for which the corresponding load levels are to be calculated.
failure_probability (float, optional) – The failure probability with which the component should fail when charged with load for the calculated cycle numbers. Default 0.5
- Returns:
cycles – The cycle numbers at which the component fails for the given load values
- Return type:
Notes
By default the calculation is performed according to the Basquin equation using
basquin_cycles(). Derived classes can choose to override this in order to implement a different fatigue law.
- miner_elementary()[source]
Set k_2 to k_1 according Miner Elementary method (k_2 = k_1).
- Return type:
self
- miner_haibach()[source]
Set k_2 to value according Miner Haibach method (k_2 = 2 * k_1 - 1).
- Return type:
self
- to_pandas()
Expose the pandas object of the signal.
- Returns:
pandas_object – The pandas object representing the signal
- Return type:
pd.DataFrame or pd.Series
Notes
The default implementation just returns the object given when instantiating the signal class. Derived classes may return a modified object or augmented, if they store some extra information.
By default the object is not copied. So make a copy yourself, if you intent to modify it.