Welcome to arithmeticcurve’s documentation!¶
This module calculates an arithmetic mean curve in regard of the described algorithm in (Scheliga 2013).
Warning
This module is at a beta development state. With future releases the wording (function, attribute and class names) may change towards a more common understanding.
Current main construction parts are additional tests of this package.
Basic Usage¶
Installation¶
The module can be installed via pip.
$ pip install arithmeticmeancurve
An optional module is examplecurves, which was outsourced from arithmeticmeancurves. Its purpose is to provide exemplary, reproducible families of curves for testing and debugging.
$ pip install examplecurves
Example¶
A curve within arithmeticmeancurve is defined by a pandas.DataFrame. In the current implementation ArithmeticMeanCurve will take a list of pandas.DataFrame and merge all columns into a single representation for which a mean curve is calculated. Therefore the provided DataFrame should represent the targeted family of curves only.
# Here examplecurves is used to get exemplary curves.
import examplecurves
curves = examplecurves.Static.create("nonlinear0")
# The actual calculation of the arithmetic mean curve.
from arithmeticmeancurve import ArithmeticMeanCurve
a_mean_curve = ArithmeticMeanCurve(curves=curves)
# Finally the plotting of the mean curve and the sample curves.
import matplotlib.pyplot as plt
plt.plot(a_mean_curve.mean_curve, "-ko", label="arithmetic mean curve")
for label, curve in a_mean_curve.family_of_curves.iteritems():
plt.plot(curve, "-", label="label")
plt.plot(a_mean_curve.scatter_curve, "--k", label="scatter curve")
plt.plot(a_mean_curve.std_circle, "--r", label="std circle")
plt.legend()
plt.show()
(Source code, png, hires.png, pdf)

arithmeticcurve API-reference¶
Merges and interpolates a set into a family (of curves). |
|
Merges a set into a family (of curves). |
|
Extrapolates with last standard deviation as target. |
arithmeticcurve.ArithmeticMeanCurve¶
Represents a family of curves. |
|
The curves within a DataFrame interpolated. |
|
Arithmetic mean curve of the sample curves. |
|
Scatter curve representing the standard deviation. |
|
Represents the standard deviation as a circle. |
A look inside the extrapolation¶
Frozen standard deviation extrapolation¶
The frozen standard deviation extrapolation supports 3 parameters. use_previous_iteration, target_threshold and maximum_allowed_iterations
maximum_allowed_iterations¶
Defines the maximum allowed iterations for each row of values. Default is 50.
target_threshold¶
The parameter target_threshold (default 0.0001) defines the stopping condition for the iterative extrapolation. It is the relative deviation of the current arithmetic mean value towards the previous calculated mean value during the extrapolation.
The target_threshold has direct impact on the performed iterations (see figure 1 and figure 2). target_threshold is accompanied with maximum_allowed_iterations as it might be necessary to increase maximum_allowed_iterations for small target_threshold.
(Source code, png, hires.png, pdf)

Figure 1: Iteration using FrozenStdExtrapolation with a target threshold of 0.001.
(Source code, png, hires.png, pdf)

Figure 2: Iteration using FrozenStdExtrapolation with a target threshold of 0.0001.
use_previous_iteration¶
By default FrozenStdExtrapolation uses the previous iteration result as the starting point for the next one to speed up the calculation.
(Source code, png, hires.png, pdf)

Figure 3: Iteration with use_previous_iteration disabled.
(Source code, png, hires.png, pdf)

Figure 3: Default extrapolation using previous iteration results and a target threshold of 0.0001.
Tests on Families of Curves¶
Except NonLinear0 all families of curves shown below were chosen as they triggered logical bugs within the code of prior releases.
NonLinear0¶
This family of curve is an exemplary family of curve which was created as the first test case for the first alpha release. The curves end points are not generated using a standard deviation.
HorizontalLinear¶
End points of all families of curves within the group of horizontal linear bases on a simple strength failure criterion. Slope (Young’s modulus) and y-values (strength) are randomly generated using a standard deviation. The x-values are calculated on basis of the generated values.
The calculation leads to horizontally aligned end points, which gives this group its name.
DiagonalLinear¶
End points of all families of curves within the group of diagonal linear bases on a simple energy failure criterion. Slope (Young’s modulus) and area beneath the x-y curve (energy) are randomly generated using a standard deviation. The x-values and y-values are calculated on basis of the generated values.
The calculation leads to diagonally aligned end points, which gives this group its name.
VerticalLinear¶
End points of all families of curves within the group of vertical linear bases on a simple strain failure criterion. Slope (Young’s modulus) and x-values (strain) are randomly generated using a standard deviation. The y-values are calculated on basis of the generated values.
The calculation leads to vertically aligned end points, which gives this group its name.
Variation 0¶
The arithmetic y-mean value of the ending points is located in between the last full value row and the ending part of the family of curves, which needs extrapolation.
(Source code, png, hires.png, pdf)

Glossary of arithmeticmeancurve¶
- Set of curves¶
A set of unique curves with separately x-values. Although it is a family of curves, their characteristic is, that the curves doesn’t share a common x-values.
- Raw family of curves¶
A family of curves which share common x-values, but contain only their original y-values.
- Family of curves¶
A family of curves in which each curve share common x-values and contains interpolated values for added x-values.
- x-value¶
The abscissa value of a curve.
- x-values¶
Multiple sequence of x-value along the abscissa.
- y-value¶
The ordinate value of a curve.
- y-values¶
Multiple sequence of y-value along the ordinate.
Disclaimer¶
This documentation and the related python module arithmeticmeancurve are furnished as they are, are for informational use only. The information and functionality within the documentation and package are subject to change without notice and should not be construed as a commitment by Dr. David Scheliga. Dr. David Scheliga assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content of the documentation and functional content of the python module arithmeticmeancurve.
Example sample curves¶
The figure 1 shows an exemplary sample of curves with the mean values along the sample. The character of calculating the mean value without an extrapolation is observable by a mean curve jumping to different mean states, when the amount of available values change.
(Source code, png, hires.png, pdf)

Figure 1: Sample curves (left) and with standard mean curve (right).
Prerequisites of calculation¶
The curves must be a pandas.DataFrame with the x-value being the index.
The index (x-values) of the curves must be monotonic increasing and must not contain duplicates.
pandas.MultiIndex is not supported.
Arithmetic mean curve¶
The figure 2 shows a mean curve based on the concept described in (Scheliga 2013). The arithmetic mean curve is calculated by extrapolating the curves on the base of their relative position within the standard deviation at the point the first curve ended. The extrapolation is based on an iterative process, in which the extrapolated mean value and extrapolated single curve(s) reach an asymptote. The calculated arithmetic curve does not intentionally extrapolate the beginning of the sample curves, starting at the first full definition of all sample curves (figure 3). Prior calculation of the arithmetic mean curve the single supplied curves should be prepared.
The scatter band is the representation of the standard deviation around the mean curve. Its end is sheared in accordance to the mean curves ending slope, as the std circle indicates.
(Source code, png, hires.png, pdf)

Figure 2: Extrapolated mean curve with scatter curve (Scheliga 2013)
(Source code, png, hires.png, pdf)

Figure 3: Sample curves left sides with arithmetic mean curve.
References¶
D. Scheliga, Experimentelle Untersuchung des Rissausbreitungsverhaltens von nanopartikelverstärktem Polyamid 66. Kaiserslautern: Institut für Verbundwerkstoffe GmbH, 2013, ISBN 978-2-944440-02-6