exmecheva.bending package

Submodules

exmecheva.bending.attr_bgl module

Global attributes for bending modules.

@author: MarcGebhardt

exmecheva.bending.bfunc_class module

Classes for bending functions.

@author: MarcGebhardt

class exmecheva.bending.bfunc_class.Bend_func_cohort(d0=None, d1=None, d2=None, name=None, **kws)[source]

Bases: object

Function collection of Subfunctions (Bend_func_sub)

Init_fandds(expr_d0, var_names, var='x', var_types=None, option='d0_str_to_all', expr_d1=None, expr_d2=None, func_d0=None, func_d1=None, func_d2=None)[source]

Return Sympy expressions and associated lambdified functions, depending on option-string.

Parameters
  • expr_d0 (string or sympy.expression) – String or expression, which determine function.

  • var_names (TYPE) – Variable names for parsing.

  • var (TYPE, optional) – Variable name for derivation. The default is ‘x’.

  • option (string, optional) – Option of function generation, in form of which(d0/each)_type(str/expr)_to_what(d0/all). The default is ‘d0_str_to_all’.

  • expr_d1 (string or sympy.expression, optional) – String or expression, which determine 1st derivate of function. The default is None.

  • expr_d2 (string or sympy.expression, optional) – String or expression, which determine 2nd derivate of function. The default is None.

Raises

NotImplementedError – Error for not implemented option.

Returns

func_package – A function collection of all generated sympy expressions and associated lambdified functions and their 1st and 2nd derivates.

Return type

Bend_func_cohort

class exmecheva.bending.bfunc_class.Bend_func_legion(name=None, description=None, **kws)[source]

Bases: object

Bend line describing functions and their 1st and 2nd derivates .. rubric:: Example

bl=Bend_func_legion(name=’FSE fit’) bl.Builder(option=’FSE’)

Builder(option='FSE')[source]

Build an instance of Bend per option to prepare fit of measured bend line.

Parameters

option (string, optional) – Kind of . The default is ‘FSE’.

Raises

NotImplementedError – Building option not implemented.

Return type

None.

class exmecheva.bending.bfunc_class.Bend_func_sub(func, sy_expr, sy_string, independent_vars=None, param_names=None, param_types=None, name=None, **kws)[source]

Bases: object

Lowest element which provides necessary function informations.

__call__(x, kws, **opts)[source]

Call and evaluate underlayed function. If x is an array of float and kws is a OrderedDict, result will be an array of float. If x is a Dataframe or float and kws is a Series, evaluates each index in kws.

Parameters
  • x (array of float | Dataframe of type Points) – Independet variables to evaluate function.

  • **kws (OrderedDict | Series of OrderedDicts) – Additional keyword arguments to pass to func (p.e. parameter value dictionary).

Returns

Evaluation values of function to x and kws.

Return type

array of float

exmecheva.bending.bfunc_com module

General functions for bending.

@author: MarcGebhardt

exmecheva.bending.bfunc_com.Shear_area(Area, CS_type='Rectangle', kappa=None)[source]

Returns the shear area of a cross section.

Parameters
  • Area (float or function or 1) – Cross section area.

  • CS_type (string, optional) – Cross section type. The default is ‘Rectangle’.

  • kappa (float, optional) – Correction factor shear area. Depending to CS_type. The default is None.

Returns

AreaS – Shear area.

Return type

same type as Area

exmecheva.bending.bfunc_com.gamma_V_det(poisson, t_mean, Length, CS_type='Rectangle', kappa=None)[source]

Returns the ratio between shear to entire deformation in mid of bending beam.

Parameters
  • poisson (float) – Poisson’s ratio.

  • t_mean (float) – Mean thickness.

  • Length (float) – Distance between load bearings.

  • CS_type (string, optional) – Cross section type. The default is ‘Rectangle’.

  • kappa (float, optional) – Correction factor shear area. Depending to CS_type. The default is None.

Returns

gamma_V – Ratio between shear to entire deformation in mid of bending beam.

Return type

float

exmecheva.bending.bfunc_com.triangle_func_d0(x, xmin, xmax, f_0)[source]

Standard triangle function with maximum in middle between min. and max. x coordinate.

exmecheva.bending.bfunc_com.triangle_func_d1(x, xmin, xmax, f_0)[source]

First derivate of standard triangle function.

exmecheva.bending.bfunc_com.triangle_func_d2(x, xmin, xmax, f_0)[source]

Second derivate of standard triangle function (equal 0).

exmecheva.bending.bfunc_fse module

Specific fourier series expansion functions for bending.

@author: MarcGebhardt

exmecheva.bending.bfunc_fse.FSE_4sin_d0(x, xmin, xmax, FP, b1, b2, b3, b4, c=None, d=None, f_V_0=None)[source]

Fourier series expansion with four sine elements without additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_d1(x, xmin, xmax, FP, b1, b2, b3, b4, c=None, d=None, f_V_0=None)[source]

First deriavate of Fourier series expansion with four sine elements without additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_d2(x, xmin, xmax, FP, b1, b2, b3, b4, c=None, d=None, f_V_0=None)[source]

