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)

_images/basic_usage_example.png