Package gda.util

Class Gaussian

java.lang.Object
gda.util.Gaussian

public class Gaussian extends Object
Class to represent a Gaussian curve by its three parameters. Only THREEPOINT works right now.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Least squares fitting method
    static final int
    Indicates the negative side of the peak
    static final int
    Indicates the positive side of the peak
    static final int
    Three point fitting method
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
    Gaussian(double[] xvals, double[] yvals, int fitMethod)
    Constructor which creates a Gaussian by the three point fit method or least squares fit method from sets of x and y data.
    Gaussian(double position, double width, double height)
    Constructor which creates a Gaussian by directly specifying its position, width and height.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    derivativeAtX(double xVal)
    Calculates the derivative at a given x value
    double
    derivativeAtY(double yVal, int side)
    Calculates the derivative at a given y value
    double
    xAtY(double yVal, int side)
    Calculates the x value at a given y value
    double
    yAtX(double xVal)
    Calculates the y value at a given x value

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NEGATIVE

      public static final int NEGATIVE
      Indicates the negative side of the peak
      See Also:
    • POSITIVE

      public static final int POSITIVE
      Indicates the positive side of the peak
      See Also:
    • THREEPOINT

      public static final int THREEPOINT
      Three point fitting method
      See Also:
    • LEASTSQUARES

      public static final int LEASTSQUARES
      Least squares fitting method
      See Also:
  • Constructor Details

    • Gaussian

      public Gaussian()
      Constructor
    • Gaussian

      public Gaussian(double position, double width, double height)
      Constructor which creates a Gaussian by directly specifying its position, width and height.
      Parameters:
      position - the position of the peak
      width - the width (FWHM)
      height - the height of the peak
    • Gaussian

      public Gaussian(double[] xvals, double[] yvals, int fitMethod)
      Constructor which creates a Gaussian by the three point fit method or least squares fit method from sets of x and y data.
      Parameters:
      xvals - the array of xvalues
      yvals - the array of yvalues
      fitMethod - indicates which method of fitting to use
  • Method Details

    • yAtX

      public double yAtX(double xVal)
      Calculates the y value at a given x value
      Parameters:
      xVal - the x value to be used
      Returns:
      the calculated y value
    • derivativeAtX

      public double derivativeAtX(double xVal)
      Calculates the derivative at a given x value
      Parameters:
      xVal - the x value to be used
      Returns:
      the calculated derivative
    • xAtY

      public double xAtY(double yVal, int side)
      Calculates the x value at a given y value
      Parameters:
      yVal - the y value to be used
      side - either Gaussian.NEGATIVE or Gaussian.POSITIVE
      Returns:
      the calculated y value
    • derivativeAtY

      public double derivativeAtY(double yVal, int side)
      Calculates the derivative at a given y value
      Parameters:
      yVal - the y value to be used
      side -
      Returns:
      the calculated derivative