DESY ACOP Beans Home

de.desy.acop.video.analysis
Class FittingUtilities

java.lang.Object
  extended by de.desy.acop.video.analysis.FittingUtilities

public class FittingUtilities
extends java.lang.Object

FittingUtilities provides a set of utilities to fit a gaussian function to a set of data

Author:
Jaka Bobnar

Constructor Summary
FittingUtilities()
           
 
Method Summary
static double[][] FFT1D(double[][] x, boolean forward)
           
static double[] fit(double[] y, double constY)
          Performs a linear fit of exponential function to the y data.
static boolean isNaN(double[] values)
          Checks if any of the values in the arrays is NaN.
static double[] lmGauss(double[] x, double[] y, double[] weights, double[] startValues)
          Fits a gauss with offset y = Ae^(-(x-C)^2/(2B^2)) to the given data.
static double[] lmLinear(double[] x, double[] y, double[] weights, double[] startValues)
          Fits a gauss with offset y = Ae^(-(x-C)^2/(2B^2)) + D + E x to the given data.
static double[] lmOffset(double[] x, double[] y, double[] weights, double[] startValues)
          Deprecated. ues lmLinear(double[], double[], double[], double[])
static void main(java.lang.String[] args)
           
static double[] smooth(double[] x)
          Smooths the data with averaging.
static double[] smooth(double[] x, boolean lowPassFilterOn)
          Smooths the values in the array with averaging and applying a low pass filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FittingUtilities

public FittingUtilities()
Method Detail

lmOffset

@Deprecated
public static double[] lmOffset(double[] x,
                                           double[] y,
                                           double[] weights,
                                           double[] startValues)
                         throws OptimizationException,
                                FunctionEvaluationException,
                                java.lang.IllegalArgumentException
Deprecated. ues lmLinear(double[], double[], double[], double[])

Fits a gauss with offset y = Ae^(-(x-C)^2/(2B^2)) + D to the given data.

Parameters:
x - the independent variable data
y - the dependent variable data
weights - the weights of the measurements
startValues - starting values for the parameters
Returns:
array of calculated parameters ([A,B,C,D])
Throws:
OptimizationException
FunctionEvaluationException
java.lang.IllegalArgumentException

lmLinear

public static double[] lmLinear(double[] x,
                                double[] y,
                                double[] weights,
                                double[] startValues)
                         throws OptimizationException,
                                FunctionEvaluationException,
                                java.lang.IllegalArgumentException
Fits a gauss with offset y = Ae^(-(x-C)^2/(2B^2)) + D + E x to the given data.

Parameters:
x - the independent variable data
y - the dependent variable data
weights - the weights of the measurements
startValues - starting values for the parameters
Returns:
array of calculated parameters ([A,B,C,D,E])
Throws:
OptimizationException
FunctionEvaluationException
java.lang.IllegalArgumentException

lmGauss

public static double[] lmGauss(double[] x,
                               double[] y,
                               double[] weights,
                               double[] startValues)
                        throws OptimizationException,
                               FunctionEvaluationException,
                               java.lang.IllegalArgumentException
Fits a gauss with offset y = Ae^(-(x-C)^2/(2B^2)) to the given data.

Parameters:
x - the independent variable data
y - the dependent variable data
weights - the weights of the measurements
startValues - starting values for the parameters
Returns:
array of calculated parameters ([A,B,C])
Throws:
OptimizationException
FunctionEvaluationException
java.lang.IllegalArgumentException

main

public static void main(java.lang.String[] args)
                 throws MathException
Throws:
MathException

fit

public static double[] fit(double[] y,
                           double constY)
                    throws MathException
Performs a linear fit of exponential function to the y data.

Parameters:
y -
constY -
Returns:
Throws:
MathException

isNaN

public static boolean isNaN(double[] values)
Checks if any of the values in the arrays is NaN.

Parameters:
values -
Returns:

smooth

public static double[] smooth(double[] x)
Smooths the data with averaging.

Parameters:
x - data to be smoothed
Returns:
smoothed data

smooth

public static double[] smooth(double[] x,
                              boolean lowPassFilterOn)
Smooths the values in the array with averaging and applying a low pass filter.

Parameters:
x - the data to smooth
lowPassFilterOn - true if low pass filtering should be used
Returns:
smoothed array

FFT1D

public static double[][] FFT1D(double[][] x,
                               boolean forward)
Parameters:
x - array of values. First array are real values, second imaginary
forward - true for forward and false for inverse transform
Returns:
Fourier transform of x
Throws:
java.lang.Exception


Copyright © 2010. All Rights Reserved.