Class FitLorentz


  • public class FitLorentz
    extends NLFittedFunction
    FitLorentz -fits an array of points to a lorentz distribution, thresholding techniques come from ViewJFrameGraph, no need to implement here
    Version:
    1.0
    Author:
    senseneyj
    See Also:
    NLConstrainedEngine
    • Field Detail

      • dataStart

        private int dataStart
        Location in xSeries where Gaussian data starts
      • dataEnd

        private int dataEnd
        Location in xSeries where Gaussian data ends
      • amp

        private double amp
        Amplitude parameter
      • xMedian

        private double xMedian
        Statistical median
      • gamma

        private double gamma
        half width at half maximum
      • iters

        private int iters
        Iterations performed
    • Constructor Detail

      • FitLorentz

        public FitLorentz()
        FitLorentz - test constructor, builds and test function.
      • FitLorentz

        public FitLorentz​(int nPoints,
                          double[] xData,
                          double[] yData)
        FitLorentz.
        Parameters:
        nPoints - number of points in the function
        xData - values along x-axis
        yData - values along y-axis
      • FitLorentz

        public FitLorentz​(int nPoints,
                          float[] xData,
                          float[] yData)
        Constructs new fit lorentz distribution.
        Parameters:
        nPoints - Number of points in the function
        xData - values along x-axis
        yData - values along y-axis
    • Method Detail

      • applyKernel

        private double[] applyKernel()
        Apply small Gaussian kernel to smooth out data. Note should not be called if doing data comparison.
      • estimateInitial

        private void estimateInitial()
      • displayResults

        public void displayResults()
        Display results of displaying lorentz fitting parameters.
        Specified by:
        displayResults in class NLFittedFunction
      • fitToFunction

        public void fitToFunction​(double[] a,
                                  double[] residuals,
                                  double[][] covarMat)
        Description copied from class: NLConstrainedEngine
        fitToFunction communicates with 3 protected variables param, nPts, and ctrlMat ctrlMat is used as a wrapper for ctrl or lctrl. Evaluates the residuals or the Jacobian at a certain a[]
        Specified by:
        fitToFunction in class NLConstrainedEngine
        Parameters:
        a - DOCUMENT ME!
        residuals - DOCUMENT ME!
        covarMat - DOCUMENT ME!
      • lorentz

        private double lorentz​(double x)
        Lorentz distribution evaluated at a point with given parameters
      • dLdA

        private double dLdA​(double x)
        Partial derivative of Lorentz distribution with respect to A.
      • dLdxMedian

        private double dLdxMedian​(double x)
        Partial derivative of Lorentz distribution with respect to xMedian.
      • dLdgamma

        private double dLdgamma​(double x)
        Partial derivative of Lorentz distribution with respect to gamma.
      • generateJacobian

        protected Jama.Matrix generateJacobian()
        Jacobian used for non-linear least squares fitting.
      • generateResiduals

        protected Jama.Matrix generateResiduals()
        Description copied from class: NLFittedFunction
        Calculates the residuals for a given function, not implemented since some functions might prefer to only use a subset of data points, or not use yDataFitted if working during an iteration
        Specified by:
        generateResiduals in class NLFittedFunction
        Returns: