Example usage for org.apache.commons.math.analysis.interpolation LoessInterpolator LoessInterpolator

List of usage examples for org.apache.commons.math.analysis.interpolation LoessInterpolator LoessInterpolator

Introduction

In this page you can find the example usage for org.apache.commons.math.analysis.interpolation LoessInterpolator LoessInterpolator.

Prototype

public LoessInterpolator() 

Source Link

Document

Constructs a new LoessInterpolator with a bandwidth of #DEFAULT_BANDWIDTH , #DEFAULT_ROBUSTNESS_ITERS robustness iterations and an accuracy of {#link #DEFAULT_ACCURACY}.

Usage

From source file:guineu.modules.filter.Alignment.SerumHuNormalization.SerumHuNormalizationTask.java

private PolynomialSplineFunction createCurve() {
    try {/*from w ww . j a  va 2  s  .c  o m*/
        // if there are more than 2 points in the model
        LoessInterpolator loess = null;
        if (this.loessBandwidth == 0 && this.iterations == 0) {
            loess = new LoessInterpolator();
        } else {
            loess = new LoessInterpolator(this.loessBandwidth, this.iterations);
        }
        double[] newy = loess.smooth(xval, yval);
        PolynomialSplineFunction function = loess.interpolate(xval, newy);
        return function;

    } catch (MathException ex) {
        Logger.getLogger(SerumHuNormalizationTask.class.getName()).log(Level.SEVERE, null, ex);

        SplineInterpolator loess = new SplineInterpolator();
        PolynomialSplineFunction function = loess.interpolate(xval, yval);
        return function;

    }
}