Second deriavate of Fourier series expansion with four sine elements without additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_lin_func_d0(x, c, d, xmin=None, xmax=None, FP=None, b1=None, b2=None, b3=None, b4=None, f_V_0=None)[source]

Linear part of fourier series expansion with four sine elements and additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_lin_func_d1(x, c, d=None, xmin=None, xmax=None, FP=None, b1=None, b2=None, b3=None, b4=None, f_V_0=None)[source]

First deriavate of linear part of fourier series expansion with four sine elements and additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_lin_func_d2(x, c=None, d=None, xmin=None, xmax=None, FP=None, b1=None, b2=None, b3=None, b4=None, f_V_0=None)[source]

Second deriavate of linear part of fourier series expansion with four sine elements and additional linear and constant element. For more information see FSE_4sin_wlin_d0. (Equal 0)

exmecheva.bending.bfunc_fse.FSE_4sin_wlin_d0(x, xmin, xmax, FP, b1, b2, b3, b4, c, d, f_V_0=None)[source]

Fourier series expansion with four sine elements and additional linear and constant element. Defined as:

\[f(x; b1,b2,b3,b4,b5,c,d) = b1 \sin (\pi / (xmax-xmin) (x-xmin)) + b2 \sin (2 \pi / (xmax-xmin) (x-xmin)) + b3 \sin (3 \pi / (xmax-xmin) (x-xmin)) + b4 \sin (4 \pi / (xmax-xmin) (x-xmin)) +c (x-xmin) + d\]

with sine-parameters for \(b1,b2,b3,b4\), slope for \(c\) and intercept for \(d\).

Parameters
  • x (array of float) – Array of cartesian coordinates in x-direction.

  • xmin (float) – Cartesian coordinate in x-direction of start of function (curvature=0, p.e. left bearing). Defines length of Fourier series expansion with xmax-xmin.

  • xmax (float) – Cartesian coordinate in x-direction of end of function (curvature=0, p.e. right bearing). Defines length of Fourier series expansion with xmax-xmin.

  • b1 (float) – Parameter of first sine element.

  • b2 (float) – Parameter of second sine element.

  • b3 (float) – Parameter of third sine element.

  • b4 (float) – Parameter of fourth sine element.

  • c (float) – Parameter of slope.

  • d (float) – Parameter of intercept.

Returns

eq – Fourier series expansion with four sine elements and additional linear and constant element.

Return type

Function

exmecheva.bending.bfunc_fse.FSE_4sin_wlin_d1(x, xmin, xmax, FP, b1, b2, b3, b4, c, d=None, f_V_0=None)[source]

First derivate of fourier series expansion with four sine elements and additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_4sin_wlin_d2(x, xmin, xmax, FP, b1, b2, b3, b4, c=None, d=None, f_V_0=None)[source]

Second derivate of fourier series expansion with four sine elements and additional linear and constant element. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_SF_func_d0(x, xmin, xmax, f_V_0, FP=None, b1=None, b2=None, b3=None, b4=None, c=None, d=None, opt=None)[source]

Shear deformation part of ourier series expansion with four sine elements and additional linear and constant element. Children of triangle_func_d0. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_SF_func_d1(x, xmin, xmax, f_V_0, FP=None, b1=None, b2=None, b3=None, b4=None, c=None, d=None, opt=None)[source]

First derivate of shear deformation part of ourier series expansion with four sine elements and additional linear and constant element. Children of triangle_func_d1. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.bfunc_fse.FSE_SF_func_d2(x, xmin, xmax, f_V_0, FP=None, b1=None, b2=None, b3=None, b4=None, c=None, d=None, opt=None)[source]

Second derivate of shear deformation part of ourier series expansion with four sine elements and additional linear and constant element. Children of triangle_func_d1. For more information see FSE_4sin_wlin_d0.

exmecheva.bending.evaluation module

Evaluation functionality for bending.

@author: MarcGebhardt

exmecheva.bending.evaluation.Moment_perF_func(x, xmin, xmax, Test_type='TPB')[source]

Returns a by force scaleable moment function.

exmecheva.bending.evaluation.Weight_func(x, option='Triangle', c_func=None, **kwargs)[source]

Returns a weighting function by given options and parameters.

Parameters
  • x (float) – Coordinate in x direction.

  • option (string, optional) –

    Choosen option. Possible are:

    • ’Cut’: Excluding values outside range of xmin to xmax

      (weight equal 0).

    • ’Triangle’: Weighing to triangle function with maximum in the

      middle between xmin and xmax.

    • ’Triangle_cut’: Mixture of ‘Triangle’ and ‘Cut’.

    • ’Custom’: Weighing to custom function (p.e. displacement funtion).

    • ’Custom_cut’: Mixture of ‘Custom’ and ‘Cut’.

    The default is ‘Triangle’.

  • c_func (function, optional) – Custom function for weighing (p.e. displacement funtion). The default is None.

  • **kwargs (dict) –

    Keyword arguments for custom function (p.e. displacement

    function parameters).

Raises

NotImplementedError – Option not implemented.

Returns

eq – Weights.

Return type

float

exmecheva.bending.evaluation.YM_check_many_with_method_D(E_dict, F, Length, I_func, w_func, w_params, rel_steps=None, n=100, pb_b=True, name='X')[source]

