Package gda.util
Class Gaussian
java.lang.Object
gda.util.Gaussian
Class to represent a Gaussian curve by its three parameters. Only THREEPOINT works right now.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLeast squares fitting methodstatic final intIndicates the negative side of the peakstatic final intIndicates the positive side of the peakstatic final intThree point fitting method -
Constructor Summary
ConstructorsConstructorDescriptionGaussian()ConstructorGaussian(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 TypeMethodDescriptiondoublederivativeAtX(double xVal) Calculates the derivative at a given x valuedoublederivativeAtY(double yVal, int side) Calculates the derivative at a given y valuedoublexAtY(double yVal, int side) Calculates the x value at a given y valuedoubleyAtX(double xVal) Calculates the y value at a given x value
-
Field Details
-
NEGATIVE
public static final int NEGATIVEIndicates the negative side of the peak- See Also:
-
POSITIVE
public static final int POSITIVEIndicates the positive side of the peak- See Also:
-
THREEPOINT
public static final int THREEPOINTThree point fitting method- See Also:
-
LEASTSQUARES
public static final int LEASTSQUARESLeast 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 peakwidth- 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 xvaluesyvals- the array of yvaluesfitMethod- 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 usedside- 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 usedside-- Returns:
- the calculated derivative
-