pyvisco.master¶
Collection of functions to prepare the master curve for the identification of the Prony series parameters. Methods are provided to shift the raw measurement data into a master curve and remove measurement outliers through smoothing of the master curve.
Functions
|
Obtain shift factor between two measurement sets at different tempeatures. |
|
Define bounds for curve fitting routine and fit power law. |
|
Get shift factors for each temperature level in the raw measurement data. |
|
Get master curve by shifting the individual measurement sets. |
|
Plot master curve. |
|
Plot raw measurement data and shifted master curve. |
|
Plot shifted measurement sets. |
|
Upadate plot of raw measurement data and shifted master curve. |
|
Plot filtered and unfilterd master curve. |
|
Calculate the inverse Power Law relation with a deviation term. |
|
Calculate the Power Law relation with a deviation term. |
|
Remove outliers in measurement data by smoothing master curve. |
- pyvisco.master.pwr_y(x, a, b, e)¶
Calculate the Power Law relation with a deviation term.
- Parameters:
x (numeric) – Input to Power Law relation.
a (numeric) – Constant.
b (numeric) – Exponent.
e (numeric) – Deviation term.
- Returns:
Output of Power Law relation.
- Return type:
numeric
Notes
Power Law relation: \(y = a x^b + e\)
- pyvisco.master.pwr_x(y, a, b, e)¶
Calculate the inverse Power Law relation with a deviation term.
- Parameters:
y (numeric) – Output of Power Law relation.
a (numeric) – Constant.
b (numeric) – Exponent.
e (numeric) – Deviation term.
- Returns:
Input to Power Law relation.
- Return type:
numeric
Notes
Inverse Power Law relation: \(x=\left(\frac{y-e}{a}\right)^{\frac{1}{b}}\)
- pyvisco.master.fit_pwr(xdata, ydata)¶
Define bounds for curve fitting routine and fit power law.
- Parameters:
xdata (array-like) – x data to be fitted.
ydata (array-like) – y data to be fitted.
- Returns:
popt (array-like) – Optimal values for the parameters.
pcov (2D array) – The estimated covariance of popt. The diagonals provide the variance of the parameter estimate.
See also
scipy.optimize.curve_fitNon-linear least squares fit to a function.
- pyvisco.master.fit_at_pwr(df_raw, gb_ref, gb_shift)¶
Obtain shift factor between two measurement sets at different tempeatures.
The raw measurement data at each temperature level are fitted by a Power Law function. These Power Law functions improve the robustness of the shifting algorithm, because they functions smooth outliers and bridge possible gaps between the data sets. The intersection of the functions is calculated and used to obtain the shift factor.
- Parameters:
df_raw (pandas.DataFrame) – Contains the processed raw measurement data.
gb_ref (int) – Dataframe
Setnumber of the reference measurement set.gb_shift (int) – Dataframe
Setnumber of the measurement set that is shifted.
- Returns:
log_aT – The decadic logarithm of the shift factor between the two measurement sets.
- Return type:
numeric
Notes
In certain circumstances the equilibration time between measurements at different temperature levels can be too short to reach a steady state leading to errors in the first data point of the measurement set. To account for such situation, tow Power law fits are conducted. The first fit contains all data points and the second fit drops the first data point. If dropping the data point increased the goodness of fit, this Power Law fit is used to calculate the shift factor.
- pyvisco.master.get_aT(df_raw, RefT)¶
Get shift factors for each temperature level in the raw measurement data.
A reference temperature is specified for which the master curve is created. Measurement sets below the desired reference temperatures are shifted to lower frequencies (longer time periods), whereas measurement sets at temperatures higher than the reference temperature are shifted to higher frequencies (shorter time periods).
- Parameters:
df_raw (pandas.DataFrame) – Contains the processed raw measurement data.
RefT (int or float) – Reference tempeature of the master curve in Celsius.
- Returns:
df_aT – Contains the decadic logarithm of the shift factors
log_aTand the corresponding temperature valuesTin degree Celsius.- Return type:
pandas.DataFrame
See also
load.Eplexor_rawReturns df_raw from Eplexor Excel file.
load.user_rawReturns df_raw from csv file.
- pyvisco.master.get_curve(df_raw, df_aT, RefT)¶
Get master curve by shifting the individual measurement sets.
The master curve is created from the raw measurement data based on the provided shift factors for the specified reference temperature.
- Parameters:
df_raw (pandas.DataFrame) – Contains the processed raw measurement data.
df_aT (pandas.DataFrame) – Contains the decadic logarithm of the shift factors
log_aTand the corresponding temperature valuesTin degree Celsius.RefT (int or float) – Reference tempeature of the master curve in Celsius.
- Returns:
df_master – Contains the master curve data.
- Return type:
pandas.DataFrame
See also
load.Eplexor_rawReturns df_raw from Eplexor Excel file.
load.user_rawReturns df_raw from csv file.
master.get_aTReturns df_aT.
- pyvisco.master.plot(df_master, units)¶
Plot master curve.
- Parameters:
df_master (pandas.DataFrame) – Contains the master curve data.
units (dict of {str : str}) – Contains the names of the physical quantities as key and the corresponding names of the units as item.
- Returns:
fig – Domain dependent plot of master curve.
- Return type:
matplotlib.pyplot.figure
- pyvisco.master.plot_shift(df_raw, df_master, units)¶
Plot raw measurement data and shifted master curve.
- Parameters:
df_raw (pandas.DataFrame) – Contains the processed raw measurement data.
df_master (pandas.DataFrame) – Contains the master curve data.
units (dict of {str : str}) – Contains the names of the physical quantities as key and the corresponding names of the units as item.
- Returns:
fig (matplotlib.pyplot.figure) – Plot of raw measurement data and master curve.
ax (tuple) –
- Frequency domain: (ax1, lax1, ax2, lax2)
- ax1matplotlib.axes.Axes
Axes object of storage modulus plot
- lax1list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in storage modulus plot
- ax2matplotlib.axes.Axes
Axes object of loss modulus plot
- lax2list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in loss modulus plot
- Time domain: (ax1, lax1)
- ax1matplotlib.axes.Axes
Axes object of relaxation modulus plot
- lax1list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in relaxation modulus plot
See also
master.plot_shift_updateUpdates figure data.
- pyvisco.master.plot_shift_update(df_master, fig, ax)¶
Upadate plot of raw measurement data and shifted master curve.
- Parameters:
df_master (pandas.DataFrame) – Contains the master curve data.
fig (matplotlib.pyplot.figure) – Matplotlib figure instance.
ax (tuple) –
- Frequency domain: (ax1, lax1, ax2, lax2)
- ax1matplotlib.axes.Axes
Axes object of storage modulus plot
- lax1list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in storage modulus plot
- ax2matplotlib.axes.Axes
Axes object of loss modulus plot
- lax2list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in loss modulus plot
- Time domain: (ax1, lax1)
- ax1matplotlib.axes.Axes
Axes object of relaxation modulus plot
- lax1list of matplotlib.lines.Line2D
Line2D instances for easy update of xdata and ydata in relaxation modulus plot
See also
master.plot_shiftCreates figure that is updated with this function.
- pyvisco.master.smooth(df_master, win=1)¶
Remove outliers in measurement data by smoothing master curve.
A moving median filter with variable window size is applied to remove outliers from the measurement data.
- Parameters:
df_master (pandas.DataFrame) – Contains the master curve data.
win (int, default = 1) – Window size of the median filter. A window size of 1 means that no filtering procedure is performed and the input data are returned.
- Returns:
df_master – Contains the master curve data, including the filtered arrays.
- Return type:
pandas.DataFrame
- pyvisco.master.plot_smooth(df_master, units)¶
Plot filtered and unfilterd master curve.
- Parameters:
df_master (pandas.DataFrame) – Contains the filtered and unfiltered master curve data.
units (dict of {str : str}) – Contains the names of the physical quantities as key and the corresponding names of the units as item.
- Returns:
fig – Plot displaying the filtered and unfilterd master curve data.
- Return type:
matplotlib.pyplot.figure
- pyvisco.master.plot_shift_debug(dshift)¶
Plot shifted measurement sets. Helpful for manual adjustment of master curve.
- Parameters:
dshift (dictionary) – Contains data of the shifted measurement sets.
- Returns:
fig – Plot displaying the fitted and shifted measurement data sets.
- Return type:
matplotlib.pyplot.figure