Compares the deformation of the analytical bending line (method D), scaled by elastic modulus determined by methods, with the measured bending line. Returns global mean, local (midspan) mean and complete (n-positions) deviation, as well as the scaled analytical bending line, for each specified step.

Parameters
  • E_dict (dict) – Dictionary of moduli of elasticity by determination method.

  • F (pandas.Series) – Series of force (or force increment).

  • Length (float) – Testing length.

  • I_func (TYPE) – Function of Moment of Inertia.

  • w_func (Bend_func_sub) – Bending function.

  • w_params (pd.Series of dict) – Parameters per step for bending function (w_func).

  • rel_steps (pandas.Index or numpy array, optional) – Relevant steps. The default is None.

  • n (integer, optional) – Number of determination points. The default is 100.

  • pb_b (boolean, optional) – Switch progress bar output. The default is True.

  • name (string, optional) – Name of executed check. The default is ‘X’.

Returns

  • check_EtoD_g (pandas.Dataframe) – Global (total length) mean deviation of scaled analytical and measured deformation.

  • check_EtoD_x (pandas.Dataframe) – Local (midspan) mean deviation of scaled analytical and measured deformation.

  • check_E (dictionary of pandas.Dataframe) – Deviation of scaled analytical and measured deformation.

  • w_D_to_E (dictionary of pandas.Dataframe) – Scaled analytical defeormation by method.

exmecheva.bending.evaluation.YM_check_with_method_D(E, F, Length, I_func, w_vgl_df, pb_b=True, name='X')[source]

Compares the deformation of the analytical bending line (method D), scaled by elastic modulus determined by methods, with the measured bending line.

Parameters
  • E (float) – Elastic modulus.

  • F (float) – Force (or force increment).

  • Length (float) – Testing length.

  • I_func (TYPE) – Function of Moment of Inertia.

  • w_func (Bend_func_sub) – Bending function.

  • w_params (pd.Series of dict) – Parameters per step for bending function (w_func).

  • rel_steps (pandas.Index or numpy array, optional) – Relevant steps. The default is None.

  • n (integer, optional) – Number of determination points. The default is 100.

  • pb_b (boolean, optional) – Switch progress bar output. The default is True.

  • name (string, optional) – Name of executed check. The default is ‘X’.

Returns

  • check_E (pandas.Dataframe) – Deviation of scaled analytical and measured deformation.

  • w_D_to_E (pandas.Dataframe) – Scaled analytical defeormation.

exmecheva.bending.evaluation.YM_eva_method_A(stress_mid_ser, strain_mid_ser, comp=True, name='A', det_opt='incremental', **kws)[source]

Calculates Young’s Modulus by rise of stress to strain in midspan over defined range with definable method. Children of Evac.YM_eva_com_sel.

Parameters
  • stress_mid_ser (pd.Series) – Series with stress values in midspan corresponding strain_ser.

  • strain_mid_ser (pd.Series) – Series with strain values in midspan corresponding stress_ser.

  • comp (boolean, optional) – Compression mode. The default is True.

  • name (string, optional) – Name of operation. The default is ‘A’.

  • det_opt (TYPE, optional) – Definable method for determination. Ether incremental or leastsq. The default is ‘incremental’.

  • **kws (dict) – Keyword dict for least-square determination.

Returns

  • det_opt == “incremental” –

    YM_serpd.Series

    Series of Young’s Moduli.

  • or

  • det_opt == “leastsq” –

    YMfloat

    Youngs Modulus (corresponds to slope of linear fit).

    YM_absfloat

    Stress value on strain origin (corresponds to interception of linear fit).

    YM_Rquadfloat

    Coefficient of determination.

    YM_fitlmfit.model.ModelResult

    Fitting result from lmfit (use with fit.fit_report() for report).

exmecheva.bending.evaluation.YM_eva_method_B(stress_mid_ser, thickness, Length, option='Points', P_df=None, P_fork_names=None, w_func=None, w_params=None, Length_det=None, comp=True, name='B', det_opt='incremental', **kws)[source]

Calculates Young’s Modulus by rise of stress to strain, calculated by optical counterpart to traditional fork transducer, over defined range with definable method.

Parameters
  • stress_mid_ser (pandas.Series) – Series with stress values in midspan corresponding strain_ser.

  • thickness (np.poly1d function) – Function of thickness to span.

  • Length (float) – Length of span.

  • option (string, optional) – Input option, ether “Points”, for a Dataframe of three points, or “Fit”, for a fitted bend line. The default is “Points”.

  • P_df (pandas.DataFrame, optional) – Dataframe of Points. The default is None.

  • P_fork_names (array of string, optional) – Names of points in P_df in form of [left, mid, right]. The default is None.

  • w_func (function, optional) – Function of bending line. The default is None.

  • w_params (array or pandas.Series, optional) – Parameters of function of bending line per step. The default is None.

  • Length_det (float, optional) – Determination length between left and right point to calculate. The default is None.

  • comp (boolean, optional) – Compression mode.The default is True.

  • name (string, optional) – Name of operation. The default is ‘B’.

  • det_opt (TYPE, optional) – Definable method for determination. Ether incremental or leastsq. The default is ‘incremental’.

  • **kws (dict) – Keyword dict for least-square determination.

