pyvisco.opt

Collection of functions to minimize the number of Prony series terms used in the Generalized Maxwell model.

Functions

nprony(df_master, prony_series[, window, opt])

Minimize number of Prony terms used in Generalized Maxwell model.

plot_fit(df_master, dict_prony, N, units)

Calculate and plot the optimized Prony series fit.

plot_residual(err)

Plot the least squares residual of the Prony series fits.

pyvisco.opt.nprony(df_master, prony_series, window='min', opt=1.5)

Minimize number of Prony terms used in Generalized Maxwell model.

The number of Prony terms is gradually decreased and the new Prony series parameters are identified. The goodness of fit is evaluated based on the R^2 measure. An optimal number of Prony terms is suggested.

Parameters:
  • df_master (pandas.DataFrame) – Contains the master curve data.

  • prony_series (dict) – Contains the Prony series parameters of the initial fit.

  • window ({'min', 'round', 'exact'}) – Defines the location of the discretization of the relaxation times. - exact : use whole window of the experimental data and logarithmically space the relaxation times between - round : round the minimum and maximum values of the experimental data to the nearest base 10 number and logarithmically space the remaining relaxation times between the rounded numbers - min : Position of relaxation times is optimized during minimization routine to reduce the number of Prony terms.

  • opt (numeric) – Multiplier for the inital least squares residual to suggest an optimal number of Prony terms: (R_opt)^2 = opt * (R_0)^2

Returns:

  • dict_prony (dict{N : prony_series}) – Contains all prony_series parameters for each number of calculated Prony terms, N.

  • N_opt (int) – Optimal number of Prony terms.

  • err (pandas.DataFrame) – Contains the least sqare residuals for each calculated Prony series.

pyvisco.opt.plot_fit(df_master, dict_prony, N, units)

Calculate and plot the optimized Prony series fit.

Parameters:
  • df_master (pandas.DataFrame) – Contains the master curve data.

  • dict_prony (dict{N : prony_series}) – Contains all Prony series parameters for each number of calculated Prony terms, N.

  • N (int) – Number of Prony terms for plot.

  • units (dict of {str : str}) – Contains the names of the physical quantities as key and the corresponding names of the units as item.

Returns:

  • df_GMaxw (pandas.DataFrame) – Contains the calculated Generalized Maxwell model data for the Prony series with N terms.

  • fig (matplotlib.pyplot.figure) – Plot of optimized Prony series fit.

pyvisco.opt.plot_residual(err)

Plot the least squares residual of the Prony series fits.

Parameters:

err (pandas.DataFrame) – Contains the least sqare residuals for each calculated Prony series.

Returns:

fig – Matplotlib figure instance.

Return type:

matplotlib.pyplot.figure

See also

opt.nprony

Return the err dataframe.