Raises
  • ValueError – Error in combination of option and inputs.

  • NotImplementedError – Error if option not implemented.

Returns

  • det_opt == “incremental” –

    YM_serpd.Series

    Series of Young’s Moduli.

  • or

  • det_opt == “leastsq” –

    YMfloat

    Youngs Modulus (corresponds to slope of linear fit).

    YM_absfloat

    Stress value on strain origin (corresponds to interception of linear fit).

    YM_Rquadfloat

    Coefficient of determination.

    YM_fitlmfit.model.ModelResult

    Fitting result from lmfit (use with fit.fit_report() for report).

exmecheva.bending.evaluation.YM_eva_method_C(Force_ser, w_func, w_params, length, I_func, A_func=None, CS_type='Rectangle', kappa=None, poisson=0.3, comp=True, option='M+V', name='C')[source]

Calculates the Young’s modulus from the deformation energy as a function of the internal forces (pure geometric fitting function).

Parameters
  • Force_ser (pandas.Series) – Series of force increments.

  • w_func (function) – Function of bending line.

  • w_params (pandas.Series of dictionionaries) – Parameters of function of bending line per step.

  • length (float) – Length of span.

  • I_func (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • A_func (np.poly1d function, optional) – Function of Area to position on span (x-direction).

  • CS_type (string, optional) – Cross-section type. The default is ‘Rectangle’.

  • kappa (float, optional) – Correction factor shear area. Depending to CS_type. The default is None.

  • poisson (float, optional) – Poisson’s ratio. The default is 0.3.

  • comp (boolean, optional) – Compression mode.The default is True.

  • option (string, optional) – Determiantion option. Possible are ‘M’ and ‘M+V’. The default is “M+V”.

  • name (string, optional) – Name of operation. The default is “F”.

Returns

E_ser – Series of determined Young’s Moduli.

Return type

pandas.Series

exmecheva.bending.evaluation.YM_eva_method_D(P_df, Force_ser, Length, func_I, n=100, rel_steps=None, weighted=False, weight_func=<function Weight_func>, wkwargs={}, wargs=[], pb_b=True, name='D')[source]

Calculates the modulus of elasticity by matching the theoretical displacements from the determined integral of the bending line with the measured ones.

Parameters
  • P_df (pandas.DataFrame) – Dataframe of measured points to steps.

  • Force_ser (pandas.Series) – Series of force increments.

  • Length (float) – Length of span.

  • func_I (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • n (integer, optional) – Division of the length for calculation. The default is 100.

  • rel_steps (index or array, optional) – Relevant steps for determination. The default is None.

  • weighted (boolean, optional) – Switch for weighted averaging. The default is True.

  • weight_func (function, optional) – Weighting function for global averaging. The default is Weight_func.

  • wargs (array, optional) – Arguments for weighting function for global averaging. The default is [].

  • wkwargs (dictionary, optional) – Keyword arguments for weighting function for global averaging. The default is {}.

  • pb_b (boolean, optional) – Switch of progressbar. The default is True.

  • name (string, optional) – Name of operation. The default is ‘D’.

Returns

  • YM_ser (pandas.Series) – Series of determined Young’s Moduli.

  • YM_df (pandas.DataFrame) – DataFrame of determined Young’s Moduli to x-position.

exmecheva.bending.evaluation.YM_eva_method_D_bend_df(Length, I_func, n=100, E=1, F=1)[source]

Calculates the deflection values via the determined integral of the bending line.

Parameters
  • Length (float) – Length of span.

  • I_func (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • n (integer, optional) – Division of the length for calculation. The default is 100.

  • E (float, optional) – Young’s Modulus. The default is 1.

  • F (float, optional) – Force. The default is 1.

Returns

m – Dataframe of deflections and parts of partwise integration to x-positions.

Return type

pandas.DataFrame

exmecheva.bending.evaluation.YM_eva_method_D_bend_df_add(points_x, m_df, Length, I_func, E=1, F=1)[source]

Adds additional points to the calculated deflection values via the determined integral of the bending line.

Parameters
  • points_x (pd.Series) – X-coordinates of additional points.

  • m_df (pandas.DataFrame) – Dataframe of deflections and parts of partwise integration to x-positions.

  • Length (float) – Length of span.

  • I_func (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • E (float, optional) – Young’s Modulus. The default is 1.

  • F (float, optional) – Force. The default is 1.

Returns

p_df – Dataframe of deflections and parts of partwise integration to x-positions.

Return type

pandas.DataFrame

exmecheva.bending.evaluation.YM_eva_method_D_num(P_df, Force_ser, step_range, Length, func_I, weighted=True, weight_func=<function Weight_func>, wargs=[], wkwargs={}, max_nfev=500, pb_b=True, name='D')[source]

Evaluate elastic modulus by minimization to method D residuals.

Parameters
  • P_df (pandas.DataFrame) – Dataframe of measured points to steps.

  • Force_ser (pandas.Series) – Series of force increments.

  • step_range (pd.Index or range or list) – Evaluation range.

  • Length (float) – Length of span.

  • func_I (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • weighted (boolean, optional) – Switch for weighted averaging. The default is True.

  • weight_func (function, optional) – Weighting function for global averaging. The default is Weight_func.

  • wargs (array, optional) – Arguments for weighting function for global averaging. The default is [].

  • wkwargs (dictionary, optional) – Keyword arguments for weighting function for global averaging. The default is {}.

  • max_nfev (int, optional) – Maximum number of iterations. The default is 500.

  • pb_b (boolean, optional) – Switch of progressbar. The default is True.

  • name (string, optional) – Name of operation. The default is ‘D’.

Returns

D_df – Evaluated elastic modulus and coefficent of determination per step.

Return type

pd.DataFrame

exmecheva.bending.evaluation.YM_eva_method_D_res(E, x_data, y_data=None, weights=None, **kws)[source]

Calculate residues of method D.

exmecheva.bending.evaluation.YM_eva_method_E(Force_ser, length, func_curve, params_curve, func_MoI, func_thick, evopt=0.5, opt_det='all', n=100, opt_g='length', opt_g_lim=0.5, weight_func=<function Weight_func>, wargs=[], wkwargs={}, name='E')[source]

Calculates Young’s Modulus by rise of stress to strain, calculated by curvature (2nd derivate) of bending line, per step with definable method.

Parameters
  • Force_ser (pandas.Series) – Series of force increments.

  • length (float) – Length of span.

  • func_curve (function) – Function of curvature (2nd derivate) of bending line. The default is None.

  • params_curve (array or pandas.Series of dictionionaries) – Parameters of function of curvature (2nd derivate) of bending line per step..

  • func_MoI (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • func_thick (np.poly1d function) – Function of thickness to position on span (x-direction).

  • evopt (float, optional) – Position according thickness for strain calculation. The default is 1/2.

  • opt_det (string, optional) –

    Determination option. possible are:

    • ’all’: All options evaluated.

    • ’stress’ : Local evaluation on maximum stress.

    • ’strain’ : Local evaluation on maximum strain.

    • ’range’ : Global evaluation over range defined by opt_g.

    The default is ‘all’.

  • n (integer, optional) – Division of the length for calculation. The default is 100.

  • opt_g (string, optional) –

    Option for global determination. possible are:

    • ’length’: Averaging by range (opt_g_lim*length) around midspan.

    • ’strain’: Averaging by range (strain<=opt_g_lim*strain_max).

    • ’Moment_weighted’: Weighted averaging by moment function.

    • ’Custom_weighted’: Weighted averaging by custom function.

    The default is ‘length’.

  • opt_g_lim (float, optional) – Limiter for opt_g. The default is 0.5.

  • weight_func (function, optional) – Weighting function for global averaging. The default is Weight_func.

  • wargs (array, optional) – Arguments for weighting function for global averaging. The default is [].

  • wkwargs (dictionary, optional) – Keyword arguments for weighting function for global averaging. The default is {}.

  • name (string, optional) – Name of operation. The default is ‘E’.

Raises

NotImplementedError – Raise error if option not implemented.

Returns

  • E_df (pandas.DataFrame) – Dataframe of determined Young’s Moduli.

  • sig_eps_df (pandas.DataFrame) – Dataframe of stress and strain values used in determination.

  • E_to_x (TYPE) – Dataframe of determined Young’s Moduli to span position (x-direction).

  • stress_df (pandas.DataFrame) – Dataframe of stress values.

  • strain_df (pandas.DataFrame) – Dataframe of strain values.

  • E_to_x_g (pandas.DataFrame) – Dataframe of determined Young’s Moduli to span position (x-direction) for global averaging.

exmecheva.bending.evaluation.YM_eva_method_F(c_func, c_params, Force_ser, Length, func_I, weighted=True, weight_func=<function Weight_func>, wargs=[], wkwargs={}, xr_dict={'fu': 1.0, 'ha': 0.5, 'th': 0.3333333333333333}, pb_b=True, name='F', n=100)[source]

Calculates the Young’s modulus via the local application of the differential equation of the bending line.

Parameters
  • c_func (function) – Function of curvature (2nd derivate) of bending line.

  • c_params (pandas.Series of dictionionaries) – Parameters of function of curvature (2nd derivate) of bending line per step.

  • Force_ser (pandas.Series) – Series of force increments.

  • Length (float) – Length of span.

  • func_I (Tnp.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • weighted (boolean, optional) – Switch for weighted averaging. The default is True.

  • weight_func (function, optional) – Weighting function for global averaging. The default is Weight_func.

  • wargs (array, optional) – Arguments for weighting function for global averaging. The default is [].

  • wkwargs (dictionary, optional) – Keyword arguments for weighting function for global averaging. The default is {}.

  • xr_dict (dictionary, optional) – Dictionary of name to range of length around midspan for determination. The default is {‘fu’:1/1, ‘ha’:1/2, ‘th’:1/3}.

  • pb_b (boolean, optional) – Switch of progressbar. The default is True.

  • name (string, optional) – Name of operation. The default is ‘F’.

  • n (integer, optional) – Division of the length for calculation. The default is 100.

Returns

YM_df – Series of determined Young’s Moduli.

Return type

pandas.Series

exmecheva.bending.evaluation.YM_eva_method_G(Force_ser, w_func_f_0, w_params, c_func, r_func, c_params, r_params, length, I_func, A_func=None, CS_type='Rectangle', kappa=None, poisson=0.3, comp=True, option='M+V', name='G')[source]

Calculates Young’s Moduli via the approach of equality of external work and deformation energy.

Parameters
  • Force_ser (pandas.Series) – Series of force increments.

  • w_func_f_0 (function) – Function of bending line for external work calculation.

  • w_params (pandas.Series of dictionionaries) – Parameters of function of bending line per step for external work calculation.

  • c_func (function) – Function of curvature (2nd derivate) of bending line.

  • r_func (function) – Function of rise (1st derivate) of bending line.

  • c_params (pandas.Series of dictionionaries) – Parameters of function of curvature (2nd derivate) of bending line per step.

  • r_params (pandas.Series of dictionionaries) – Parameters of function of rise (1st derivate) of bending line per step.

  • length (float) – Length of span.

  • I_func (np.poly1d function) – Function of Moment of inertia to position on span (x-direction).

  • A_func (np.poly1d function, optional) – Function of Area to position on span (x-direction). The default is None.

  • CS_type (string, optional) – Cross-section type. The default is ‘Rectangle’.

  • kappa (float, optional) – Correction factor shear area. Depending to CS_type. The default is None.

  • poisson (float, optional) – Poisson’s ratio. The default is 0.3.

  • comp (boolean, optional) – Compression mode.The default is True.

  • option (string, optional) – Determiantion option. Possible are ‘ignore_V’ and ‘M+V’. The default is “M+V”.

  • name (string, optional) – Name of operation. The default is “G”.

Returns

Series of determined Young’s Moduli.

Return type

pandas.Series

exmecheva.bending.evaluation.coord_df_depo(df, name='', pos=0.0)[source]

Return values on postion (Default x=0.0)

exmecheva.bending.evaluation.coord_df_mean(df, name='', fex=1, lex=1)[source]

Return mean values.

exmecheva.bending.evaluation.straindf_from_curve(x, func_curve, params_curve, func_thick, evopt=0.5)[source]

Evaluates the combination of a curvature and thickness function to x on a thickness ratio. (Use only for bending) Returns a dataframe with steps as index and x as columns.

exmecheva.bending.evaluation.stress_df_from_lin(F, x, func_MoI, func_thick, xmin, xmax, evopt=0.5, Test_type='TPB')[source]

Returns bending stress values according given x coordinates.

exmecheva.bending.evaluation.stress_perF(x, func_MoI, func_thick, xmin, xmax, evopt=0.5, Test_type='TPB')[source]

Returns a by force scaleable bending stress function.

exmecheva.bending.fitting module

Fitting functionality for bending.

@author: MarcGebhardt

exmecheva.bending.fitting.Multi_minimize(x, data, params, func_d0, func_d2, max_nfev, nan_policy, err_weights, x_lB, x_rB, load_dir='-y')[source]

Performs a weighted multiconstraint least-square-fit, based on lmfit.minimize. Returns lmfit-result, parameter-dict, Coefficient of determination for multi-errors and only displacement as well.

Parameters
  • x (array of float) – Cartesian coordinate in x-direction.

  • data (array of float, optional) – Cartesian coordinate in y-direction. The default is None.

  • params (OrderedDict / dict / array) – Parameters to be used in functions.

  • func_d0 (lamopdified function) – Input function.

  • func_d2 (lamopdified function) – Second derivate (curvature) of input function.

  • max_nfev (int) – Maximum number of function evaluations.

  • err_weights (array of float, optional) – Error weights assigned to constraints. Enter [1,0,0,0] for standard residual fit on displacement. The default is [1,10,100,100].

  • x_lB (float) – Cartesian coordinate in x-direction of start of function (curvature=0, p.e. left bearing).

  • x_rB (float) – Cartesian coordinate in x-direction of end of function (curvature=0, p.e. right bearing).

  • load_dir (string, optional) –

    Direction of displacement application. Possible are:

    • ”-y”: application in negative y-direction (standard, curvature positve(err2))

    • ”+y”: application in negative y-direction (curvature negative(err2))

Returns

MG_multi_minimize_Dict – Fit result dictionary (lmfit-result, parameter-dict, Coefficient of determination for multi-errors and only displacement as well.).

Return type

dict

exmecheva.bending.fitting.Perform_Fit(BFL, Fit_func_key, P_df, lB, rB, s_range, Shear_func_key=None, gamma_V=None, err_weights=[1, 10, 1000, 100], max_nfev=500, nan_policy='raise', option='Pre', ldoption='fixed-y', ldoptionadd=None, pb_b=True, **pwargs)[source]

Performs a weighted multiconstraint least-square-fit, based on lmfit.minimize.

Parameters
  • BFL (Bend_func_legion) – Class conttaining information about bending line and derivates. See Bend_func_legion in ./bfunc_class.py for more information.

  • Fit_func_key (string) – Identifier for fit function, p.e. ‘w_A’.

  • P_df (pd.DataFrame) – Measured and 2D-transformed displacment data. Combination of x-coordinates and y-displacments.

  • lB (float) – Left support x-coordinate, p.e. -10.0 with 20 mm span.

  • rB (float) – Right support x-coordinate, p.e. 10.0 with 20 mm span.

  • s_range (list or index) – Range of steps.

  • Shear_func_key (string, optional) – Identifier for shear function, p.e. ‘w_S’. The default is None.

  • gamma_V (float, optional) – Ratio between shear to entire deformation in mid of bending beam. See gamma_V_det in ./bfunc_com.py The default is None.

  • err_weights (list of float, optional) – Weights for multi contraint fitting. See res_multi_const_weighted. The default is [ 1, 10, 1000, 100].

  • max_nfev (int, optional) – Number of evaluations. The default is 500.

  • nan_policy (string, optional) – NaN handling. The default is ‘raise’.

  • option (string, optional) –

    Option for fitting. Possible are:
    • ’Pre’: Pre fit with shear deformation

    • ’Bend’: Refit to adjusted bending deformation

    (without indentation and shear deformation)

    The default is ‘Pre’.

  • ldoption (string, optional) –

    Load direction automatism. possible are:

    • ’fixed-y’: Load application in -y-direction (default).

    • ’fixed+y’: Load application in +y-direction.

    • ’auto-dispser’: Load application direction automaticly determined

    by a series of displacements (applied as ldoptionadd, index have to match with s_range/P_df). - ‘auto-Pcoorddisp’: Load application direction automaticly determined by a Points dataframe and specified point name and coordinate (applied as ldoptionadd, index have to match with s_range/P_df)

    The default is ‘fixed-y’.

  • ldoptionadd (Series or array of [Dataframe, string, string], optional) –

    Addendum for ldoption. Have to match to ldoption:

    • ’auto-dispser’: Series of displacements (index have to match with

    s_range/P_df). - ‘auto-Pcoorddisp’: Points dataframe and specified point name and coordinate ([Points as Dataframe, point name as string, coordinate as string],index have to match with s_range/P_df)

    The default is None.

  • pb_b (bool, optional) – Switch for showing progressbar. The default is True.

  • **pwargs (dict or pandas.Series) – Parameter keyword arguments for function.

Raises

NotImplementedError – Option not implemented.

Returns

Fit_res_df – Data of fit results.

Return type

pandas.DatFrame

exmecheva.bending.fitting.lmfit_bound_checker(Fit_Result, BFs, param_check_types=['free'], level=1)[source]

Check if lmfit Fit Result excides or hits bounds.

exmecheva.bending.fitting.lmfit_free_val_setter(bfs, param_val={}, default_val=-1.0)[source]

Preset free values/parameters for lmfit.

exmecheva.bending.fitting.lmfit_modelize(bfs, option='init')[source]

Returns a lmfit.model defined by Bend function sub.

exmecheva.bending.fitting.lmfit_param_adder(par_df)[source]

Returns lmfit Parameterset defined by pandas Dataframe.

exmecheva.bending.fitting.lmfit_param_key_checker(bfs, param_dict)[source]

Check parameters of lmfit with Bend_func_sub.

exmecheva.bending.fitting.lmfit_param_prep(option, param_name, param_val=None, param_type=None, param_min=None, param_max=None)[source]

Prepare fit parameters for fitting.

exmecheva.bending.fitting.res_multi_const_weighted(params, x, func, func_d2, x_lB, x_rB, func_err_weight=[1, 10, 100, 100], load_dir='-y', data=None)[source]

Returns weighted error sum according to different constraints between input values and function values. Constraints:

  1. error between data and function value

  2. error between function value of left and right bound to zero

  3. error between negative/positive value of second derivate of function and zero (depends on load direction)

  4. error between value of second derivate of function of left and right bound to zero

Parameters
  • params (OrderedDict / dict / array) – Parameters to be used in functions.

  • x (array of float) – Cartesian coordinate in x-direction.

  • func (lamopdified function) – Input function.

  • func_d2 (lamopdified function) – Second derivate (curvature) of input function.

  • x_lB (float) – Cartesian coordinate in x-direction of start of function (curvature=0, p.e. left bearing).

  • x_rB (float) – Cartesian coordinate in x-direction of end of function (curvature=0, p.e. right bearing).

  • func_err_weight (array of float, optional) – Error weights assigned to constraints. Enter [1,0,0,0] for standard residual fit on displacement. The default is [1,10,100,100].

  • load_dir (string, optional) –

    Direction of displacement application. Possible are:

    • ”-y”: application in negative y-direction (standard, curvature positve(err2))

    • ”+y”: application in negative y-direction (curvature negative(err2))

  • data (array of float, optional) – Cartesian coordinate in y-direction. The default is None.

Returns

err – Weighted multi constraint error sum.

Return type

numpy array

exmecheva.bending.fitting.shaped_array_fill_fandl(ShapeAr, fElemV, lElemV)[source]

Returns an 1D numpy array with shape of input array and filled with ones. First and last element replaced with input data.

Parameters
  • ShapeAr (numpy.array) – Input array wich determine shape of output array.

  • fElemV (float64) – Value of first element passed to output array.

  • lElemV (float64) – Value of last element passed to output array.

Returns

OutAr – 1D numpy array with shape of input array and filled with ones. First and last element replaced with input data.

Return type

numpy array

exmecheva.bending.opt_mps module

Adds funcionality for optical measured cartesian points. (Mostly vector geometry)

@author: MarcGebhardt

exmecheva.bending.opt_mps.Point_df_combine(df1, df2, coords_set='y', deepcopy=True, option=None)[source]

Combines a deepcopy of one points dataframe to an other.

exmecheva.bending.opt_mps.Point_df_from_lin(x, steps, coords=['x', 'y'], coords_set='x', col_type='str', Point_prefix='L')[source]

Prepare a points dataframe with index of step and values of x.

exmecheva.bending.opt_mps.Point_df_idx(df, steps=None, points=None, coords=None, deepcopy=True, option=None)[source]

Indexing a points dataframe by step (index), point-names and coordinates.

exmecheva.bending.opt_mps.Point_df_transform(Pmeas, Pspec, Pmeas_Sdev, Pspec_Sdev, dic_P_name_org1, dic_P_name_org2, output_lvl=0, log_mg='')[source]

Calculate in plane transformation of given measured 3D-points.

Parameters
  • Pmeas (pandas.Dataframe([], index=['x','y','z'],) – columns=[‘P1’,’P2’,…], dtype=float64) Cartesian coordinates of measured points, which should be fitted.

  • Pspec (pandas.Dataframe([], index=['x','y','z'],) – columns=[‘S1’,’S2’,…], dtype=float64) Cartesian coordinates of special points which should used for coordinate transformation.

  • Pmeas_Sdev (pandas.Dataframe([], index=['Sx','Sy','Sz'],) – columns=[‘P1’,’P2’,…], dtype=float64) Standard deviation of measured points, which should be fitted.

  • Pspec_Sdev (pandas.Dataframe([], index=['Sx','Sy','Sz'],) – columns=[‘S1’,’S2’,…], dtype=float64) Standard deviation of special points which should used for coordinate transformation.

  • dic_P_name_org1 (str) – Name of point, which should be on the negativ x-axis. Origin is in the middle between dic_P_name_org1 and dic_P_name_org2.

  • dic_P_name_org2 (str) – Name of point, which should be on the positiv x-axis. Origin is in the middle between dic_P_name_org1 and dic_P_name_org2.

Returns

  • Points_T – Transformed coordinates and standard deviation of given points.

  • Points_L_T – In plane transformed coordinates and standard deviation of given points.

exmecheva.bending.opt_mps.Points_add_step(df, add_step=0, add_df=None, steps=None, points=None, coords=None, deepcopy=True, option=None)[source]

Adding a Points df to an other.

exmecheva.bending.opt_mps.Points_dif_step(df, dif_step=0, steps=None, points=None, coords=None, deepcopy=True, option=None)[source]

Substracts a Points df from an other.

exmecheva.bending.opt_mps.Points_diff(df, diff_coord='y', first_val=0, steps=None, points=None, coords=None, deepcopy=True, option=None, nan_policy='corr_nan')[source]

Returns differential of specified coordinates of Points.

exmecheva.bending.opt_mps.Points_eval_func(func, fit_params, pointdf, steps, in_coord='x', out_coord='y', points=None, deepcopy=True, option=None)[source]

Evaluates a dataframe or series by a function.

exmecheva.bending.opt_mps.v_Ctrans(v, TM, P0)[source]

Transform a set of vectors(v=ixN3) with a translationmatrix (TM) and a new origin (P0)

exmecheva.bending.opt_mps.v_length(v1)[source]

Computes the length of an vector

exmecheva.bending.plotting module

Plotting functionality for bending.

@author: MarcGebhardt

exmecheva.bending.plotting.colplt_common_ax(xdata, ydata, step_range=None, title='', xlabel='', ylabel='', xstep=False, ystep=True, Point_df=None, ax=None, cblabel='Step', cbtick=None)[source]

Returns a matpltlib axis plot of a pandas Dataframe of type points in a range.

exmecheva.bending.plotting.colplt_df_ax(df, step_range=None, title='', xlabel='', ylabel='', Point_df=None, ax=None, cblabel='Step', cbtick=None)[source]

Returns a matpltlib axis plot of a pandas Dataframe of type points in a range.

exmecheva.bending.plotting.colplt_funcs_all(x, func_cohort, params, step_range=None, title='', xlabel='', Point_df=None, cblabel='Step', cbtick=None, path=None, plt_scopt={'clear': True, 'close': True, 's_types': ['pdf'], 'save': True, 'show': True, 'tight': True})[source]

Returns a matpltlib axis plot of a function cohort (function and theire first and second derivate) with defined parameters in a range.

exmecheva.bending.plotting.colplt_funcs_ax(x, func, params, step_range=None, title='', xlabel='', ylabel='', Point_df=None, ax=None, cblabel='Step', cbtick=None)[source]

Returns a matpltlib axis plot of a function with defined parameters in a range.

exmecheva.bending.plotting.colplt_funcs_one(x, func, params, step_range=None, title='', xlabel='', ylabel='', Point_df=None, cblabel='Step', cbtick=None, path=None, plt_scopt={'clear': True, 'close': True, 's_types': ['pdf'], 'save': True, 'show': True, 'tight': True})[source]

Returns a matpltlib figure plot of a function with defined parameters in a range.

Module contents

Functionality for exmecheva bending evaluation.